2018年1月26日金曜日

Ubt_0010 ノートPCにUbuntuインストール

2008/04/17発表Windows Vistaの時代のノートパソコン 東芝dynabook Satellite A300 型番 PAAX53FLPPK 。
http://dynabook.com/pc/catalog/support/search/user/cgi-bin/disp.cgi?pid=PAAX53FLPPK&dir=DBs
廃棄前のジャンク箱入り状態であったが、ふと、Ubuntuで動くかどうか試してみた。
CPU Celeron550 2GHz メモリ2GB HDD160GB のスペックで、もはやWindowsで使うには今どきでない物である。

<参照したページ>
Ubuntu Desktop 日本語 Remixのダウンロード
http://www.ubuntulinux.jp/download/ja-remix
ftp://ftp.jaist.ac.jp/pub/Linux/ubuntu-jp-cdimage/releases/16.04/ubuntu-ja-16.04-desktop-amd64.iso
http://chee-s.net/UbuntuをUSBメモリからインストール
UNetbootin
http://unetbootin.github.io/
https://github.com/unetbootin/unetbootin/releases/download/657/unetbootin-mac-657.dmg

<md5チェックサム>
% md5 ubuntu-ja-16.04-desktop-amd64.iso
MD5 (ubuntu-ja-16.04-desktop-amd64.iso) = 76a02f16f56c01f96aeda325914432fd
% md5 unetbootin-mac-657.dmg
MD5 (unetbootin-mac-657.dmg) = 3f0bc9268f7f3852795a5cb66475c0ab

<ファイルサイズ>
% ls -lh ubuntu-ja-16.04-desktop-amd64.iso unetbootin-mac-657.dmg
1.3G 1 25 11:35 ubuntu-ja-16.04-desktop-amd64.iso
8.6M 1 25 10:49 unetbootin-mac-657.dmg


本ノートPCを以降AX300と呼ぶ。このAX300のCDドライブは故障しており使用できない。USBブートのためのUSBメモリは、2GBサイズのものを使用した。


<手順>
(1) UNetbootinでUSBブート準備
(1-1)AX300のハードディスクを潰して上書きでOKならばそのまま。あまったSATAディスクがあれば換装する。あまった2.5インチSSDなんかがあれば尚良しで入替える。


(1-2)2GBサイズのUSBメモリをiMacにセットする。
(1-3)iMacにてUSB書込みツールunetbootin-mac-657.dmg をインストールして起動する。
(1-4)入力は、Distributionとバージョン選んでネットワークからダウンロードすることもできるようだが、ここでは、Diskimageを選び、ubuntu-ja-16.04-desktop-amd64.iso を指定する。出力は、Type:USB Drive でマウント先は /dev/disk3s1となっている。OKを押して、書き込み開始する。


(1-5)書き込み実行中の画面。isoファイル中の253/389filesのfilesystem.squashfs(1268MB)が、でかくて、ここに時間がかかった。



(2) USBメモリからブート
(2-1)USBメモリをAX300にセットする。
(2-2)AX300の電源ON。起動順序がUSB->CD->HDDが出荷時設定のようで、USBメモリから起動し、UNetbootinのメニューが現れた。ここで下から3段目のInstall Ubuntuを選ぶ。


(2-3)Ubuntuインストーラの画面に従って[続ける]。最初は言語を日本語に。


(2-4)grubのインストールで間もなく終了。


(2-5)インストール完了で再起動する。約20分程度。


(2-6)初回のディストップにはキーボードショートカットが表示された。


(2-7)ディストップを開き動作確認する。
スクリーンのコピーは $ gnome-screenshotで採取した。

①HDDは320GBのSATA HDDを使用した。
②有線LANはenp2s0 ドライバはr8169
③無線LANはwlp3s0 ドライバはath5k
④iMacへのsshログインも問題なし
 本Ubuntuへのsshログインは
 # apt-get install openssh-server を行う。

初回のアップデートを行っておく。
# apt-get update
# apt-get upgrade
アップデートの個数は、
599 packages can be updated.
286 updates are security updates.
これだけあって、かなり時間がかかった。途中で止めると、
# dpkg --configure -a
とかする。

○ lighttpdのインストール
# apt-get install lighttpd
# cd /etc/lighttpd/
# cp -p lighttpd.conf lighttpd.conf.org
# vi  lighttpd.conf
# diff lighttpd.conf.org lighttpd.conf
9c9
< server.document-root        = "/var/www/html"
---
> server.document-root        = "/var/www"
11a12
> accesslog.filename          = "/var/log/lighttpd/access.log"
16c17
<
---
> server.dir-listing          = "enable"
26,27c27
< ## Use ipv6 if available
< #include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
---
> include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port



2017年12月24日日曜日

Android-009 root化(Nexus6P)

9.Nexus6P (Model:H1512)編

Nexus Root Toolkit v2.1.9でroot化できそうなのでやってみた。
手持ちのNexus6Pの履歴。
入手日2015年11月09日 ビルド番号:MDA89D Androidバージョン:6.0
更新日2017年12月23日 ビルド番号:OPM1.171019.011 Androidバージョン:8.1.0(OTAにて)
試行錯誤の上であり内容が間違っているかもしれないので参考程度とされたい。

(1)Nexus Root Toolkit(NRT)のダウンロード
参照ページ:Nexus Root Toolkit
から、NRT_v2.1.9.sfx.exeをダウンロードしてWin7機にをインストールした。
MD5 (NRT_v2.1.9.sfx.exe) = 53c4072f15343fd545b4676aa5bfd099
このNRT(v2.1.9)だけで、Nexus6Pのブートローダーアンロックとroot化できた。

(2)Nexus Root Toolkit(NRT)の操作

ANGLER Android 7.0.0 Build NRD90Uを選ぶ。NRD90Tも試したが、NRD90Tは電源ONのAndroidロゴ表示で止まってうまくいかなかった。

(2-1)Unlock
Nexus6P OEMロック解除の設定

Unlock Bootloaderのところでは、設定>開発者向けオプションに、OEMロック解除(ブートローダによるロック解除を許可する)を指定しておく。

(2-2)Flash Stock + Unroot

Factory Image Downloaderでは、ビルド番号:NRD90Uのもの、

C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Factory_Images\ に、
angler-nrd90u-factory-7c9b6a2bというフォルダができて、3.94GBサイズとなった。
手動でのダウンロードは yakju-jdq39-factory-6f07b069.zip というファイル名。

(2-3)FASTBOOT device was not found.

どの場面か記録できてないが、この画面になったときは、DOS窓から
>adb reboot bootloader
でブートローダー画面にした。

(2-4)メインパネルの[Root]ボタンでroot化する
Custom RecoveryにチェックをいれてTWRPも入れる。
TWRPを起動したければ > fastboot boot twrp-3.0.2-2-angler.img
とかすればよいのだろうが、今回は導入した。

TWMPでこんなのが出たが、Keep Read Onlyは選択しなかった。


TWRPのINSTALLで、SuperSU-v2.78-SR1.zipをインストールする。

(3)Root化の確認。


SuperSUアプリの設定画面で、スーパーユーザーが有効です。になってroot化は成功している。
このときの、端末の状態の画面には、Androidバージョン7.0 ビルド番号NRD90Uとなっている。


2017年9月6日水曜日

RPi_0030 partedとrestore

Raspbian のブートプロセスでrootマウントは、/boot/cmdline.txt と /etc/fstab で、"root=PARTUUID=12345678-02" と"PARTUUID=12345678-02 / ext4" などと、PARTUUIDを一致させて、ルートパーティションをマウントしている。

microSDの区画切りで、fdiskではPARTUUIDはフォーマット後に出現しない。
gdiskでは、Partition Table: gpt で区画するとPARTUUIDが現れるが、RaspberryPiは Partition Table: msdos でないと起動してくれない。

これが、partedだと、Partition Table: msdos にて、PARTUUIDは区画切り後に出現した。

partedで区画を作り、dumpバックアップからのrestoreしてmicroSDでの起動についての説明する。

(1) partedで区画を作成

(1-1)まず、8GBのmicroSDをfdiskで区画切りしてフォーマットでは、以下のようにblkidではPARTUUIDが出現しない。Disk identifier: 0x0になっている。
# fdisk -l /dev/sda

Disk /dev/sda: 7.4 GiB, 7985954816 bytes, 15597568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000 #ここ値がセットできれば良いのだが

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sda1         2048   104447   102400   50M  c W95 FAT32 (LBA)
/dev/sda2       104448 15597567 15493120  7.4G 83 Linux

# blkid | grep sda
/dev/sda1: SEC_TYPE="msdos" UUID="B7B2-351F" TYPE="vfat"
/dev/sda2: UUID="958651f6-3615-4ac6-afeb-bae165a936d9" TYPE="ext4"

(1-2)そのままmicroSDをpartedで、区画の削除をする。
# parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p #区画の確認
Model: Mass Storage Device (scsi)
Disk /dev/sda: 7986MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  53.5MB  52.4MB  primary  fat32        lba
 2      53.5MB  7986MB  7932MB  primary  ext4

(parted) rm 2 #区画2削除
Warning: Partition /dev/sda2 is being used. Are you sure you want to continue?
Yes/No? Yes
Error: Partition(s) 2 on /dev/sda have been written, but we have been unable to
inform the kernel of the change, probably because it/they are in use.  As a
result, the old partition(s) will remain in use.  You should reboot now before
making further changes.
Ignore/Cancel? I
(parted) rm 1 #区画1削除
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
Yes/No? Y
Error: Partition(s) 1, 2 on /dev/sda have been written, but we have been unable
to inform the kernel of the change, probably because it/they are in use.  As a
result, the old partition(s) will remain in use.  You should reboot now before
making further changes.
Ignore/Cancel? I
(parted) p #区画削除されたことの確認
Model: Mass Storage Device (scsi)
Disk /dev/sda: 7986MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End  Size  Type  File system  Flags

(parted)

(1-3)次に、mkpartで区画の作成をする。
(parted) mkpart #区画作成コマンド
Partition type?  primary/extended? p
File system type?  [ext2]? fat32 #fat32で区画の作成
Start? 0
End? 50M
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? I
Error: Partition(s) 1, 2 on /dev/sda have been written, but we have been unable
to inform the kernel of the change, probably because it/they are in use.  As a
result, the old partition(s) will remain in use.  You should reboot now before
making further changes.
Ignore/Cancel? I
(parted) mkpart
Partition type?  primary/extended? p
File system type?  [ext2]? ext4 #ext4で区画の作成
Start? 50M
End? 8G
Error: Partition(s) 1, 2 on /dev/sda have been written, but we have been unable
to inform the kernel of the change, probably because it/they are in use.  As a
result, the old partition(s) will remain in use.  You should reboot now before
making further changes.
Ignore/Cancel? I
 # # # インタラクティブ(interactive)な対話モードでなく、
 # (parted) mkpart p fat32 0% 50M
 # (parted) mkpart p ext4 50M 100%
 # とか、引数を指定して、start end は100%のように%も使えるようだ。
(parted) p #区画の確認
Model: Mass Storage Device (scsi)
Disk /dev/sda: 7986MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      512B    50.0MB  50.0MB  primary  fat32        lba
 2      50.3MB  7986MB  7936MB  primary  ext4         lba

(parted) quit #writeしなくてもquitで書き込んでくれるようだ。
Information: You may need to update /etc/fstab.

# 一旦このmicroSD8GBを取外して挿し直すか、再起動で区画の正常認識を確認する。
# partprobe -s
/dev/sda: msdos partitions 1 2
/dev/mmcblk0: msdos partitions 1 2

(1-4)フォーマットする
# fdisk -l /dev/sda

Disk /dev/sda: 7.4 GiB, 7985954816 bytes, 15597568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x88584BBB  ###これがPARTUUIDのもとになるようだ。

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1           1    98303    98303   48M  c W95 FAT32 (LBA)
/dev/sda2       98304 15597567 15499264  7.4G 83 Linux

# mkfs.vfat /dev/sda1 #vfatでフォーマット
mkfs.fat 3.0.27 (2014-11-12)
# mkfs.ext4 -j /dev/sda2 #ext4ジャーナル付きでフォーマット
mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 1937408 4k blocks and 484800 inodes
Filesystem UUID: 1de1421d-55c1-4fd1-94d4-e5b1d266dAAA
Superblock backups stored on blocks:
 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

# blkid | grep sda #こんどは以下のようにblkidでPARTUUIDが出現している。
/dev/sda1: SEC_TYPE="msdos" UUID="1A96-82FB" TYPE="vfat" PARTUUID="88584BBB-01"
/dev/sda2: UUID="1de1421d-55c1-4fd1-94d4-e5b1d266dAAA" TYPE="ext4" PARTUUID="88584BBB-02"
#

(2) dumpバックアップからのrestore

restore対象のmountポイントにcdしてrestoreする。
# mount /dev/sdb1 /dsk/sdb1 #/boot区画マウント
# mount /dev/sdb2 /dsk/sdb2 #ルート区画マウント
# cd /dsk/sdb1
# rsync -a /dsk/sda4/Backup/rapia/RootBz/boot/. . #/boot領域のコピー
# cd ../sdb2
# ls
lost+found
 #以下でrestoreの実行
# time bzip2 -dc /dsk/sda4/Backup/rapia/RootBz/b_mmcblk0_rapia_2017_0902/mmcblk0p2_2017_0902.dump.bz2| restore rf -

restore: ./lost+found: File exists

bzip2 -dc   953.43s user 33.54s system 85% cpu 19:19.90 total
restore rf -  15.04s user 67.21s system 7% cpu 19:21.66 total
#

1.5GBのリストアに953秒の約16分かかった。
結構まつので、進捗ぐあいの確認には、
while [ true ]; do echo -n "`date "+%H:%M:%S"` "; df -H |grep /dev/sdb2|awk '{print $1,$2,$3,$4}'; sleep 30; done
...とかで、
22:31:44 /dev/sdb2 7.8G 946M 6.4G
22:32:14 /dev/sdb2 7.8G 985M 6.4G
22:32:44 /dev/sdb2 7.8G 1.1G 6.4G
...などと見張る。

(3) cmdline.txtとfstabの修正

PARTUUIDの部分をblkidのものと、それぞれ一致させる。
# cat /dsk/sdb1/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=88584BBB-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
# cat /dsk/sdb2/etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=88584BBB-01  /boot           vfat    defaults          0       2
PARTUUID=88584BBB-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

◎ /dsk/sdb1と/dsk/sdb2をアンマウントして再起動する。
◎ restore後のmicroSD8GBの起動では、以下のようなPARTUUIDの状態になっている。
# ls -l /dev/disk/by-partuuid
total 0
lrwxrwxrwx 1 root root 15 Sep  2 14:17 88584BBB-01 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 15 Sep  2 14:17 88584BBB-02 -> ../../mmcblk0p2
# blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" UUID="1A96-82FB" TYPE="vfat" PARTUUID="88584BBB-01"
/dev/mmcblk0p2: UUID="1de1421d-55c1-4fd1-94d4-e5b1d266dAAA" TYPE="ext4" PARTUUID="88584BBB-02"
/dev/mmcblk0: PTUUID="88584BBB" PTTYPE="dos"
# grep PARTUUID /etc/fstab
PARTUUID=88584BBB-01  /boot           vfat    defaults          0       2
PARTUUID=88584BBB-02  /               ext4    defaults,noatime  0       1
# grep PARTUUID /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=88584BBB-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
#


2017年8月30日水曜日

RPi_0029 PulseAudio

Raspberry Pi3からBluetoothスピーカにペアリングして音楽再生する。
なおPiZeroWで同じ設定をしたが非力で音飛びするようだった。

以下のWebページの内容をトレースして設定した。
《参照》
Raspberry PI 3 で Bluetooth(A2DP)
http://qiita.com/nattof/items/3db73a95e63100d7580a

(1) PulseAudioのインストール

# apt-get install pulseaudio-module-bluetooth

(2) PulseAudioの設定

3つのファイルを設定する。
○その1
# cat << EOF > /etc/systemd/system/pulseaudio.service
[Unit]
Description=Pulse Audio

[Service]
Type=simple
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disable-shm

[Install]
WantedBy=multi-user.target
EOF
○その2
# cat << EOF > /etc/dbus-1/system.d/pulseaudio-bluetooth.conf
<busconfig>

  <policy user="pulse">
    <allow send_destination="org.bluez"/>
  </policy>

</busconfig>
EOF
○その3
# cat << EOF >> /etc/pulse/system.pa

### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
EOF

(3) 使用したbluetoothスピーカ


2年くらい前にSoftBankのキャンペーンでもらったOnyx Studioと、ことしの1月にauのキャンペーンでもらった座布団つきのGH-OTOMO。ともに再生は確認できたが、GH-OTOMOはボリュームがないので、AlsaMixerでの音量調整が必要。

(4) PulseAudioの起動

○pulseaudioサービスを起動
  # systemctl start pulseaudio.service
○pulseaudioサービスを自動で起動
  # systemctl enable pulseaudio.service
○bluetoothの再起動
  # /etc/init.d/bluetooth restart
[ ok ] Restarting bluetooth (via systemctl): bluetooth.service.

(5) bluetoothスピーカへの接続

bluetoothスピーカとペアリングして接続する
# bluetoothctl #bluetoothコントロールツール
[NEW] Controller 43:43:A1:12:AA:AA rapi3 [default]

[bluetooth]# scan on #スキャン開始
Discovery started
[CHG] Controller 43:43:A1:12:AA:AA Discovering: yes
[NEW] Device 0C:A6:94:0D:ZZ:ZZ HK Onyx Studio

[bluetooth]# pair 0C:A6:94:0D:ZZ:ZZ  #Onyx Studioとペアリング
Attempting to pair with 0C:A6:94:0D:ZZ:ZZ
[CHG] Device 0C:A6:94:0D:ZZ:ZZ Connected: yes
[CHG] Device 0C:A6:94:0D:ZZ:ZZ Paired: yes
Pairing successful

[bluetooth]# connect 0C:A6:94:0D:ZZ:ZZ #Onyx Studioに接続
Attempting to connect to 0C:A6:94:0D:ZZ:ZZ
[CHG] Device 0C:A6:94:0D:ZZ:ZZ Connected: yes
Connection successful

[bluetooth]# trust 0C:A6:94:0D:ZZ:ZZ #Onyx Studioを信頼
[CHG] Device 0C:A6:94:0D:ZZ:ZZ Trusted: yes
Changing 0C:A6:94:0D:ZZ:ZZ trust succeeded

[bluetooth]# info 0C:A6:94:0D:ZZ:ZZ #Onyx Studioの接続情報
Device 0C:A6:94:0D:ZZ:ZZ
 Name: HK Onyx Studio
 Alias: HK Onyx Studio
 Class: 0x240414
 Icon: audio-card
 Paired: yes
 Trusted: yes
 Blocked: no
 Connected: yes
 LegacyPairing: no
 UUID: Audio Sink                (XXX..XXX)
 UUID: A/V Remote Control Target (XXX..XXX)
 UUID: A/V Remote Control        (XXX..XXX)
[bluetooth]# scan off #スキャン終了
Discovery stopped
[CHG] Controller 43:43:A1:12:AA:AA Discovering: no
[bluetooth]# devices #検出したデバイス
Device 08:62:66:17:XX:XX 2F_NPlayer_2nd
Device 08:62:66:17:YY:YY 1F_NPlayer_1st
Device FC:58:FA:00:ZZ:ZZ GH-OTOMO
Device 0C:A6:94:0D:ZZ:ZZ HK Onyx Studio
[bluetooth]#

[bluetooth]# quit #終了
[DEL] Controller 43:43:A1:12:AA:AA rapi3 [default]

音を出すユーザーを「pulse-access」グループに追加
# gpasswd -a root pulse-access
# gpasswd -a user pulse-access
# grep pulse-access /etc/group
pulse-access:x:117:root,user #追加されたユーザを見る

(6) mplayerでの再生例

●1 bluetoothスピーカ再生
# mplayer --ao=pulse /usr/local/etc/mdetect/Mp3/01_Beautiful_World.mp3
# mplayer --ao=pulse 01_FIGHT_WITH_LOVE.m4a
●2 ミニプラグジャック再生
# mplayer --ao=alsa /usr/local/etc/mdetect/Mp3/01_Beautiful_World.mp3
●3 MUSIC BIRDデジタル音楽放送 岡山県 コミュニティFM レディオ モモ
# mplayer --ao=pulse --cache=900 --quiet 'http://musicbird-hls.leanstream.co/musicbird/JCB079.stream/playlist.m3u8?args=web_03'


2017年8月22日火曜日

RPi_0028 samba

(1) sambaのインストール

# apt-get install samba

(2) sambaの設定

設定ファイル smb.confを変更する。
# cp -p /etc/samba/smb.conf /etc/samba/smb.conf.org
# vi /etc/samba/smb.conf
にて、次の箇所をファイルの最後に追加する。

# diff -u /etc/samba/smb.conf.org /etc/samba/smb.conf
--- /etc/samba/smb.conf.org 2017-08-21 21:52:00.289168125 +0900
+++ /etc/samba/smb.conf 2017-08-21 21:57:37.187616391 +0900
@@ -252,3 +252,10 @@
 # to the drivers directory for these users to have write rights in it
 ;   write list = root, @lpadmin

+[mypiuser]
+path = /home/mypiuser
+read only = No
+browsable = yes
+guest ok = Yes
+force user = mypiuser

○ samba パスワードの変更
# smbpasswd -a mypiuser
New SMB password:
Retype new SMB password:
Added user mypiuser.

○ sambaを再起動させる
# /etc/init.d/samba restart
[ ok ] Restarting nmbd (via systemctl): nmbd.service.
[ ok ] Restarting smbd (via systemctl): smbd.service.
[ ok ] Restarting samba-ad-dc (via systemctl): samba-ad-dc.service.
macOSからは、Finderで、移動>サーバへ接続
サーバアドレス:smb://rapi3.local/mypiuser

windowsからは、エクスプローラから、ネットワーク
\\rapi3.local\mypiuser

とかでネットワーク越しにファイル操作できるようになる。


2017年7月30日日曜日

RPi_0027 exFATマウントdump

USBメモリに区画を作り、dumpバックアップについての説明する。

(1) exfatとdumpのインストール

WindowでもMacでも書き込めるexFATが使えるようにして、Raspbianのフルバックアップ用にdumpをインストールする。 FATについては、『FAT32、FAT16、NTFS、exFATとは何ですか。』 http://faq.buffalo.jp/app/answers/detail/a_id/1079 を参照。
# apt-get install exfat-fuse
( apt-get install exfat-utils ) #exfat-fuseで同時にインストールされる
# apt-get install dump  #restoreコマンドもインストールされる

(2) USBメモリの区画作成

USBメモリなら何でもよいと思われるが、ここではSanDisk SDDD2-016Gをラズパイに挿す。
% lsusb | head -1
Bus 001 Device 004: ID 0781:5590 SanDisk Corp. #USBメモリ認識

# 区画の状態を調べる
# コマンドとしては fdisk,cfdisk,sfdisk,parted,gpartedなどがある
# fdisk -l /dev/sda
Disk /dev/sda: 14.3 GiB, 15376000000 bytes, 30031250 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1          32 30031249 30031218 14.3G  c W95 FAT32 (LBA)
Idはcなので、W95 FAT32 (LBA) のフォーマットであるが、これを、
Idが7の、HPFS/NTFS/exFAT の フォーマットに切り直す。さらに
領域の半分は、Type Id 83 の Linuxフォーマットにする。
セクタ数30031218の半分は、
echo "(30031250-2048) / 2" | bc
の15014601 である。
# フォーマットの切り直し
# fdisk /dev/sda
Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1          32 30031249 30031218 14.3G  c W95 FAT32 (LBA)

Command (m for help): d 1
Selected partition 1
Partition 1 has been deleted.  # 区画1が削除された

Command (m for help): n  # 1つ目の新しい区画を作る
Partition type
Select (default p): p  #区画の種類はprimary
Partition number (1-4, default 1): 1
First sector (2048-30031249, default 2048):ENTERで2048
Last sector, +sectors or +size{K,M,G,T,P} (2048-30031249, default 30031249): +15014601
Created a new partition 1 of type 'Linux' and of size 7.2 GiB.
Command (m for help): n  # 2つ目の新しい区画を作る
Partition type
Select (default p): p  #区画の種類はprimary
Partition number (2-4, default 2):ENTERで2
First sector (15015936-30031249, default 15015936):ENTERで15015936
Last sector, +sectors or +size{K,M,G,T,P} (15015936-30031249, default 30031249):
ENTERで30031249になりお尻は (0-30031249)0オリジン開始。
Created a new partition 2 of type 'Linux' and of size 7.2 GiB.

Command (m for help): p  #できた区画をみる
Disk /dev/sda: 14.3 GiB, 15376000000 bytes, 30031250 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1           2048 15015935 15013888  7.2G 83 Linux
/dev/sda2       15015936 30031249 15015314  7.2G 83 Linux
#セクター数はheads/cylindersで丸められるので、ドンピシャな同じ区画サイズにならない
#セクター数15015314-15013888=1426のサイズ差となった

Command (m for help): t  #フォーマットタイプを変更
Partition number (1,2, default 2): 1  #対象の区画は1番目
Hex code (type L to list all codes): L  #Id番号のリスト

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT
 f  W95 Ext’d (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT
1e  Hidden W95 FAT1 80  Old Minix
Hex code (type L to list all codes): 7  #7  HPFS/NTFS/exFAT を選択
Changed type of partition 'Linux' to 'HPFS/NTFS/exFAT'.
#あるいは、
Hex code (type L to list all codes): c  #c  W95 FAT32 (LBA) を選択
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): p  #変更した区画をみる
Disk /dev/sda: 14.3 GiB, 15376000000 bytes, 30031250 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1           2048 15015935 15013888  7.2G  7 HPFS/NTFS/exFAT
/dev/sda2       15015936 30031249 15015314  7.2G 83 Linux

Command (m for help): w  #変更を書き込む
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

# リブートで反映されるとあるので
# reboot するか、USBメモリを抜いて、別なUSBポートに指し直す。
# partprobe がエラーにならなければOKだろう
# partprobe -s
/dev/sda: msdos partitions 1 2
/dev/mmcblk0: msdos partitions 1 2
区画ができたならば、つぎにフォーマットする
# mkfs.exfat -n exFAT_7G /dev/sda1
mkexfatfs 1.1.0
Creating... done.
Flushing... done.
File system created successfully.

もしくは、
# mkfs.vfat -v -F 32 -n FAT32_7G /dev/sda1
/dev/sda1 has 64 heads and 32 sectors per track,
(略)
Volume ID is 980b59c3, volume label FAT32_7G   .
必要ならオプション追加 -c:不良ブロックの検査を行う

# mkfs.ext4 -j -L ext4_7G /dev/sda2
mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 1876914 4k blocks and 469568 inodes
Filesystem UUID: fb6e48ef-b51c-44d1-b817-71677adac421
Superblock backups stored on blocks:
 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
フォーマットのあとマウントする
# mkdir -p /dsk/sda1; mkdir /dsk/sda2  #マウントポイント
# mount -v /dev/sda1 /dsk/sda1
FUSE exfat 1.1.0
# mount -v /dev/sda2 /dsk/sda2
mount: /dev/sda2 mounted on /dsk/sda2.

Raspbianがデスクトップ版の場合は、オートマウントされるようだ。
/dev/sda1        7506944    3872   7503072   1% /media/pi/exFAT_7G
/dev/sda2        7324192   33004   6899424   1% /media/pi/ext4_7G
マウントポイントはラベル名が使用される。

# mount|grep dsk   #マウントの状態
/dev/sda2 on /dsk/sda2 type ext4 (rw,relatime,data=ordered)
/dev/sda1 on /dsk/sda1 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)

# df -H|egrep 'Used|dsk'   #マウントの使用状況
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       7.5G   34M  7.1G   1% /dsk/sda2
/dev/sda1       7.7G  1.3M  7.7G   1% /dsk/sda1

# 取り外す前にはアンマウントする
# umount /dsk/sda1
# umount /dsk/sda2

(3) ext4区画のバックアップ

Raspbianのroot区画をフルバックアップする方法を示す。
以下の b_mmcblk0_local.sh スクリプトを/usr/local/bin/に置く。
</usr/local/bin/b_mmcblk0_local.sh>
#! /bin/bash
# $Id: b_mmcblk0_local.sh,v 1.1 2017-08-01 10:19:56+09 tsubota $
#
SEND_ADDR="MY_GMAIL@gmail.com"
FROM_ADDR="MY_GMAIL@gmail.com"

LogMailSend() {
    MDHM=`date '+%Y/%m/%d(%a) %H:%M:%S'`
    SUBJECT=$1
    MESS=$2
    logline=`echo $MDHM; echo $MESS`
    (echo "Mime-Version: 1.0"; echo "Content-Type: Text/Plain; charset=iso-2022-jp"; echo "Content-Transfer-Encoding: 7bit"; echo "Subject: $SUBJECT"; echo "To: ${SEND_ADDR}"; echo "From: ${FROM_ADDR}"; echo ""; echo "$DT" ; echo "from `hostname`"; echo "${MYCMD} Running LOG."; echo ${logline}|nkf -j) | /usr/sbin/exim4 -f ${FROM_ADDR} ${SEND_ADDR}
}
ExecMailSend() {
    MDHM=`date '+%Y/%m/%d(%a) %H:%M:%S'`
    SUBJECT=$1
    LISTFILE=$2
    LOGFILE="`pwd`/$LISTFILE"
    (echo "Mime-Version: 1.0"; echo "Content-Type: Text/Plain; charset=iso-2022-jp"; echo "Content-Transfer-Encoding: 7bit"; echo "Subject: $SUBJECT"; echo "To: ${SEND_ADDR}"; echo "From: ${FROM_ADDR}"; echo ""; echo "$DT" ; echo "from `hostname`"; echo "${MYCMD} Running LOG."; echo "LISTFILE=$LOGFILE"; nkf -j $LISTFILE) | /usr/sbin/exim4 -f ${FROM_ADDR} ${SEND_ADDR}
}

HDEV=mmcblk0p2
if [ `whoami` != "root" ]; then
    ERRMSG="User not root."
    echo $ERRMSG
    logger $ERRMSG
    exit 1
fi
MYCMD=$0
MYNM=`basename $0`
BODY=${MYNM%.sh}

RDIR=/dsk/sda2/Backup/rapi4/RootBz
if [ ! -d ${RDIR} ]; then
    ERRMSG="Not Mounted $RDIR."
    echo $ERRMSG
    LogMailSend "$MYNM FAIL1" "$ERRMSG"
    logger $ERRMSG
    exit 1
fi
cd $RDIR
if [ $? != 0 ]; then
    ERRMSG="CANNOT cd $RDIR."
    echo $ERRMSG
    logger $ERRMSG
    LogMailSend "$MYNM FAIL2" "$ERRMSG"
    exit 1
fi

YMD=`date "+%Y_%m%d"`
BDIR=${BODY}_${YMD}
if [ ! -d ${BDIR} ]; then
    mkdir -p ${BDIR}
    if [ $? != 0 ]; then
        ERRMSG="Cannot mkdir $BDIR."
 echo $ERRMSG
 logger $ERRMSG
        exit 1
    fi
fi

CLOG="${BDIR}/${HDEV}_${YMD}.log"
echo "START=`date`" | tee $CLOG
echo "----------------------------------------" | tee -a $CLOG
echo "% /sbin/fdisk -l /dev/mmcblk0" | tee -a $CLOG
/sbin/fdisk -l /dev/mmcblk0 | sed -n -e "/^Disk/,//p" | tee -a $CLOG
echo "----------------------------------------" | tee -a $CLOG
echo "% df" | tee -a $CLOG
df | tee -a $CLOG
echo "" | tee -a $CLOG
echo "" | tee -a $CLOG
echo "****************************************" | tee -a $CLOG
date | tee -a $CLOG
pwd | tee -a $CLOG
set -x
(/sbin/dump 0usf 99999 - /dev/${HDEV} | \
  bzip2 -c > ${BDIR}/${HDEV}_${YMD}.dump.bz2 ) 2>&1 | tee -a $CLOG
date | tee -a $CLOG
ls -l ${BDIR} | tee -a $CLOG
ls -lh ${BDIR} | tee -a $CLOG
md5sum ${BDIR}/${HDEV}_${YMD}.dump.bz2  | tee -a $CLOG
set +x
echo "****************************************" | tee -a $CLOG
echo "END=`date`" | tee -a $CLOG
ExecMailSend "$MYNM FINISH." "$CLOG"
exit 0

# end of b_mmcblk0_local.sh
b_mmcblk0_local.shに実行許可を与える。
たとえば、月初めに実行したいのならば、crontabに設定するとよい。
# chmod 755 /usr/local/bin/b_mmcblk0_local.sh
# vi /etc/crontab
4 2 1 * * root /usr/local/bin/b_mmcblk0_local.sh
ついたちの2時4分に起動する例。
rootで実行するよりは、/etc/groupの"disk:x:6:"の行にユーザを加えて、 ユーザモードでバックアップするのが、よりよいだろう。
復元は、
展開するディレクトリにcdしたあと、
# bzip2 -dc ABC.bz2 | restore rf - #フルリストア
# bzip2 -dc ABC.bz2 | restore ivf - #会話部分リストア
でできるだろう。

《2017.8.25追記》
restoreで、なんどやってもillegal hardware instruction restore rvf -
になってしまう。未解決。dumpファイルから復元できない。
《2017.9.6追記》
mkfs.ext4 のオプションで -L のラベルを付けなければ illegal hardware instruction にならず正常にrestoreできている。

代替えというか別な方法として、raspbianデスクトップ画面から
Raspiアイコン>Accessories>SD Card Copier
を使うことにする。
/dev/mmcblk0のp1とp2の区画をまるごと外部メディアに
バックアップしてくれる。
出力側は、自動で区画切りをしてくれて、cp -axコマンドでコピーする。
出力をUSBメモリでなく、microSDにすると起動メディアにもなる。
SD Card Copierは便利で、コピーも速い。

デスクトップSD Card Copierがないときは、
https://github.com/billw2/rpi-clone
A shell script to clone a running Raspberry Pi SD card to a USB mounted SD card.

# ./rpi-clone -h

usage: rpi-clone sdN {-v|--verbose} {-f|--force-initialize} {-s|--src-disk sdS} {-c|--cross-filesystems} {-x}
-v - list all files as they are copied.
-f - force initialize the destination partitions
-s sdS - specify sdS is the booted source disk to clone from.
Use this if the boot source auto detect from /etc/mtab fails.
Use with caution, be sure sdS is really the booted disk.
-c - cross filesystem boundaries (include mounted drives)
-x - use set -x for very verbose bash shell script debugging
...
Version 1.7.1
にて、コマンドラインから同様にバックアップできそう。


2017年7月27日木曜日

RPi_0026 TeraTerm自動ログイン

TeraTermのマクロ機能でttlマクロのアイコンをクリックすることで、一気にラズパイにsshログインする方法を示す。

(1) avahi-daemonのインストール

Avahi(アバヒ) は hostname.local という名前を使ってローカルでホスト名を解決する機能でありこれををラズパイ側にインストールする。
# apt-get install avahi-daemon
# apt-get install avahi-utils  #おまけ avahi-resolve使いたいとき
avahiが起動していることの確認
# ps ax|grep avahi|grep -v grep
  368 ?        Ss     2:01 avahi-daemon: running [rapiz.local]
  380 ?        S      0:00 avahi-daemon: chroot helper

(2) Bonjourのインストール

Bonjour印刷サービスをWindows10側にインストールする。
ダウンロード - Bonjour Print Services (Windows) - Apple Support
https://support.apple.com/kb/DL999?viewlocale=ja_JP
からダウンロードして、
Downloads/BonjourPSSetup.exe をクリックして、
「ようこそ Bonjour印刷サービス」の画面に従ってインストールを完了させる。
但しAppleのiTunesをすでにインストールしている場合やWindows10であれば、Bonjour機能はインストールされている可能性があり、先にpingしてみよう。
C:\Users>ping rapiz.local
ping 要求ではホスト rapiz.local が見つかりませんでした。ホスト名を確認してもう一度実行してください。
### pingが通らないか、
C:\Users>ping rapiz.local
rapiz.local [192.168.1.80]に ping を送信しています 32 バイトのデータ:
192.168.1.80 からの応答: バイト数 =32 時間 =12ms TTL=64
192.168.1.80 からの応答: バイト数 =32 時間 =11ms TTL=64
192.168.1.80 からの応答: バイト数 =32 時間 =10ms TTL=64
### pingが通ればBonjourはインストールされているだろう。

(3) ttlマクロファイルの編集

ttlマクロファイルの雛形が、
c:/Program Files (x86)/teraterm/ssh2login.ttlにあるので、これをデスクトップにコピーして、例えばssh2rapiz.ttl にリネームする。
c:/Users/Default/Desktop/ssh2rapiz.ttl を以下のように変更修正する。
*** c:/Program Files (x86)/teraterm/ssh2login.ttl
--- c:/Users/Default/Desktop/ssh2rapiz.ttl
@@ -6,19 +6,19 @@
 ; Update: 2004/12/4
 ; Author: Yutaka Hirata
 
-username = 'nike'
-hostname = '192.168.1.3'
+username = 'pi'
+hostname = 'rapiz.local'
+passwdfile = 'c:¥Program Files (x86)¥teraterm¥passwd_pi.dat'
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-msg = 'Enter password for user '
-strconcat msg username
-passwordbox msg 'Get password'
+getpassword passwdfile username userpasswd
 
 msg = hostname
 strconcat msg ':22 /ssh /auth=password /user='
 strconcat msg username
 strconcat msg ' /passwd='
+strconcat msg userpasswd
 strconcat msg inputstr
 
 connect msg
もし、ssh2rapiz.ttl が以下のような[M]マークアイコンになっていなければ、

teraterm-4.95.exeを再インストールして、

チェック項目の.ttlファイルをttermpro.exeに関連付ける

piユーザのパスワードは passwdfile = 'c:¥Program Files (x86)¥teraterm¥passwd_pi.dat' に保存される。このファイルが無ければパスワード入力されファイル作成され、ファイルがあればパスワードが読み出してデコードされて自動ログインのパスワードとして使用される。
bash-4.1$ cat "/cygdrive/c/Program Files (x86)/teraterm/passwd_pi.dat"
[Password]
pi=XXXXYYYYZZZZAAAABB  #エンコードされた文字列
たぶんHackingすればデコードできるんだろう。平文よりはヨシとする。

(4) ttlマクロの実行

ssh2rapiz.ttlのクリックで、TeraTerm自動ログインできる。
ログイン後の画面で、rapiz.localでの、IPアドレスの正引きと逆引きをしているようす。
pi@rapiz:~ $ ifconfig wlan0|grep "inet addr:"
          inet addr:192.168.1.80  Bcast:192.168.1.255  Mask:255.255.255.0
pi@rapiz:~ $
pi@rapiz:~ $ ping -c 2 rapiz.local|head -3
PING rapiz.local (192.168.1.80) 56(84) bytes of data.
64 bytes from rapiz.gjs.or.jp (192.168.1.80): icmp_seq=1 ttl=64 time=0.178 ms
64 bytes from rapiz.gjs.or.jp (192.168.1.80): icmp_seq=2 ttl=64 time=0.178 ms
pi@rapiz:~ $
pi@rapiz:~ $  avahi-resolve -n rapiz.local
rapiz.local     192.168.1.80
pi@rapiz:~ $
pi@rapiz:~ $ avahi-resolve -a 192.168.1.80
192.168.1.80    rapiz.local
pi@rapiz:~ $
これで、ネットワークの場所を移動するたびに、FingでラズパイのIPアドレスを調べて、TeraTerm起動しIPアドレスや、ユーザパスワードを入力していた手間が省ける。アイコンのクリック一発でログインできて、とても便利になるはずだ。

<20180127_補足追加:TeraTermのsshログイン時にログを記録版>
; $Id: sshLOG_rapi4.ttl,v 1.00 2018/01/23 13:19:50 RDH_team $
; sample macro of Tera Term
;
; File: ssh2login.ttl
; Description: auto login with SSH2 protocol
; Environment: generic
; Update: 2004/12/4
; Author: Yutaka Hirata
;
; (参照したURL)
; 1.マクロサンプル - 自動ログイン(SSH版)Add Star (2012.12.30)
;   http://d.hatena.ne.jp/KuroNeko666/20121230/1356931071
; 2.TeraTermマクロ-MACROで設定する自動ログ取得 (2011/04/25)
;   http://www.j-oosk.com/teraterm/logging/254/

hostnam1 = 'rapi4'
hostnam2 = '.local'
hostname = hostnam1
strconcat hostname hostnam2
username = 'myname'
basedir = 'c:\Usr\TT_LOG\'
passwdfile = basedir
strconcat passwdfile 'passwd_rapi4_myname.dat'
;; ログ保存先指定 
LOGSPATH = basedir
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
getpassword passwdfile username userpasswd

msg = hostname
strconcat msg ':22 /ssh /auth=password /user='
strconcat msg username
strconcat msg ' /passwd='
strconcat msg userpasswd
strconcat msg inputstr

;; ⑤ログファイル名の設定
getdate LOG_NAME '_%Y%m%d_%H%M.txt'
FULLPATH = LOGSPATH 
strconcat FULLPATH hostnam1
strconcat FULLPATH LOG_NAME

;; ⑥接続 
connect msg

;; ⑦接続判定1(接続出来ない場合はメッセージを表示しマクロ終了) 
if result <> 2 then
  ERR_MESS = 'Cannot HOST '
  strconcat ERR_MESS hostname
  messagebox ERR_MESS 'Connection Error' 
  end 
endif

;; ⑧接続判定2(接続して3秒以内にプロンプトが表示されない場合もマクロ終了) 
timeout = 3 
wait '$ ' '% ' '# '
if result = 0 then 
  ERR_MESS = 'NoResponse HOST '
  strconcat ERR_MESS hostname
  messagebox ERR_MESS 'Connection Error' 
  end 
endif

;; ⑨ログ取得開始
logopen FULLPATH 0 1
if result then
  messagebox FULLPATH 'logopen Error' 
  end 
endif
logwrite 'Log start '
logwrite FULLPATH
logwrite #13#10
logwrite '*****************************************************'#13#10
;logclose
;; ⑩ホスト名表示 
;sendln 'hostname' 
;wait '$' '#'

;; ⑪マクロ終了 
;end