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

Prevent the OEM mount point from showing up before Ignition mounts #58

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dracut/10diskless-generator/diskless-generator
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ if [[ "${copy_oem}" -eq 1 ]]; then
# Automatically generated by diskless-generator

[Unit]
# This runs early for initrd-setup-root to populate it.
# Ignition can mount something else on /usr/share/oem still
# if the user wants so.
Before=initrd-root-fs.target

[Mount]
Expand Down
5 changes: 5 additions & 0 deletions dracut/30ignition/ignition-files.service
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ After=ignition-setup.service ignition-disks.service
# setup the root filesystem before we try do things like create users on it.
Requires=initrd-setup-root.service
After=initrd-setup-root.service
# Already mount the OEM partition here so that it works to write files
# without having to declare it as initrd mount in Ignition
RequiresMountsFor=/sysroot/usr/ /sysroot/usr/share/oem/

OnFailure=emergency.target
OnFailureJobMode=isolate
Expand All @@ -27,4 +30,6 @@ Before=initrd-parse-etc.service
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/run/ignition.env
# Flatcar: Make sure that the OEM mount point is there even if it shortly was away
ExecStartPre=-systemctl start sysroot-usr-share-oem.mount
pothos marked this conversation as resolved.
Show resolved Hide resolved
ExecStart=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=files --log-to-stdout
2 changes: 2 additions & 0 deletions dracut/30ignition/ignition-mount.service
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ After=ignition-setup.service
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/run/ignition.env
# Flatcar: Unmount any OEM mount in case the Ignition config has one defined
ExecStartPre=/bin/bash -c 'if ! mount | grep -m 1 /sysroot/usr/share/oem | grep tmpfs; then umount /sysroot/usr/share/oem || true; fi'
ExecStart=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=mount --log-to-stdout
ExecStop=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=umount --log-to-stdout