2

I'm using a RPi3 with Raspbian Stretch and I have problems with corrupt file system. I use the Raspberry in a system where a "clean shutdown" is not possible. So I want to run fsck on boot. I have added the following in the /boot/cmdline.txt (I'm surprised that the file is empty after new Raspbian installation, so only the following parameters are added)

fsck.mode=force fsck.repair=yes

But when I restart the following error appears:

kernel panic-not syncing: VFS: unable to mount root fs on  unknown block(0,0)

How can I solve this problem? Or is there another way to automatically repair the file system when booting?

I used the Raspberry Pi 2 for a long time. Here I never had a problem with a corrupt file system. Is that a specialty of the Raspberry Pi 3?

3
  • 1
    "I use the Raspberry in a system where a "clean shutdown" is not possible." sounds like a bad idea
    – Fabian
    Commented Apr 18, 2018 at 12:34
  • maybe useful: raspberrypi.stackexchange.com/a/1403/78211
    – Fabian
    Commented Apr 18, 2018 at 12:44
  • Note that the default fsck.repair=yes and implicit fsck.mode=auto would do what you want; see man systemd-fsck; when "the filesystem checker deems necessary" includes when it has not been cleanly unmounted. WRT problems with a corrupt filesystem, they don't necessarily happen, but they may happen anytime you don't shutdown cleanly.
    – goldilocks
    Commented Apr 18, 2018 at 13:35

1 Answer 1

4

Raspbian is a derivate of Debian and this isn't designed to work without a clean shutdown by default. May work with journaling on the root partition with ext4 file system but it is only designed for disaster recovery one time. The boot partition has a simple vfat file system and do not have disaster recovery so it may be easy corrupted. Using it for years is your risk. We cannot help you to harden Raspbian for unclean shutdown. It isn't for this.

In a Raspbian image, e.g. Raspbian Stretch Lite 2018-03-13 the cmdline.txt has this contents:

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=a8fe70f4-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh

Don't know why yours is empty. Maybe it is corrupted by unclean shutdown?

4
  • Beware that PARTUUID may or may not work, but this is likely the problem (there is no root partition specified). Although: Just noticed I have a Pi 3 with no cmdline.txt that boots fine :\ If the above doesn't work, root=/dev/mmcblk0p2 should.
    – goldilocks
    Commented Apr 18, 2018 at 13:25
  • @goldilocks I agree with you on problems using PARTUUID. The cmdline.txt in my answer isn't a direct suggestion. It only shall show what's in the official image and that it isn't empty.
    – Ingo
    Commented Apr 18, 2018 at 18:13
  • Thank you for your answers! I can't tell you why my file is empty. I looked in the backup image I created after installation. Here the file is also empty. I changed the contents of the file as described above by Ingo and goldilocks. Now everything works! Thank you again!
    – Raspi User
    Commented Jun 11, 2018 at 9:16
  • I'm glad to help you. Is my answer acceptable?
    – Ingo
    Commented Jun 11, 2018 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.