CentOS6系のkickstartインストールとシリアルコンソールの謎
不思議な出来事 〜謎のエコーバック〜
kickstartを利用してサーバを大量精算していたんだけれど、どうもシリアルコンソールを取得するとパスワードがエコーバックされたりしておかしい。kickstartファイルのオプションを設定
kickstartファイルの中でブートローダに渡るオプションを追記している。内容的には問題ないと思う。
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb console=tty0 console=ttyS1,115200n8"
stty -aでチェックしてみる
# stty -a stty -a <--もうなんか既にコマンドもエコーバックされちゃってる。 speed 115200 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts -cdtrdsr -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
kickstartを使わずに手作したサーバを見てみると、正しい挙動をしているサーバは、こんな感じになっている。
# stty -a speed 115200 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts -cdtrdsr -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt -echoctl echoke
どうもechoctlが問題みたいだ。
2台の差異を確認してみると/boot/grub/grub.confがおかしいことがわかった。
kickstartインストール直後の状態
# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/sda3 # initrd /initrd-[generic-]version.img #boot=/dev/sda default=0 timeout=5 serial --unit=1 --speed=115200 terminal --timeout=5 serial console title CentOS (2.6.32-279.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us console=ttyS1,115200n8 LANG=en_US.UTF-8 rd_NO_MD crashkernel=auto rhgb console=tty0 console=ttyS1,115200n8 SYSFONT=latarcyrheb-sun16 rd_NO_LVM rd_NO_DM initrd /initramfs-2.6.32-279.el6.x86_64.img
あれ、console=ttyS1,115200n8が二重に書かれている。
serialの記述もあわせて以下のように修正する。
# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/sda3 # initrd /initrd-[generic-]version.img #boot=/dev/sda default=0 timeout=5 serial --speed=115200 --unit=1 --word=8 --parity=no --stop=1 terminal --timeout=5 serial console title CentOS (2.6.32-279.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD crashkernel=auto rhgb console=tty0 console=ttyS1,115200n8 SYSFONT=latarcyrheb-sun16 rd_NO_LVM rd_NO_DM initrd /initramfs-2.6.32-279.el6.x86_64.img
これ、ちゃんとkickstartファイルを書けば問題ないものなんだろうか?
ドキュメント類には載ってないよね。