Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 666657 - fsck.f2fs does never run for root mount
Summary: fsck.f2fs does never run for root mount
Status: UNCONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-20 18:56 UTC by hagbardcelin
Modified: 2019-04-23 16:43 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix from upstream. (f2fs-ro-open-falure-fix.patch,2.07 KB, patch)
2019-04-22 07:03 UTC, hagbardcelin
Details | Diff
Fix for the real problem from f2fs-ml. (fsck.f2fs_fix_to_repair_ro_mounted_device_w_-f.patch,6.48 KB, patch)
2019-04-23 16:43 UTC, hagbardcelin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description hagbardcelin 2018-09-20 18:56:51 UTC
fsck.f2fs can not check a mounted filesystem, even if mounted read-only. Thus fsck will never run for root-mounts that are f2fs, unless it is run in initramfs before root is mounted.

Reproducible: Always

Steps to Reproduce:
1. Install Gentoo on f2fs formatted root partition.
2. Use genkernel to make initramfs.
3. Reboot.
Actual Results:  
fsck fails to run on root-pertition.

Expected Results:  
fsck should run on root partition.
Comment 1 hagbardcelin 2018-10-29 14:36:28 UTC
Update: I was wrong about fsck.f2fs not running on a read-only mounted root-fs. The issue was that I've actually never been able too boot with f2fs root-fs mounted ro, I always got kernel-panic. Now I've discovered that this was because f2fs fails with: "Unrecognized mount option "ro" or missing value". I'll be taking that issue to the f2fs mailing list as soon as my joining has been moderator approved.

Now back to the issue at hand: Sorry for bad bug-report, I should have checked why my kernel refused to boot f2fs ro before reporting. 
But, unless I'm quite mistaken again, there is still an issue here: 
That fsck.f2fs will never fix a f2fs formatted root partition that is mounted ro before fsck.f2fs is run. 
I admit I have not tested this, but fsck.f2fs says this when run against such partition:
"fsck              |Info: Check FS only due to RO "
Comment 2 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2018-11-01 10:14:48 UTC
can you try to bisect the problem?

https://wiki.gentoo.org/wiki/Kernel_git-bisect
Comment 3 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2018-11-01 10:16:04 UTC
please report this to the  f2fs mailing list
https://f2fs.wiki.kernel.org/mail
Comment 4 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2018-11-01 10:17:02 UTC
also write back a link to your report to the f2fs mailing list so that we can track it
Comment 5 hagbardcelin 2018-11-01 11:06:17 UTC
I'm waiting for moderator approval of my joining in the f2fs mailing list. I will report there, but it might be a while as the PSU of my gentoo box died yesterday and it will be a while before I can afford to replace it.
Comment 6 Saul Peebsen 2018-12-03 22:26:17 UTC
I just got bitten by this. Had to edit fstab to disable fsck for root filesystem to make my system bootable again.
Comment 7 Nikolay Kichukov 2018-12-04 09:01:01 UTC
Perhaps related to:
https://bugs.gentoo.org/show_bug.cgi?id=671786
Comment 8 hagbardcelin 2019-04-22 07:03:01 UTC
Created attachment 573764 [details, diff]
Fix from upstream.

I finally got my PC up and running again and reported to f2fs-mailinglist.
I got this patch back; it seems to work when fsck is run with "-f" switch.
Comment 9 hagbardcelin 2019-04-22 07:15:32 UTC
PS. the patch I just posted fixes only half the issue, fsck.f2fs will still not fix a RO-mounted filesystem, as confirmed by one of the developers here:
https://sourceforge.net/p/linux-f2fs/mailman/message/36645996/
Comment 10 hagbardcelin 2019-04-22 10:11:39 UTC
(In reply to hagbardcelin from comment #8)
> Created attachment 573764 [details, diff] [details, diff]
> Fix from upstream.
> 
> I finally got my PC up and running again and reported to f2fs-mailinglist.
> I got this patch back; it seems to work when fsck is run with "-f" switch.

Sorry, this half of the issue proves to be a user error. After re-testing it seems I ran my first tests without -f. fsck.fo2s does actually open RO partitions with -f and without this patch.
Comment 11 hagbardcelin 2019-04-23 16:43:46 UTC
Created attachment 573908 [details, diff]
Fix for the real problem from f2fs-ml.

This lets "fsck.f2fs -f" actuality fix a RO mounted partition, not only check it.