jaegeuk / f2fs-tools

Other
41 stars 32 forks source link

fsck.f2fs not cooperating with systemd-fsck-root #7

Open nolange opened 4 years ago

nolange commented 4 years ago

Hello,

I have the problem that a f2fs filesystem together with systemd (and an installed fsck.f2fs) will endlessly reboot. (https://github.com/systemd/systemd/issues/15106)

The fsck.f2fs tool behaves different to the ext variants, and does not seem to support the -a switch, and fails on a mounted device (by default). ie. it would not help calling fsck from the initramfs either. fsck tools seem wildy different, but systemd assumes some basic uniformity

systemd version the issue has been seen with

systemd 245 (245) -PAM -AUDIT -SELINUX -IMA -APPARMOR -SMACK -SYSVINIT -UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL -XZ +LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 -IDN -PCRE2 default-hierarchy=unified

fsck.f2fs 1.13.0 (2019-09-24)

the root filesystem is f2fs, mounted read-only from the initrd. Systemd will endlessly reboot the system as the fsck attempt fails.

The systemd-fsck tool will end up calling fsck.f2fs with the parameter below, and will fail as this device is mounted (tries to open it in exclusive mode).

$ fsck.f2fs -a /dev/mmcblk0p5; echo $?  
Info: Fix the reported corruption.
Info: Mounted device!
Info: Check FS only on RO mounted device
    Error: Failed to open the device!
255

A workaround would be to force or skip the check

fsck.f2fs -a -f /dev/mmcblk0p5; echo $?   
Info: Fix the reported corruption.
.....
Done: 0.232165 secs
0
sveyret commented 4 years ago

Same problem here (with OpenRC on a Raspberry Pi). I had to disable root partition check in /etc/fstab in order to get my RPi to boot completely.