12

When I tried to run fsck on Ubuntu 18.04 recovery-mode I got the following message. Can anyone tell me why?

/lib/recocery-mode/recovery-menu: line 80: /etc/default/rcS: No such file or directory
fsck from util-linux 2.31.1
/dev/sda4 is mounted
e2fsck: Cannot continue, aborting.
shgnInc
  • 4,003

2 Answers2

4

You don't say what command you're using, so do it this way...

To check the file system on your Ubuntu partition...

  • boot to the GRUB menu
  • choose Advanced Options
  • choose Recovery mode
  • choose Root access
  • at the # prompt, type sudo fsck -f /
  • repeat the fsck command if there were errors
  • type reboot

If for some reason you can't do the above...

  • boot to a Ubuntu Live DVD/USB
  • start gparted and determine which /dev/sdaX is your Ubuntu EXT4 partition
  • quit gparted
  • open a terminal window
  • type sudo fsck -f /dev/sda4 # replacing 4 with the number you found earlier
  • repeat the fsck command if there were errors
  • type reboot
heynnema
  • 70,711
  • Pretty sure they're not running a command directly, they're running the fsck menu item in the Ubuntu recovery mode menu. – nog642 Dec 06 '20 at 06:39
  • 2
    If you have no usb stick... in grub, go to Advanced, then hit "e" to edit. Change the line starting "linux " and add " init=/bin/bash". Remove the lines starting "gfxmode " and "load_video" At the bash prompt, use df -h / to get the device path, then do, e.g. "fsck /dev/mapper/vg0-root" There is no systemd, so use alt+sysreq S U B to sync, unmount and reBoot since "reboot", "poweroff", etc won't work. I've put this here as https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1938013 'll prob corrupt a lot of file systems. https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1807537 => no fsck – Russell Jones Aug 05 '21 at 14:23
3

The error is telling you that you cannot use e2fsck while the target file system is mounted. You must unmount the file system first using umount /dev/sda4. If you're currently booted into a system that has that volume mounted it's likely that you cannot unmount it. You should probably use a USB stick and run e2fsck from that.