-
-
Notifications
You must be signed in to change notification settings - Fork 18k
Systemd stage 1 fsck #208269
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
Systemd stage 1 fsck #208269
Changes from all commits
988184c
1b39491
a0ba973
14b7758
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,7 +140,10 @@ let | |
| else if config.fsType == "reiserfs" then "-q" | ||
| else null; | ||
| in { | ||
| options = mkIf config.autoResize [ "x-nixos.autoresize" ]; | ||
| options = mkMerge [ | ||
| (mkIf config.autoResize [ "x-nixos.autoresize" ]) | ||
| (mkIf (utils.fsNeededForBoot config) [ "x-initrd.mount" ]) | ||
| ]; | ||
| formatOptions = mkIf (defaultFormatOptions != null) (mkDefault defaultFormatOptions); | ||
| }; | ||
|
|
||
|
|
@@ -155,27 +158,54 @@ let | |
|
|
||
| makeFstabEntries = | ||
| let | ||
| fsToSkipCheck = [ "none" "bindfs" "btrfs" "zfs" "tmpfs" "nfs" "nfs4" "vboxsf" "glusterfs" "apfs" "9p" "cifs" "prl_fs" "vmhgfs" ]; | ||
| fsToSkipCheck = [ | ||
| "none" | ||
| "auto" | ||
| "overlay" | ||
| "iso9660" | ||
| "bindfs" | ||
| "udf" | ||
| "btrfs" | ||
| "zfs" | ||
| "tmpfs" | ||
| "bcachefs" | ||
| "nfs" | ||
| "nfs4" | ||
| "nilfs2" | ||
| "vboxsf" | ||
| "squashfs" | ||
| "glusterfs" | ||
| "apfs" | ||
| "9p" | ||
| "cifs" | ||
| "prl_fs" | ||
| "vmhgfs" | ||
| ] ++ lib.optionals (!config.boot.initrd.checkJournalingFS) [ | ||
| "ext3" | ||
| "ext4" | ||
| "reiserfs" | ||
| "xfs" | ||
| "jfs" | ||
| "f2fs" | ||
| ]; | ||
| isBindMount = fs: builtins.elem "bind" fs.options; | ||
| skipCheck = fs: fs.noCheck || fs.device == "none" || builtins.elem fs.fsType fsToSkipCheck || isBindMount fs; | ||
| # https://wiki.archlinux.org/index.php/fstab#Filepath_spaces | ||
| escape = string: builtins.replaceStrings [ " " "\t" ] [ "\\040" "\\011" ] string; | ||
| in fstabFileSystems: { rootPrefix ? "", excludeChecks ? false, extraOpts ? (fs: []) }: concatMapStrings (fs: | ||
| in fstabFileSystems: { rootPrefix ? "", extraOpts ? (fs: []) }: concatMapStrings (fs: | ||
| (optionalString (isBindMount fs) (escape rootPrefix)) | ||
| + (if fs.device != null then escape fs.device | ||
| else if fs.label != null then "/dev/disk/by-label/${escape fs.label}" | ||
| else throw "No device specified for mount point ‘${fs.mountPoint}’.") | ||
| + " " + escape (rootPrefix + fs.mountPoint) | ||
| + " " + escape fs.mountPoint | ||
| + " " + fs.fsType | ||
| + " " + escape (builtins.concatStringsSep "," (fs.options ++ (extraOpts fs))) | ||
| + " " + (optionalString (!excludeChecks) | ||
| ("0 " + (if skipCheck fs then "0" else if fs.mountPoint == "/" then "1" else "2"))) | ||
| + " 0 " + (if skipCheck fs then "0" else if fs.mountPoint == "/" then "1" else "2") | ||
| + "\n" | ||
| ) fstabFileSystems; | ||
|
|
||
| initrdFstab = pkgs.writeText "initrd-fstab" (makeFstabEntries (filter utils.fsNeededForBoot fileSystems) { | ||
| rootPrefix = "/sysroot"; | ||
ElvishJerricco marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| excludeChecks = true; | ||
| extraOpts = fs: | ||
| (optional fs.autoResize "x-systemd.growfs") | ||
| ++ (optional fs.autoFormat "x-systemd.makefs"); | ||
|
|
@@ -328,7 +358,9 @@ in | |
| )} | ||
| ''; | ||
|
|
||
| boot.initrd.systemd.contents."/etc/fstab".source = initrdFstab; | ||
| boot.initrd.systemd.storePaths = [initrdFstab]; | ||
| boot.initrd.systemd.managerEnvironment.SYSTEMD_SYSROOT_FSTAB = initrdFstab; | ||
| boot.initrd.systemd.services.initrd-parse-etc.environment.SYSTEMD_SYSROOT_FSTAB = initrdFstab; | ||
|
Comment on lines
+361
to
+363
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ElvishJerricco Could you share the reason for removing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Majiir |
||
|
|
||
| # Provide a target that pulls in all filesystems. | ||
| systemd.targets.fs = | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.