This repository was archived by the owner on Sep 18, 2020. It is now read-only.
Repository navigation
setup-root: fix ordering with /sysroot/usr mount - #86
Merged
Merged
Conversation
Contributor
Author
|
For reference, here is the diff sans-whitespace: diff --git a/dracut/99setup-root/initrd-setup-root b/dracut/99setup-root/initrd-setup-root
index 9af496c..2499b46 100755
--- a/dracut/99setup-root/initrd-setup-root
+++ b/dracut/99setup-root/initrd-setup-root
@@ -6,7 +6,6 @@
COREOS_BLANK_MACHINE_ID="42000000000000000000000000000042"
MACHINE_ID_FILE="/sysroot/etc/machine-id"
-do_setup_root() {
# Initialize base filesystem
systemd-tmpfiles --root=/sysroot --create \
baselayout.conf baselayout-etc.conf baselayout-usr.conf \
@@ -28,12 +27,6 @@ do_setup_root() {
if grep -qs "${COREOS_BLANK_MACHINE_ID}" "${MACHINE_ID_FILE}"; then
rm "${MACHINE_ID_FILE}"
fi
-}
-
-# Skip if root and root/usr are not mount points
-if mountpoint --quiet /sysroot && mountpoint --quiet /sysroot/usr; then
- do_setup_root
-fi
# PXE initrds may provide OEM
if [ -d /usr/share/oem ] && mountpoint --quiet /sysroot/usr/share/oem; then
diff --git a/dracut/99setup-root/initrd-setup-root.service b/dracut/99setup-root/initrd-setup-root.service
index f996716..d6fbf19 100644
--- a/dracut/99setup-root/initrd-setup-root.service
+++ b/dracut/99setup-root/initrd-setup-root.service
@@ -2,7 +2,7 @@
Description=Root filesystem setup
DefaultDependencies=no
-After=initrd-root-fs.target
+After=initrd-root-fs.target initrd-fs.target
Before=initrd-parse-etc.service
[Service] |
First off, the script had a little bit of forgotten logic is left over the read-only root and kexec days when things were much weirder and allowing the setup to noop if /sysroot/usr wasn't mounted. This was harmless until systemd 229 which includes the following change: systemd/systemd@104bc12 So the fix is two fold: remove that bogus bit of logic so the setup script explodes appropriately when /sysroot or /sysroot/usr isn't mounted. Additionally fix the actual bug by ordering after all of the possible paths under /sysroot that may be mounted.
Contributor
Author
|
initrd-fs.target caused a dependency loop, using RequiresMountsFor=/sysroot/usr/share/oem instead to just depend on the mounts themselves, not other setup stuff like initd-parse-etc and ignition-files. |
Contributor
Author
|
New diff for reference: diff --git a/dracut/99setup-root/initrd-setup-root b/dracut/99setup-root/initrd-setup-root
index 9af496c..2499b46 100755
--- a/dracut/99setup-root/initrd-setup-root
+++ b/dracut/99setup-root/initrd-setup-root
@@ -6,7 +6,6 @@
COREOS_BLANK_MACHINE_ID="42000000000000000000000000000042"
MACHINE_ID_FILE="/sysroot/etc/machine-id"
-do_setup_root() {
# Initialize base filesystem
systemd-tmpfiles --root=/sysroot --create \
baselayout.conf baselayout-etc.conf baselayout-usr.conf \
@@ -28,12 +27,6 @@ do_setup_root() {
if grep -qs "${COREOS_BLANK_MACHINE_ID}" "${MACHINE_ID_FILE}"; then
rm "${MACHINE_ID_FILE}"
fi
-}
-
-# Skip if root and root/usr are not mount points
-if mountpoint --quiet /sysroot && mountpoint --quiet /sysroot/usr; then
- do_setup_root
-fi
# PXE initrds may provide OEM
if [ -d /usr/share/oem ] && mountpoint --quiet /sysroot/usr/share/oem; then
diff --git a/dracut/99setup-root/initrd-setup-root.service b/dracut/99setup-root/initrd-setup-root.service
index f996716..8e28b91 100644
--- a/dracut/99setup-root/initrd-setup-root.service
+++ b/dracut/99setup-root/initrd-setup-root.service
@@ -1,7 +1,7 @@
[Unit]
Description=Root filesystem setup
DefaultDependencies=no
-
+RequiresMountsFor=/sysroot/usr/share/oem
After=initrd-root-fs.target
Before=initrd-parse-etc.service
|
This was referenced Apr 7, 2016
Contributor
|
lgtm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First off, the script had a little bit of forgotten logic is left over
the read-only root and kexec days when things were much weirder and
allowing the setup to noop if /sysroot/usr wasn't mounted. This was
harmless until systemd 229 which includes the following change:
systemd/systemd@104bc12
So the fix is two fold: remove that bogus bit of logic so the setup
script explodes appropriately when /sysroot or /sysroot/usr isn't
mounted. Additionally fix the actual bug by ordering after
initrd-fs.target in addition to initrd-root-fs.target