Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
I upgraded my old ubuntu 22 to the new distribution via
sudo do-release-upgrade
After that, my ubuntu linux can no longer boot.
Upon recovery mode, I can see this error message:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
What can I do?
Perform a correct boot
Go to the grub shell by starting your computer and hold shift until grub menu shows up. Then press c button to go to grub shell.
Then type
ls
in the grub shell to see the mounting drives. For me, it shows:
(hd0), (hd0, msdos6), (hd0, msdos5), (hd0, msdos1), (hd1), (hd1, msdos4), (hd1, msdos2), (hd1, msdos1)
I found my boot images at
ls (hd0,msdos6)/boot/
giving me the list of files including:
efi/
grub/
config-5.15.0.139-generic
vmlinuz-5.15.0.139-generic
initrd.img-5.15.0.139-generic
Then, mount the correct kernel image:
set root=(hd0,msdos6) linux /boot/vmlinuz-5.15.0-139-generic root=/dev/sda6 ro quiet initrd /boot/initrd.img-5.15.0-139-generic boot
Make sure the vmlinuz
and initrd
have the same versions. Do not mix the versions.
In my case, the reboot causes the following error:
Alert! /dev/sda6 does not exist. Droping to a shell!
It showed me this error and dropped me to initramfs
shell. This is because I had to use /dev/sda6
instead of /dev/sdb6
.
Permanent fix after proper booting
But, after reboot, will the problem happen again?
To make a permanent fix, follow these steps:
Fix/Reinstall the Kernel:
sudo apt update sudo apt install --reinstall linux-image-6.8.0-59-generic
Regenerate Initramfs:
sudo update-initramfs -u -k all
Rebuild GRUB Bootloader
sudo update-grub