Skip to content

Try to execute FS check program from internal overlay#12

Draft
msvamp wants to merge 1 commit into
openwrt:masterfrom
msvamp:fsck-from-overlay
Draft

Try to execute FS check program from internal overlay#12
msvamp wants to merge 1 commit into
openwrt:masterfrom
msvamp:fsck-from-overlay

Conversation

@msvamp

@msvamp msvamp commented May 29, 2025

Copy link
Copy Markdown

Currently, on most default OpenWrt builds, if anyone follows the documentation at https://openwrt.org/docs/guide-user/additional-software/extroot_configuration and installs the filesystem packages on the internal overlay, then their extroot filesystem is never checked at boot:

block: check_filesystem: /usr/sbin/e2fsck not found

This is because the current logic tries to find the fsck program in / but during boot, the internal overlay is mounted at /tmp/overlay. So with this change, I try to first find the fsck program inside /tmp/overlay and execute it from there (by appending /usr/lib to LD_LIBRARY_PATH as it might be needed by the fsck program), else fallback to finding it on / (the current behaviour)

When extroot is mounted using config in internal overlay, it is very
likely that the fsck program is also installed on the same filesystem.
So we will try to execute it from the overlay if it is present, else
fallback to previous behaviour of finding it on rootfs mounted on /.

Signed-off-by: Manas Sambhus <manas.sambhus+github@gmail.com>
Comment thread block.c
const char *fatfsck = "/usr/sbin/fsck.fat";
const char *btrfsck = "/usr/bin/btrfsck";
const char *ntfsck = "/usr/bin/ntfsfix";
const char *ckfs;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why rename this variable?
Other than that it looks all reasonable to me.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for reviewing!
I haven't exactly renamed the variable, ckfs still contains the path to the final fsck program, I just changed its type to char[64].

I would have to either change the variable here in lines L777-785 or use a different variable on L791-818, I chose the former approach.

@msvamp

msvamp commented Jun 2, 2026

Copy link
Copy Markdown
Author

Sorry about leaving this PR in draft status, I didn't get a chance to actually build and test my changes and forgot about it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants