Ubuntu Server boots to grub rescue after every kernel upgrade, have to revert to older kernel to boot, wrong disk in grub?
by surfrock66 from LinuxQuestions.org on (#592HD)
I have a relatively new Ubuntu server but every time I reboot, I'm sent to GRUB rescue and have to do some weird stuff to get it to work. First, here's my partition layout from within the working server:
Code:NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 97.7M 1 loop /snap/core/10126
loop1 7:1 0 97.1M 1 loop /snap/core/9993
loop2 7:2 0 55M 1 loop /snap/core18/1880
loop3 7:3 0 68.6M 1 loop /snap/lxd/17597
loop4 7:4 0 55.3M 1 loop /snap/core18/1885
loop5 7:5 0 68.6M 1 loop /snap/lxd/17629
sda 8:0 0 3.7T 0 disk
sda1 8:1 0 1G 0 part
sda2 8:2 0 3.7T 0 part /
sr0 11:0 1 1024M 0 romHere's the end of fdisk -l:
Code:Device Start End Sectors Size Type
/dev/sda1 2048 2099199 2097152 1G BIOS boot
/dev/sda2 2099200 7809791999 7807692800 3.7T Linux filesystemWhen I reboot, it appears that the system is looking for /boot on /dev/sda1, but /boot is actually in /dev/sda2 (which in GRUB is (hdo,gpt2)).
If I look in /boot, I see the following:
Code:config-5.4.0-45-generic
config-5.4.0-47-generic
config-5.4.0-48-generic
grub
grub.bak
initrd.img
initrd.img-5.4.0-45-generic
initrd.img-5.4.0-47-generic
initrd.img-5.4.0-48-generic
initrd.img.old
memtest86+.bin
memtest86+.elf
memtest86+_multiboot.bin
System.map-5.4.0-45-generic
System.map-5.4.0-47-generic
System.map-5.4.0-48-generic
vmlinuz
vmlinuz-5.4.0-45-generic
vmlinuz-5.4.0-47-generic
vmlinuz-5.4.0-48-generic
vmlinuz.oldSo, it reboots, I get brought to GRUB rescue. If I do the following:
Code:set prefix=(hd0,gpt2)/boot/grub
set root=(hd0,gpt2)
insmod normal
normal
bootI get:
Code:Error: you need to load kernel firstIf I try to load the kernel with the following:
Code:insmod linux
linux /boot/vmlinuz root=/dev/sda2I get:
Code:error: attempt to read or write outside of disk hd0''Instead, if I do the following:
Code:linux /boot/vmlinuz-5.4.0-45-generic root=/dev/sda2
initrd /boot/initrd.img-5.4.0-45-generic
bootI'm good to go.
I'm in over my head a bit here, what's the best course of action for getting this so the system can safely reboot after a kernel update? Try to move /boot back to sda1? Change some configuration so it remembers to point to sda2?


Code:NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 97.7M 1 loop /snap/core/10126
loop1 7:1 0 97.1M 1 loop /snap/core/9993
loop2 7:2 0 55M 1 loop /snap/core18/1880
loop3 7:3 0 68.6M 1 loop /snap/lxd/17597
loop4 7:4 0 55.3M 1 loop /snap/core18/1885
loop5 7:5 0 68.6M 1 loop /snap/lxd/17629
sda 8:0 0 3.7T 0 disk
sda1 8:1 0 1G 0 part
sda2 8:2 0 3.7T 0 part /
sr0 11:0 1 1024M 0 romHere's the end of fdisk -l:
Code:Device Start End Sectors Size Type
/dev/sda1 2048 2099199 2097152 1G BIOS boot
/dev/sda2 2099200 7809791999 7807692800 3.7T Linux filesystemWhen I reboot, it appears that the system is looking for /boot on /dev/sda1, but /boot is actually in /dev/sda2 (which in GRUB is (hdo,gpt2)).
If I look in /boot, I see the following:
Code:config-5.4.0-45-generic
config-5.4.0-47-generic
config-5.4.0-48-generic
grub
grub.bak
initrd.img
initrd.img-5.4.0-45-generic
initrd.img-5.4.0-47-generic
initrd.img-5.4.0-48-generic
initrd.img.old
memtest86+.bin
memtest86+.elf
memtest86+_multiboot.bin
System.map-5.4.0-45-generic
System.map-5.4.0-47-generic
System.map-5.4.0-48-generic
vmlinuz
vmlinuz-5.4.0-45-generic
vmlinuz-5.4.0-47-generic
vmlinuz-5.4.0-48-generic
vmlinuz.oldSo, it reboots, I get brought to GRUB rescue. If I do the following:
Code:set prefix=(hd0,gpt2)/boot/grub
set root=(hd0,gpt2)
insmod normal
normal
bootI get:
Code:Error: you need to load kernel firstIf I try to load the kernel with the following:
Code:insmod linux
linux /boot/vmlinuz root=/dev/sda2I get:
Code:error: attempt to read or write outside of disk hd0''Instead, if I do the following:
Code:linux /boot/vmlinuz-5.4.0-45-generic root=/dev/sda2
initrd /boot/initrd.img-5.4.0-45-generic
bootI'm good to go.
I'm in over my head a bit here, what's the best course of action for getting this so the system can safely reboot after a kernel update? Try to move /boot back to sda1? Change some configuration so it remembers to point to sda2?