I'm trying to run e2fsck on boot of a persistent live lubuntu to fix 'corrupt filesystem' error of a writable system partition (ext4) and I want to automate this somehow (so ideally I do not want to boot into another live usb to do it)
I want to automate because these errors have a tendency to accumulate with restarts/shutdowns of the system (I do follow instructions and remove the USB stick on which the system is and then press Enter on shutdown/restart). After several months of use (maybe 100 shutdowns) the errors did accumulate so much, that the system became unable to boot.
I did fix the errors by booting another live system and then running:
umount -l /dev/sdc5
e2fsck -y /dev/sdc5
the /dev/sdc5 being the writable partition of the system mounted at /media/lubuntu/writable
In order to automate this for the future I've tried fixing the error from the same storage medium by:
- booting into the Recovery mode, yet
e2fsckreturned 'Target is busy', so the lazy unmount wasn't succesful. - hitting
ein the GRUB menu and editingfsck.mode=nonetofsck.mode=forceand then booting (Ctrl+x/f10) but it did not fix the errors. - forcing
fsckon boot by changing the maximum number of mounts bysudo tune2fs -c -1 /dev/sdb5but it did not fix the errors
I'm not sure if in the last two cases the fsck did run and I don't know how to find out, I've tried to read the contents of several logs in /var/log but did not find a mention about it
my live system was made using mkusb and lubuntu 22.04.3 iso any help welcome