Fix BusyBox INTRAMFS error “/dev/sdbX contains files system with errors, check forced” & “UNEXPECTED INCONSISTENCY” in Linux

Fix BusyBox INTRAMFS error “/dev/sdbX contains files system with errors, check forced” & “UNEXPECTED INCONSISTENCY” in Linux

intramfs-fsck-thetqweb

[[ Possible causes of the INTRAMFS error ]]

You probably ran into the `intramfs` Linux error either:

~ after a Linux update,
~ grub configuration changes, or
~ literally after doing nothing except powering your distro OFF, then ON.

NOTE:// The INTRAMFS error doesn’t mean that other files on your secondary storage are affected. In case you wanna be extra careful you can use a LIVE USB to backup your file before proceeding with this procedure.

Before landing in this error, I had made GRUB configuration changes on KALI LINUX distribution and forgot to update GRUB via either of the following commands:

update-grub
update-grub2

 

[[ INTRAMFS errors ]]

intramfs-error-1-thetqweb

 

The next time I powered the KALI machine off then on, I encountered the INTRAMFS error, not really presented as an error but rather as a TTY Command-Line Interface with the text below, waiting for a command:

 

(intramfs)
BusyBox v1.35.0 (Debian 1:1.35.0-2) built-in shell (ash) 
Enter 'help' for a list of built-in commands.

(initramfs)

Errors are presented after entering certain commands on the `(intramfs)` CLI, for instance, the command;

exit

intramfs-error-2-thetqweb

On running the `exit` command, you are able to see what is in fact the issue preventing your distro from booting. Below are sample errors in text:

[ ERROR 1: ]

/dev/sdb5 contains a file system with errors, check forced.

[ ERROR 2: ]

Inodes that were part of a corrupted orphan linked list found.

[ ERROR 3: ]

/dev/sdb5: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.

[ ERROR 4: ]

fsck exited with the status code 4

[ ERROR 5: ]

Failure: File system check of the root filesystem failed

[ ERROR 6: ]

The root filesystem on /dev/sdb5 requires a manual fsck

[[ SOLUTION ~ `intramfs` error FIX using `fsck` utility ]]

intramfs-error-3-thetqweb

To fix the `intramfs` error(s) we’ll use the FSCK utility used to check and optionally repair Linux file systems. Below is a ‘safe’ FIX:

fsck -M /dev/sdb5

 

Immediately after running the above command, expect multiple prompts asking you to authorize different actions in the process of the fix. To authorize, you can enter “y” or hit the Enter/Return key. If you see a fix that you think can cause file or file system corruption, you can exit. Below are the actions that need your authorization to run:

Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found. Fix<y>?yes
Inodes 4865701 was part of the orphaned inode list. FIXED.
Inodes 4988147 was part of the orphaned inode list. FIXED.
Inodes 5385600 extent tree (at level 2) could be narrower. Optimize<y>? yes
Pass 1E: Optimizing extent trees
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -19514983 -(20068212--20068221)
Fix<y>?yes
Free blocks count wrong for group #428 (20360, counted=20104).
Fix<y>?yes
Free blocks count wrong for group #362 (1802, counted=1546).
Fix<y>?yes
Free blocks count wrong (11579140, counted=11574420).
Fix<y>?yes
Inode bitmap differences: -4865003 -(4865701--4988147)
Fix<y>?yes
Free blocks count wrong (5555411, counted=5554803).
Fix<y>?yes

After a successful command run,you should get a message like:

/dev/sdb5: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdb5: 55649/111232 files (0.2% non-contiguous), 12839276/24413696

 

The `-M` parameter in the command `fsck -M /dev/sdb5`, from the manual pages does not check mounted filesystems and returns an exit status of 0 for mounted filesystems. The reason I prefer the said parameter is that, INTRAMFS at the CLI only has its partitions mounted (try `ls` to view them), and trying to fix them will not fix the unmounted partitions.

Remember that the partition that has errors is the ROOT partition, which is not mounted in INTRAMFS. So we need to exclude these mounted partitions to reach the partition of interest.

 

You may find many ways discussed wherever as fixes to the subject error using `fsck`, but be careful not to rush to copy-paste the commands. Known issues are known to occur when utilizing some of the FSCK’s parameters, and specifically the following usage:

fsck -A /dev/sdb5
fsck -A -P /dev/sdb5
fsck -y /dev/sdb5

The reason I am against the `-y` parameter is that, as much as it can fix the error discussed here, it can make dangerous modifications to disk without your knowledge. Just as a matter of preference, I like to see what is happening (the process) rather than just getting the end result. The `-P` parameter on the other hand can corrupt file systems.

 

[[ REBOOT ]]

After you are done with fixing the INTRAMFS error, you need to reboot your Linux machine. For that, you can run the command:

(intramfs) reboot

If the above command does not work for you, you can try commands listed by tapping the TAB key in INTRAMFS CLI then power on your PC. If that does not work as well, force shutdown by pressing the power button then power on your PC. Whatever method you use to restart your Linux Machine, the error should now be resolved.

 

Fix BusyBox INTRAMFS error “/dev/sdbX contains files system with errors, check forced” & “UNEXPECTED INCONSISTENCY” in Linux
Linux | thetqweb