普段モバイルで使っているVersaProが外出先で起動しなくなったので焦りました。
BIOSは正常に起動してUbuntuに制御が移るところまでは確認できたので、ハードウェア障害の可能性は低そうだと判断できました。
真っ先に思いつくのが、自宅でアップデート(apt-get update, upgrade)したのが原因だろうなぁ・・・ということぐらい。
目次
原因
Ubuntuの最新カーネル"4.13.0-26-generic"だと起動しない...。
臨時対応
以前のカーネルが残っているので、起動時にそちらを選択して起動します。
操作方法
GRUBメニューを表示
起動時に"Shift"キーを押す
- (BIOSとキーが競合することはないと思うので)最初からキーを優しく連打します
- GRUB loading.. と表示されたら、キーを押すのを止めます
- しばらくすると、GRUBメニューが表示されます
GRUBメニューで古い方のカーネルを選択
- "Advanced options for Ubuntu"に移動してEnterキーで選択します
- 一覧から古い方のカーネルを選択します
- 私の場合は、"Ubuntu, with Linux 4.10.0-37-generic"でした
しばらくすると起動します
なお、以下のコマンドで現在のカーネルを確認できます。
$ uname -r
4.10.0-37-generic
恒久対応
毎回、同じ作業は面倒なので、デフォルトの設定を変更します。
※後日、新しくなったカーネルでも起動する場合は、同じ方法で元に戻せます
GRUBの設定変更
カーネル名を確認
上記、臨時対応で起動した後にカーネルの名称を確認します。
今回は、臨時対応時にGRUBメニューでバージョン"4.xx"なのが分かっているので、以下コマンドで確認しました。
$ cat /boot/grub/grub.cfg | grep 'Linux 4'
set default="1>Ubuntu, with Linux 4.10.0-37-generic"
menuentry 'Ubuntu, with Linux 4.13.0-26-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.13.0-26-generic-advanced-e08a850b-13b9-43f5-a379-a9ad3608cfea' {
echo 'Linux 4.13.0-26-generic をロード中...'
menuentry 'Ubuntu, with Linux 4.13.0-26-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.13.0-26-generic-recovery-e08a850b-13b9-43f5-a379-a9ad3608cfea' {
echo 'Linux 4.13.0-26-generic をロード中...'
menuentry 'Ubuntu, with Linux 4.10.0-37-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-37-generic-advanced-e08a850b-13b9-43f5-a379-a9ad3608cfea' {
echo 'Linux 4.10.0-37-generic をロード中...'
menuentry 'Ubuntu, with Linux 4.10.0-37-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-37-generic-recovery-e08a850b-13b9-43f5-a379-a9ad3608cfea' {
echo 'Linux 4.10.0-37-generic をロード中...'
なお、viやlessコマンドでファイルを閲覧する際は"submenu"の下にあります。
今回は、2つのカーネル名が確認できます。
- Ubuntu, with Linux 4.10.0-37-generic
- Ubuntu, with Linux 4.13.0-26-generic
カーネルの設定変更
GRUB2は設定ファイル"/etc/default/grub"を編集した後、(先ほどカーネル名を確認した)"/boot/grub/grub.cfg"を生成します。
設定ファイルの編集
"GRUB_DEFAULT"行を変更します。
$ head /etc/default/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_DEFAULT="1>Ubuntu, with Linux 4.10.0-37-generic"
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
なお、以下のようにフルで入力してもOKな模様。
GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.10.0-37-generic"
grub.cfg 生成
編集した"/etc/default/grub"から"/boot/grub/grub.cfg"を再生成します。
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Linux イメージを見つけました: /boot/vmlinuz-4.13.0-26-generic
Found initrd image: /boot/initrd.img-4.13.0-26-generic
Linux イメージを見つけました: /boot/vmlinuz-4.10.0-37-generic
Found initrd image: /boot/initrd.img-4.10.0-37-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
完了
base on grub-mkconfig
GRUB-MKCONFIG(8) System Administration Utilities
NAME grub-mkconfig - generate a GRUB configuration file
SYNOPSIS grub-mkconfig [OPTION]
DESCRIPTION
Generate a grub config file-o, --output=FILE output generated config to FILE [default=stdout] -h, --help print this message and exit -v, --version print the version information and exit
教訓
アップデート後、可能なら再起動して確認する。