本連載は
今回紹介するのはpmountというコマンドをパッケージ化する際に遭遇したトラブルです。実のところトラブルの原因はこのソフトウェアとは違うところにあったのですが,
pmountとは?
伝統的なUNIXの考え方では,
mountコマンド自体は一般ユーザでも実行できますが,
UNIXのこの考え方は,
たとえば,
/dev/cdrom /cdrom iso9660 user,ro,noauto,exec,iocharset=euc-jp 0 0
CD-ROMやフロッピーディスクのように,
Linuxカーネルでは,
pmount
トラブル発生
pmountは現在も開発が続いており,
ところが手元にあったUSBメディアプレイヤーを挿してテストしてみると,
% ./work/usr/bin/pmount /dev/sda1 Error: device /dev/sda1 is not removable
直接mountコマンドを使えば問題なくマウントできます。
# mount /dev/sdb1 /media # df Filesystem 1K-ブロック 使用 使用可 使用% マウント位置 /dev/hda3 19236340 16601960 1657228 91% / none 1037060 168 1036892 1% /dev .... /dev/sdb1 942864 885448 57416 94% /media
しばらくドキュメントを調べたり,
pmountのヘルプメッセージを見ると,
% ./work/usr/bin/pmount -d /dev/sdb1 resolved /dev/sdb1 to device /dev/sdb1 Checking for device '/dev/sdb1' in '/etc/fstab' -> not foundmount point to be used: /media/sdb1 no iocharset given, current locale encoding is EUC-JP Cleaning lock directory /var/lock/pmount_dev_sdb1 Checking for device '/dev/sdb1' in '/etc/mtab' -> not foundChecking for device '/dev/sdb1' in '/proc/mounts' -> not founddevice_whitelist: checking /etc/pmount.allow... device_whitlisted(): nothing matched, returning 0 find_sysfs_device: looking for sysfs directory for device 8:17 find_sysfs_device: checking whether /dev/sdb1 is on /sys/block/ram0 (1:0) find_sysfs_device: checking whether /dev/sdb1 is on /sys/block/ram1 (1:1) ... find_sysfs_device: checking whether /dev/sdb1 is on /sys/block/sda (8:0) find_sysfs_device: major device numbers match find_sysfs_device: minor device numbers do not match, checking partitions... find_sysfs_device: checking whether device /dev/sdb1 matches partition 8:0 ... find_sysfs_device: checking whether device /dev/sdb1 matches partition 8:17 find_sysfs_device: -> partition matches, belongs to block device /sys/block/sdb device_removable: could not find a sysfs device for /dev/sdb1 Error: device /dev/sdb1 is not removable policy check failed
-dオプションを指定するとずいぶん詳細なデバッグメッセージを出してくれました。このメッセージを見る限り,
pmount がどうやってリムーバブルメディアか否かを判断しているかは,