TenForward

技術ブログ。はてなダイアリーから移転しました

Ubuntu 10.10 の mountall コマンド

Ubuntu 10.10 で /dev/pts はどこでマウントしてるんだ? としらべてました.

  • /etc/fstab には書いてない.
  • /etc/init を devpts とかで grep しても出てこない.

うむむ...

upstart のジョブ定義ファイルの中に mountall.conf というのがあるので,それを見てみると "Mount filesystems on boot" とあり,何を実行しているかというと

exec mountall --daemon $force_fsck $fsck_fix

mountall コマンドです.man mountall すると "Mount filesystems during boot" とあります.ソースを取得して見てみると,src/ ディレクトリ以下は

ls mountall-2.19/src
Makefile.am  Makefile.in  fstab  ioprio.h  mountall.c

とシンプル.ここに fstab ファイルがあり

none            /dev                      devtmpfs,tmpfs  mode=0755                         0 0
none            /dev/pts                  devpts          noexec,nosuid,gid=tty,mode=0620   0 0

とありましたとさ.mountall.c を見ると,こんな行が.

#define BUILTIN_FSTAB   "/lib/init/fstab"

なるほど /lib/init 以下に fstab というファイルがあるわ...

int
main (int   argc,
      char *argv[])
{
    : (snip)
        parse_fstab (BUILTIN_FSTAB);
        parse_fstab (_PATH_MNTTAB);
    : (snip)
}

なんて処理があるので,/lib/init/fstab と /etc/fstab (paths.h 内で定義されている _PATH_MNTTAB) を読むようになってます.

頼む,もう少し見通し良く... (>_<) どういう意味があるんだろ? /etc/fstab でええやん... (/lib/init/fstab の方は "optional" なんてオプションがあって,存在しないデバイスはマウントしないようにはなってます)

何がしたかったかというと /dev/pts のマウントオプションを変えたかっただけなんですけど... /lib/init/fstab を変えちゃっていいのかな? (Ubuntu の流儀的に)

.... /lib/init/fstab のコメントに

# These are the filesystems that are always mounted on boot, you can
# override any of these by copying the appropriate line from this file into
# /etc/fstab and tweaking it as you see fit.  See fstab(5).

とありました.

/etc/fstab に書いたら無事そっちの設定が使われましたとさ.

none            /dev/pts        devpts  noexec,nosuid,newinstance,ptmxmode=0666,gid=tty,mode=0620   0        0

の "ptmxmode" オプションが効いてないけど... (>_<) (調べるの面倒だから /etc/rc.local で chmod した ^^;)