Skip to content

Commit c258e96

Browse files
authored
Merge pull request #288 from desultory/dev
don't use rootdelay for mount timeout, add ugrd_mount_timeout
2 parents dd478fc + 0be4c06 commit c258e96

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ This module handles CPIO creation.
283283

284284
These are set at the global level and are not associated with an individual mount:
285285

286-
* `mount_timeout` (1.0) - Timeout in seconds for mount retries, can be set with `rootdelay` in the kernel command line.
286+
* `mount_timeout` (1.0) - Timeout in seconds for mount retries, can be set with in the kernel command line with `ugrd_mount_timeout`.
287287
* `mount_retries` - Number of times to retry running `mount -a`, no limit if unset.
288288

289289
#### ugrd.fs.btrfs

src/ugrd/fs/mounts.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "7.1.0"
2+
__version__ = "7.1.1"
33

44
from pathlib import Path
55
from re import search
@@ -861,26 +861,25 @@ def mount_late(self) -> list[str]:
861861

862862
def mount_fstab(self) -> list[str]:
863863
"""Generates the init function for mounting the fstab.
864-
Keeps re-attempting with mount_timeout or rootdelay until successful.
864+
Keeps re-attempting with mount_timeout until successful.
865865
mount_retries sets the number of times to retry the mount, infinite otherwise.
866866
"""
867867
if not self._get_build_path("/etc/fstab").exists():
868868
return self.logger.warning("No initramfs fstab found, skipping mount_fstab.")
869869

870870
out = [
871871
'einfo "Attempting to mount all filesystems."',
872-
f"timeout=$(readvar rootdelay {self.get('mount_timeout', 1)})",
873872
]
874873

875874
if retries := self.get("mount_retries"):
876875
out += [
877-
f'retry {retries} "$timeout" mount -a || rd_fail "Failed to mount all filesystems."',
876+
f'retry {retries} "$(readvar ugrd_mount_timeout)" mount -a || rd_fail "Failed to mount all filesystems."',
878877
]
879878
else:
880879
out += [
881-
"while ! mount -a; do", # Actually retry forever, retry with a short timeout may fail
882-
' if prompt_user "Press space to break, waiting: ${timeout}s" "$timeout"; then',
883-
' rd_fail "Failed to mount all filesystems."',
880+
"while ! mount -a; do", # Retry forever, retry with a very short timeout may fail
881+
' if prompt_user "Press space to break, waiting: $(readvar ugrd_mount_timeout)s" "$(readvar ugrd_mount_timeout)"; then',
882+
' rd_fail "Failed to mount all filesystems. Process interrupted by user."',
884883
" fi",
885884
' eerror "Failed to mount all filesystems, retrying."',
886885
"done",
@@ -950,7 +949,7 @@ def check_mounts(self) -> None:
950949

951950
def mount_default_root(self) -> str:
952951
"""Mounts the root partition to $MOUNTS_ROOT_TARGET."""
953-
return f"""
952+
return """
954953
mount_source=$(readvar MOUNTS_ROOT_SOURCE)
955954
mount_type=$(readvar MOUNTS_ROOT_TYPE auto)
956955
mount_options="$(readvar MOUNTS_ROOT_OPTIONS 'defaults,ro')$(readvar root_extra_options)"
@@ -962,7 +961,7 @@ def mount_default_root(self) -> str:
962961
einfo "[/] Mounting '$mount_source' ($mount_type) to '$mount_target' with options: $mount_options"
963962
while ! mount "$mount_source" -t "$mount_type" -o "$mount_options" "$mount_target"; do
964963
eerror "Failed to mount root partition."
965-
if prompt_user "Press space to break, waiting: {self["mount_timeout"]}s" {self["mount_timeout"]}; then
964+
if prompt_user "Press space to break, waiting: $(readvar ugrd_mount_timeout)s" "$(readvar ugrd_mount_timeout)"; then
966965
rd_fail "Failed to mount root partition."
967966
fi
968967
done
@@ -996,6 +995,7 @@ def export_mount_info(self) -> None:
996995
self["exports"]["MOUNTS_ROOT_TYPE"] = self["mounts"]["root"].get("type", "auto")
997996
self["exports"]["MOUNTS_ROOT_OPTIONS"] = ",".join(self["mounts"]["root"]["options"])
998997
self["exports"]["MOUNTS_ROOT_TARGET"] = self["mounts"]["root"]["destination"]
998+
self["exports"]["ugrd_mount_timeout"] = self.get("mount_timeout", 1)
999999

10001000

10011001
def autodetect_zfs_device_kmods(self, poolname) -> list[str]:

src/ugrd/fs/mounts.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ binaries = [ "lsblk", "blkid", "mount", "umount", "mkdir" ]
22

33
provides = "mounts"
44

5-
cmdline_strings = ["root", "roottype", "rootflags", "rootdelay" ]
5+
cmdline_strings = ["root", "roottype", "rootflags", "ugrd_mount_timeout" ]
66
cmdline_bools = ["ugrd_no_fsck"]
77

88
run_dirs = [ "ugrd" ]

0 commit comments

Comments
 (0)