ignition: Mount OEM partition so that Ignition doesn't have to do it#121
Merged
chewi merged 6 commits intoflatcar-masterfrom Apr 15, 2026
Merged
ignition: Mount OEM partition so that Ignition doesn't have to do it#121chewi merged 6 commits intoflatcar-masterfrom
chewi merged 6 commits intoflatcar-masterfrom
Conversation
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
The "isolate" job mode causes dev-mapper-usr.device and therefore sysusr-usr.mount to stop. We cannot stop the latter though because the emergency shell is hosted within it. It's not entirely clear why this happens because both units have IgnoreOnIsolate=yes. Trying to unmount doesn't break the shell, but it does show an unexpected error. The usual approach of preventing the above with drop-in units doesn't seem to work for auto-generated mount units. However, I noticed that systemd itself has not used the isolate job mode for emergency.target since 2013. replace-irreversibly does not proactively stop all the other units, just the ones that would block the new target. This can actually make debugging easier in the event of an Ignition failure because the system will be in a closer state to the one when the failure occurred. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
No need to wait until ignition-setup.service runs. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
config.ign is still used as the default OEM-based configuration file. Stock Flatcar no longer ships base.ign or default.ign, but custom images in the wild may use these, and Ignition still checks for them. Supporting these can be done more easily using symlinks baked into the initrd though. It doesn't matter that they are broken most of the time. Note that upstream Ignition has already dropped this service. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This just reordering and consolidating lines. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This was referenced Apr 15, 2026
Drop old Ignition OEM mounting code and bump bootengine with new mount handling
flatcar/scripts#3934
Merged
Member
|
Is wiping OEM partition in ignition essentially a noop, since some tmpfs will be wiped instead and then, at a later stage, we mount the disk-based OEM partition? |
Contributor
Author
|
The tmpfs OEM is for PXE only where there is no Flatcar disk (yet). It wouldn't make sense to try and wipe it in that case. I don't know why anyone would want to wipe it even in the non-PXE case, but apparently that is supposed to work. |
krnowak
reviewed
Apr 15, 2026
Ignition no longer does its own mounting of the OEM partition for the oem:// scheme, so bootengine needs to mount it in advance. The oem:// scheme therefore now maps to /realinit/oem, but Ignition may also write to the same partition at /realinit/sysroot/oem. Rather than shunting OEM data between /oem, /realinit/oem, and /realinit/sysroot/oem, mount /realinit/oem as a tmpfs from the start (for PXE) and turn /realinit/sysroot/oem into a bind mount. We want to unmount the disk-based OEM partition before Ignition's disk stage, in case it gets wiped, and its mount stage, in case it gets remounted. This can be done more simply with findmnt. However, we do want the disk-based OEM partition to be mounted while Ignition's fetch-offline and fetch stages run in case the user has put config there. This is now done with RequiresMountsFor now that Ignition no longer does it for us. The kargs stage can also use this mount to write grub.cfg rather than mounting it again in its own namespace. The `nodev` option wasn't applied to PXE. We only expect a disk-based OEM partition to be btrfs or ext4, so don't rely on the `auto` type. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
27c2888 to
1b557b4
Compare
krnowak
approved these changes
Apr 15, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Mount OEM partition so that Ignition doesn't have to do it
Ignition no longer does its own mounting of the OEM partition for the
oem://scheme, so bootengine needs to mount it in advance. Theoem://scheme therefore now maps to/realinit/oem, but Ignition may also write to the same partition at/realinit/sysroot/oem.The hope is to eventually drop even more patches from Ignition and use a new
file://scheme with Butane doing the mapping fromoem://tofile:///oem.Rather than shunting OEM data between
/oem,/realinit/oem, and/realinit/sysroot/oem, mount/realinit/oemas a tmpfs from the start (for PXE) and turn/realinit/sysroot/oeminto a bind mount.We want to unmount the disk-based OEM partition before Ignition's disk stage, in case it gets wiped, and its mount stage, in case it gets remounted. This can be done more simply with
findmnt.However, we do want the disk-based OEM partition to be mounted while Ignition's fetch-offline and fetch stages run in case the user has put config there. This is now done with
RequiresMountsFornow that Ignition no longer does it for us. The kargs stage can also use this mount to writegrub.cfgrather than mounting it again in its own namespace.The
nodevoption wasn't applied to PXE.We only expect a disk-based OEM partition to be btrfs or ext4, so don't rely on the
autotype.Aside from these mount-related changes, the ignition-setup script has been dropped (also by upstream) as it is no longer needed, I have reworked the Ignition units to make them easier to compare against upstream, and I have changed the
emergency.targetjob mode fromisolatetoreplace-irreversibly.The
isolatejob mode causesdev-mapper-usr.deviceand thereforesysusr-usr.mountto stop. We cannot stop the latter though because the emergency shell is hosted within it. It's not entirely clear why this happens because both units haveIgnoreOnIsolate=yes. Trying to unmount doesn't break the shell, but it does show an unexpected error.The usual approach of preventing the above with drop-in units doesn't seem to work for auto-generated mount units. However, I noticed that systemd itself has not used the
isolatejob mode foremergency.targetsince 2013.replace-irreversiblydoes not proactively stop all the other units, just the ones that would block the new target. This can actually make debugging easier in the event of an Ignition failure because the system will be in a closer state to the one when the failure occurred.See flatcar/scripts#3934 for the associated Ignition changes (in scripts).
How to use
You can try variations on these configs:
For the latter to work, you have to place mybaz.txt in the OEM partition of the image beforehand (use
guestmount) or add it to an initrd alongside the config and append that initrd to the PXE image.Note that Butane does not currently support
oem://so you actually need to putgs://initially and then change it tooem://in the resulting JSON.You can also try loading alternative configs from the OEM partition by passing
ignition.config.url=oem:///myconfig.ignon the kernel command line.Testing done
Jenkins has passed with these changes alongside the associated Ignition changes. I have also done lots of manual testing.