Out Of Memory Error during Loading initrd

3 minute read


kernel panic


The initrd (initramdisk) is too large to fit into memory during early boot. Reducing the size helps.

Use sudo make INSTALL_MOD_STRIP=1 to reduce size of kernel modules in order to reduce the size of initrd.

Detailed Version

Problem: Fail to boot because of OOM error.

Error message:

Loading Linux 4.19.237
Loading initial ramdisk
error: out of memory
Press any key to continue

Solution: Reduce the size of initrd

That’s because the initrd is too huge for early boot. It is directly affected by the size of total kernel modules. So reducing the size of kernel modules would help reducing the size of initrd. One way to do that is by stripping the unnecessary symbols of kernel modules.

initrd size before

sudo make INSTALL_MOD_STRIP=1 modules_install
sudo make install

It worked.

initrd size after