This brief guide explains how to fix Busybox Initramfs error on Ubuntu Linux. I use Ubuntu 20.04 LTS as my daily driver on my Dell Inspiron laptop. Today I turned it on and the boot process dropped to the BusyBox shell and I ended up at the initramfs prompt. As far as I can remember, I didn't do anything wrong. I didn't forcibly power off it. It was working just fine yesterday! When I switched it on today, I landed in the BusyBox shell:
BusyBox v1.30.1 (Ubuntu 1:1.30.1-4ubuntu6.1) built-in shell (ash) Enter 'help' for a list of built-in commands. (initramfs)
I can't get past this screen. Also it doesn't show what exactly the problem is. All I see is just a blank busybox shell.
I wasn't sure what to do at this point. So I simply passed the "exit" command to see what happens.
And then I saw the actual error:
(initramfs) exit /dev/sda1 contains a file system with errors, check forced. Inode 4326476 extent tree (at level 1) could be narrower, IGNORED. /dev/sda1: Inode 4326843 extent tree (at level 1) could be narrower, IGNORED. /dev/sda1: Inode 4327012 extent tree (at level 1) could be narrower, IGNORED. /dev/sda1: Inode 4329004 extent tree (at level 1) could be narrower, IGNORED. /dev/sda1: Inodes that were part of a corrupted orphan linked list found. /dev/sda1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. (i.e., without -a or -p options) fsck exited with status code 4. The root filesystem on /dev/sda1 requires a manual fsck. BusyBox v1.30.1 (Ubuntu 1:1.30.1-4ubuntu6.1) built-in shell (ash) Enter 'help' for a list of built-in commands. (initramfs)
As you can see in the above output, the /dev/sda1 partition is corrupted. The file system in this partition has some errors. If you ever encountered with this type of problem, you need to check and repair the problematic Linux filesystems with fsck command.
Please note that sometimes you don't see any errors after typing the exit command. In that case, try to run fsck on all filesystems.
For those wondering, BusyBox is software suite that provides many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc.
Initramfs is an initial ram file system based on tmpfs. It contains the tools and scripts required to mount the file systems before the init binary on the real root file system is called.
Fix Busybox Initramfs Error On Ubuntu Linux
To solve initramfs error on Ubuntu Linux, you need to repair the filesystem in the corrupted partition using "fsck" command like below:
(initramfs) fsck /dev/sda1 -y
Replace /dev/sda1 with your partition name. In your system, it could be /dev/sdb1, /dev/sdc1 etc.
Now it will start to fix all bad blocks automatically in the filesystem.
After a couple minutes, you will see an output like below:
/dev/sda1: ***** FILE SYSTEM WAS MODIFIED ***** /dev/sda1: 497733/30531584 files (1.5% non-contiguous), ........
Now, type "reboot" and hit ENTER to restart your system!
If the reboot command doesn't work, type exit and hit ENTER.
Cross your fingers and wait for the system to reboot! If all went well, your system will boot normally without any problem.