LoginSignup
1
0

More than 1 year has passed since last update.

Ubuntu でアップデートで問題の発生したカーネルを旧カーネルに戻す

Posted at

イマドキは /boot にある grub.cfg は直接触らないらしい。
仕組みを調べて試してみる。

環境

  • Ubuntu 22.04 LTS

grub の構成

/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_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
.
.
.
$ sudo grep menuentry /boot/grub/grub.cfg

とすると

submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-c93329a3-e409-45c4-ae63-9a5608a32d05' {
	menuentry 'Ubuntu, with Linux 5.19.0-35-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.19.0-35-generic-advanced-c93329a3-e409-45c4-ae63-9a5608a32d05' {
	menuentry 'Ubuntu, with Linux 5.19.0-35-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.19.0-35-generic-recovery-c93329a3-e409-45c4-ae63-9a5608a32d05' {
	menuentry 'Ubuntu, with Linux 5.19.0-32-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.19.0-32-generic-advanced-c93329a3-e409-45c4-ae63-9a5608a32d05' {
	menuentry 'Ubuntu, with Linux 5.19.0-32-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.19.0-32-generic-recovery-c93329a3-e409-45c4-ae63-9a5608a32d05' {
	menuentry 'Ubuntu, with Linux 5.15.0-60-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-60-generic-advanced-c93329a3-e409-45c4-ae63-9a5608a32d05' {
	menuentry 'Ubuntu, with Linux 5.15.0-60-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-60-generic-recovery-c93329a3-e409-45c4-ae63-9a5608a32d05' {
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {

今動いているのは 'Ubuntu, with Linux 5.19.0-35-generic''Ubuntu, with Linux 5.15.0-60-generic' を動かすようにしたい。

作業

$ sudo vim /etc/default/grub

として、

GRUB_DEFAULT="1>4"

としました。これは、2番目のメニュー内の5番目のサブメニューの選択を示しています(数字はゼロスタートです)。

反映は

$ sudo update-grub

再起動して

$ uname -a
Linux nanbuwks-B550M-S2H 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

うまくいったようです。

うまくいかなかった例!

GRUB_DEFAULT='Ubuntu, with Linux 5.15.0-60-generic'

としたら、うまくいきませんでした。シングルクォーテーションがダメだったかな?

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0