5

Upon rebooting using shutdown -rF now of my Raspberry Pi 3, I am presented with emergency mode, however, I am unable to run fsck -fy on the root partition.

I am presented with the following error:

[FAILED] Failed to start File System Check on Root Device.

Thus, I try to run fsck -fy after logging into maintenance mode, I get the following error:

...snip...
/dev/mmcblk0p2 is mounted.
e2fsck: Cannot continue, aborting.

So, I attempt to unmount the partition using umount -f /dev/mmcblk0p2, but I get the following error:

umount: /: target is busy

How do I fix this?

Nicholas Adamou
  • 591
  • 3
  • 6
  • 15
  • 1
    Try mount -o remount,ro /dev/mmcblk0p2 then the fsck again. This should remount it read-only which might allow for a forced fsck (not sure). You cannot completely unmount the root fs on a running system. – goldilocks Mar 29 '17 at 20:00
  • @goldilocks I get back this following msg: mount: / is busy. – Nicholas Adamou Mar 29 '17 at 20:02
  • @goldilocks Still no reason why my system booted into emergency mode and if it does it usually boots with the rootfs as read-only. – Nicholas Adamou Mar 29 '17 at 20:03

2 Answers2

11

I was able to fix the issue using these steps:

  1. Modify: /etc/fstab

    #/dev/mmcblk0p2  / ext4 errors=remount-ro 0 1
    /dev/mmcblk0p2  /  ext4 ro 0 1
    

    This should mount the rootfs as read-only on the next reboot.

  2. Reboot system using: shutdown -rF now
  3. Run fsck -fy if the system hasn't already
  4. Remount the rootfs as read-write using:

    mount -o remount,rw /dev/mmcblk0p2
    

    We need to do this in-order to complete step 4.

  5. (IMPORTANT) Change /etc/fstab back to normal, thus:

    /dev/mmcblk0p2  / ext4 errors=remount-ro 0 1
    #/dev/mmcblk0p2  /  ext4 ro 0 1
    

    If /etc/fstab doesn't get changed back to normal, then the system will always mount the rootfs as read-only.

  6. Profit.
Nicholas Adamou
  • 591
  • 3
  • 6
  • 15
0

Additionally, you can fix the problem if you own a copy of Linux File System for Windows, by using the following steps:

  1. Insert Micro-SD card into a Micro-SD card reader and insert it into your PC.

  2. Open Linux File System for Windows and umount the SD card.

  3. Select the volume and click verify. This will run fsck -fy on the volume and fix any errors present.

  4. Eject Micro-SD card safely and insert it into the Raspberry Pi.

  5. Profit.

Nicholas Adamou
  • 591
  • 3
  • 6
  • 15