How To Fix Busybox Initramfs Error On Ubuntu
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 VPS. Today I turned it on and the boot process dropped to the BusyBox shell and I ended up at the
initramfs prompt. You can check your VPS through VNC error displayed as below.
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/vda1 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
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
1. 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/vda1 -y
/dev/vda1 with your partition name. In your system, it could be
/dev/sdc1 etc. You can use
cat /proc/partitions or
blkid commands to get your Linux partition details in Busybox.
2. Now the
fsck command 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), ........
3. Next, type
reboot and hit
ENTER to restart your system!
reboot command doesn’t work, type
exit and hit
ENTER. Or you can go to control panel to restart your VPS
Cross your fingers and wait for the system to reboot! If all went well, your system will boot normally without any problem.
These steps helped me and many others to solve Busybox Initramfs error on Ubuntu Linux operating system. If you are stuck in initramfs prompt, this guide will definitely help.