Skip to content


Fixing out of memory error when loading initial ramdisk and Kernel Panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0) while booting Ubuntu 22.04

If while booting Ubuntu, it stops and shows you this error:

out of memory error when loading initial ramdisk
Or this one:
Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

It means that there’s an issue with the Linux initial RAM disk(initrd) in that particular kernel you’re trying to boot to. This might happen because of a recent upgrade, or other reasons. Let’s fix it.

While restarting, on the grub menu, select “Advanced options for Ubuntu“. After you select that, you will be able to see all the kernels installed in your system. Try with a different one until you’re able to boot.

Now that you’re in a working system, we’re going to change some configurations for initrd:

sudo nano /etc/initramfs-tools/initramfs.conf

Change the following setting:

MODULES=dep
COMPRESS=xz

Save the file(CTRL+O) and close the editor(CTRL+X).

Now you need to know which version of the kernel is the one having issues. You can list all the installed kernels with this command:

dpkg --list | grep linux-image

The name should be something like this: “5.15.0-58-generic”. Now update the initrd for that kernel(remember to change it to whatever your system has, the one that doesn’t work):

sudo update-initramfs -u -k 5.15.0-58-generic

You can also try different compression algorithms and check the current size of the image with this:

ls -ltrh /boot/initrd.img* 

Now simply update grub:

sudo update-grub

Restart and you should be able to boot into the system without issues.

Enjoyed the article?

Posted in Ubuntu.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.