Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fsck capability #32

Closed
libcg opened this issue Feb 18, 2021 · 8 comments
Closed

Add fsck capability #32

libcg opened this issue Feb 18, 2021 · 8 comments

Comments

@libcg
Copy link

libcg commented Feb 18, 2021

See https://wiki.archlinux.org/index.php/Fsck#Mechanism

@codicodi
Copy link
Contributor

While compiling fsck into booster's init probably won't be easy, the 2nd, systemd based method listed in wiki appears to work just fine, as long as you pass ro kernel param

@anatol
Copy link
Owner

anatol commented Feb 28, 2021

Implementing fsck in go is definitely overkill.

I think that fsck functionality should follow configuration similar to how the emergency shell is enabled. If user adds fsck.<fs> to the image (using extra_files config option) and root filesystem type matches the <fs> part then fsck.<fs> /dev/... is called before mounting it.

This feature implementation is straight-forward and should not take much time. Though I work on a few long-overdue code refactoring to make unit-testing easier. Once it is done I'll look at the fsck feature.

@codicodi
Copy link
Contributor

Sounds good!
By the way, is there a reason not to mount read-only by default? That would make systemd's fsck work out of the box.

@anatol
Copy link
Owner

anatol commented Feb 28, 2021

The only reason why booster mounts the root partition as RW by default is thats what mount() does if mountflags parameter is 0. See https://man.archlinux.org/man/mount.2

If you want to mount it as read-only then pass ro with the kernel params.

@codicodi
Copy link
Contributor

codicodi commented Feb 28, 2021

Yeah, I know how this works :)
I was just wondering whether changing the default in booster would make user experience even better.

@anatol anatol closed this as completed in 3db1bfd Mar 2, 2021
@anatol
Copy link
Owner

anatol commented Mar 2, 2021

Alright, fsck functionality is implemented now. Add fsck,fsck.$YOURFS to extra_files config option, regenerate the image and it should work.

This functionality is lightly tested. If you see any issues with it please let me know.

anatol added a commit that referenced this issue Mar 2, 2021
If 'fsck' and 'fsck.<fs>' binaries are added to the image then booster
actvates boot-time filesystem check. The check runs in non-interactive
mode. It tries to fix any filesystem errors automatically. If it fails
then boot stops.

Closes #32
@meelten
Copy link

meelten commented Apr 20, 2023

Alright, fsck functionality is implemented now. Add fsck,fsck.$YOURFS to extra_files config option, regenerate the image and it should work.

This functionality is lightly tested. If you see any issues with it please let me know.

Does booster check ONLY root filesystem or all matching? I mean for example with ext4 root and FAT32 /boot should fsck,fsck.ext4,fsck.vfat be added or for ext4 only?

@anatol
Copy link
Owner

anatol commented Apr 22, 2023

Booster does check root partition only. In your case you need fsck,fsck.ext4 only.

/boot partition is used before initramf enters the game. In fact, this is the partition where the kernel and booster image reside. When booster is loaded it is too late to check /boot.

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

No branches or pull requests

4 participants