But error 4 usually means could not map replacements to redundant block or remap data in bad block to remap sector. Which is either from bad sectors from platter de-lamination or a head or servo on the hdd malfunctioned.
The exit code returned by e2fsck is the sum of the following
conditions:
0 - No errors
1 - File system errors corrected
2 - File system errors corrected, system should
be rebooted
4 - File system errors left uncorrected
8 - Operational error
16 - Usage or syntax error
32 - E2fsck canceled by user request
128 - Shared library error
You might need to run the fsck command with a f option which forces checking even if the file system seems clean.
When you are at the Repair filesystem line you should confirm that the /dev/sda1 partition is not mounted before running the fsck command with the f (force) option selected.
As the system was unable to repair the errors itself there is a risk that when you run the fsck with force that it might repair the filesystem but you will lose some data.
You should prepare yourself to do a fresh install and restore.
If you had a bad crash of the system or a very uncontrolled shutdown causing the problems then after a fresh install it should be okay.
However those filesystem errors could also be due to a HDD having problems and a fresh install might have the same problems later on. After re-installing you should check the SMART info and look at having a spare HDD available to replace with.
the path is not in the enviromental PATH for fsck to execute badblocks command from e2fsck which should have been in /sbin which should be the default path
because /sbin should be in PATH enviromental when its not set
so if probably can’t find it when you execute:
which badblocks
Does anyone know what path badblocks is installed?
because you have to either execute it from the directory or put ithe directory into PATH envars.
which I don’t know why they just install it into /sbin where you can execute it if there is no PATH envars set.
maybe someone took out default path before compiling.
go and set /sbin in path and try to execute fsck
set PATH=/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/root/bin
A utility CD, such as Dr.Parted-Live, containing GSmartControl, would be able to present a summary of the drive condition, without doing a re-install of IPF. It could also do a full scan of a spinning HDD. OTOH, some brands of SSD are not well supported by SMART.
The badblocks command from e2fsck is installed into /sbin, so in the same directory as e2fsck.
So if e2fsck can’t find the badblocks command then either the file has been removed or it has been corrupted or the permissions/ownerships have been changed.
-rwxr-xr-x 4 root root 340K Feb 20 04:39 /sbin/e2fsck
-rwxr-xr-x 1 root root 35K Feb 20 04:39 /sbin/badblocks
If badblocks is not there anymore then I wouldn’t play around trying to recover things, I would just do a re-install and restore the backup.
My view is that will always be quicker than trying to find out which files have been lost and how to get them recovered and be sure they are correct.
Finally, I followed @rodneyp’s suggestion, which had me remove the disk and mount it on another machine equipped with Parted Magic.
I then performed several actions…
via the terminal:
fsck -c /dev/sda
bad magic number in super-block
e2fsck -b 8193 /dev/sda
e2fsck -b 32768 /dev/sda
None of these commands seemed to have corrected anything.
via Partition Editor > disk > Partition > Check:
Which detected errors in /dev/sda2 in FAT16, but apparently didn’t correct them…
Finally, I reconnected the disk in my firewall, and IPFire restarted normally…
Aware that the current disk is showing signs of deterioration, I’m going to rush to backup IPFire, its various modules, and the add-ons I’ve installed for a future reinstallation and system restore.
Once again, I’ve noticed that the IPFire solution can have its surprises and difficulties (which are normal given the level of complexity), but that the community is truly PRESENT, EFFICIENT, and RESPONSIVE, which I think is essential and reassuring for a project like this…