debian testing 更新掉进systemd-240的坑里了
重启开机Missing modules (cat /proc/modules; ls /dev), 找不到硬盘.
只能降到systemd-239或者降内核.
想想还是降内核方便, 记录下修改步骤.

1. 查看当前内核的启动顺序

$ cat /boot/grub/grub.cfg

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default=0
fi

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
	set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-d689cedc-8dc2-4ebb-919f-fe47b628db44' {
	load_video
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod part_msdos
	insmod ext2
	set root='hd0,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  d689cedc-8dc2-4ebb-919f-fe47b628db44
	else
	  search --no-floppy --fs-uuid --set=root d689cedc-8dc2-4ebb-919f-fe47b628db44
	fi
	echo	'Loading Linux 4.19.0-1-amd64 ...'
	linux	/boot/vmlinuz-4.19.0-1-amd64 root=UUID=d689cedc-8dc2-4ebb-919f-fe47b628db44 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-4.19.0-1-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-d689cedc-8dc2-4ebb-919f-fe47b628db44' {
	menuentry 'Debian GNU/Linux, with Linux 4.19.0-1-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-1-amd64-advanced-d689cedc-8dc2-4ebb-919f-fe47b628db44' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  d689cedc-8dc2-4ebb-919f-fe47b628db44
		else
		  search --no-floppy --fs-uuid --set=root d689cedc-8dc2-4ebb-919f-fe47b628db44
		fi
		echo	'Loading Linux 4.19.0-1-amd64 ...'
		linux	/boot/vmlinuz-4.19.0-1-amd64 root=UUID=d689cedc-8dc2-4ebb-919f-fe47b628db44 ro  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.19.0-1-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.19.0-1-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-1-amd64-recovery-d689cedc-8dc2-4ebb-919f-fe47b628db44' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  d689cedc-8dc2-4ebb-919f-fe47b628db44
		else
		  search --no-floppy --fs-uuid --set=root d689cedc-8dc2-4ebb-919f-fe47b628db44
		fi
		echo	'Loading Linux 4.19.0-1-amd64 ...'
		linux	/boot/vmlinuz-4.19.0-1-amd64 root=UUID=d689cedc-8dc2-4ebb-919f-fe47b628db44 ro single 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.19.0-1-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.18.0-3-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.0-3-amd64-advanced-d689cedc-8dc2-4ebb-919f-fe47b628db44' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  d689cedc-8dc2-4ebb-919f-fe47b628db44
		else
		  search --no-floppy --fs-uuid --set=root d689cedc-8dc2-4ebb-919f-fe47b628db44
		fi
		echo	'Loading Linux 4.18.0-3-amd64 ...'
		linux	/boot/vmlinuz-4.18.0-3-amd64 root=UUID=d689cedc-8dc2-4ebb-919f-fe47b628db44 ro  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.18.0-3-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.18.0-3-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.0-3-amd64-recovery-d689cedc-8dc2-4ebb-919f-fe47b628db44' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  d689cedc-8dc2-4ebb-919f-fe47b628db44
		else
		  search --no-floppy --fs-uuid --set=root d689cedc-8dc2-4ebb-919f-fe47b628db44
		fi
		echo	'Loading Linux 4.18.0-3-amd64 ...'
		linux	/boot/vmlinuz-4.18.0-3-amd64 root=UUID=d689cedc-8dc2-4ebb-919f-fe47b628db44 ro single 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.18.0-3-amd64
	}
}

2. 修改grub文件

假设要修改为4.18.0-3内核启动, 修改文件文件/etc/default/grub

$ sudo vim /etc/default/grub
GRUB_DEFAULT=0 修改为
GRUB_DEFAULT="Advanced options for Debian GNU/Linux>Debian GNU/Linux, with Linux 4.18.0-3-amd64"

其中Advanced options for Debian GNU/Linux是一级菜单,Debian GNU/Linux, with Linux 4.18.0-3-amd64是二级菜单, 中间用>连接.

3. 更新修改后的grub

sudo update-grub

这时候重新cat /boot/grub/grub.cfg 可以看到已经更新了.

重启后, 用uname -r也可以看到当前使用的内核.