Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 666657 - sys-fs/f2fs-tools: fsck.f2fs does never run for root mount
Summary: sys-fs/f2fs-tools: fsck.f2fs does never run for root mount
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 681618 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-09-20 18:56 UTC by hagbardcelin
Modified: 2023-02-04 10:19 UTC (History)
7 users (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 Arisu Tachibana 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 Arisu Tachibana 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 Arisu Tachibana 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.
Comment 12 Thomas Deutschmann (RETIRED) gentoo-dev 2021-03-15 21:46:33 UTC
Not a genkernel issue, assigning to sys-fs/f2fs-tools maintainers.

Maybe you will also need to contact openrc maintainers in case fsck service needs special handling ofr f2fs.
Comment 13 Anthony Basile gentoo-dev 2022-07-22 13:39:38 UTC
*** Bug 681618 has been marked as a duplicate of this bug. ***
Comment 14 Anthony Basile gentoo-dev 2022-07-22 13:40:12 UTC
I was never in a situation where I could test this.  Can anyone let me know what's going on with 1.15.0.  The package is being stabilized now and it does work in situations where it was not invoked by rc, so if upstream is not willing to do more on this, my position is we document this limitation.
Comment 15 Viorel Munteanu gentoo-dev 2023-02-04 10:19:26 UTC
I added forcefsck to kernel command line and it ran fsck for both my f2fs systems, including root mounted read-only.  As far as I can tell, this bug is fixed.

sys-apps/openrc-0.45.2-r2
sys-fs/f2fs-tools-1.15.0-r2
kernel 5.18.12