How to solve error "Structure needs cleaning on root file system"?
I am using a ubuntu virtual host to host some websites. Sadly, I had some troubles and had to hard-reboot the server and now it seems like the file system is corrupted. Although, I am able to boot and use it, it is not possible to update the system:
root@myserver:~# apt update
Hit:1 http://mirror.scaleway.com/ubuntu zesty InRelease
Hit:2 http://mirror.scaleway.com/ubuntu zesty-updates InRelease
Hit:3 http://mirror.scaleway.com/ubuntu zesty-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu zesty InRelease
Get:5 http://archive.ubuntu.com/ubuntu zesty-updates InRelease [89.2 kB]
Hit:6 http://ppa.launchpad.net/olipo186/git-auto-deploy/ubuntu zesty InRelease
Hit:7 http://mirror.klaus-uwe.me/mariadb/repo/10.2/ubuntu zesty InRelease
Get:8 http://archive.ubuntu.com/ubuntu zesty-security InRelease [89.2 kB]
Fetched 178 kB in 2s (71.9 kB/s)
Reading package lists... Error!
E: flAbsPath on /var/lib/dpkg/status failed - realpath (117: Structure needs cleaning)
E: Could not open file - open (2: No such file or directory)
E: Problem opening
E: The package lists or status file could not be parsed or opened.
I found some solutions on the web (e.g., (fsck.ext4 /dev/nbd0
), but all require to unmount the drive first. But what to do if the root filesystem is affected?
Is it possible to repair a mounted volume using fsck.ext4?
EDIT:
I tried to force a check on reboot by creating a forcefsck
file in the root file system. It successfully triggered a check, but I still get the same error when I want to update the system. Are there any other options to repair the system?
Solution 1:
sudo touch /forcefsck
and a reboot will force a check on /
.