KVM で VM を起動するときにシリアルコンソールに起動情報が流れてくれたら起動の様子がわかって大変便利なので、その設定を追加。
1. Debian GNU/Linux
/etc/defaults/grub を以下のように修正。
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX='console=tty0 console=ttyS0,115200n8'
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
これで、ログインプロンプトまで出る。もちろん、修正した後は、update-grub を忘れないように。ただ、うちの環境だと、grub メニューの選択肢が表示されない。まあ、デフォルト以外で起動することはないので、放っておいてます。
2. CentOS 7
/etc/defaults/grub を以下のように修正。
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console serial"
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb console=tty0 console=ttyS0,115200n8"
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_DISABLE_RECOVERY="true"
その後、sudo grub2-mkconfig -o /boot/grub2/grub.cfg を実行。
3. FreeBSD 11.1
まず、/boot.config を作成して、以下の内容を設定。
% cat /boot.config
-Dh -S115200
次に、/etc/ttys の ttyu0 以下のように修正。
ttyu0 "/usr/libexec/getty std.115200" vt100 on secure
これで再起動をかけると、起動メッセージがだーっとシリアルポートから出力される。その上、ログインプロンプトまで出てくれる。便利。
4. OpenBSD 6.2
/etc/boot.conf を作成して以下の内容を追加。
stty com0 115200
set tty com0
次に、/etc/ttys の tty00 の行を変更。
tty00 "/usr/libexec/getty std.115200" vt220 on secure
5. DragonFly BSD 5.0.2
/boot/loader.conf に以下の行を追加。
console=comconsole
次に、/etc/ttys の ttyd0 の行を変更。
ttyd0 "/usr/libexec/getty std.115200" cons25 on secure