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

ostree-prepare-root.service: Run earlier in initrd #1759

Closed
wants to merge 2 commits into from

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Oct 18, 2018

Previously, we were preparing the root very late in the boot process;
right before we switch root. The issue with that is that most services
in the initrd that run After=initrd-root-fs.target expect that
/sysroot already points to the rootfs we'll be pivoting to. Running
this late violates that assumption.

This patch fixes this by making ostree-prepare-root.service instead
run right after sysroot.mount (the physical sysroot mounted by
systemd) but still before initrd-root-fs.target (which is the target
signalling that /sysroot is now valid and ready).

This should make it easier to integrate OSTree with other initrd
services such as Ignition.

Related: dustymabe/ignition-dracut#20

For the same reasons as ostreedev#1697. This is especially important in services
that are likely to be used as an `After/Before=` target in other units.
`ostree-prepare-root.service` is one such service.
Previously, we were preparing the root very late in the boot process;
right before we switch root. The issue with that is that most services
in the initrd that run `After=initrd-root-fs.target` expect that
`/sysroot` already points to the rootfs we'll be pivoting to. Running
this late violates that assumption.

This patch fixes this by making `ostree-prepare-root.service` instead
run right after `sysroot.mount` (the physical sysroot mounted by
systemd) but still before `initrd-root-fs.target` (which is the target
signalling that `/sysroot` is now valid and ready).

This should make it easier to integrate OSTree with other initrd
services such as Ignition.

Related: https://github.com/dustymabe/ignition-dracut/issues/20
@jlebon
Copy link
Member Author

jlebon commented Oct 18, 2018

Marking as WIP for now, still need to test this on some more platforms.

@jlebon
Copy link
Member Author

jlebon commented Oct 19, 2018

OK, I've now tested this on FAH, CAHC, FCOS, and RHCOS! ✔️
Dropping WIP.

@jlebon jlebon removed the WIP label Oct 19, 2018
@jlebon
Copy link
Member Author

jlebon commented Oct 19, 2018

@ramcq If you have some time, would be nice to sanity check that this doesn't cause any weird regressions on EOS either.

@cgwalters
Copy link
Member

@rh-atomic-bot r+ bb0f1be

@rh-atomic-bot
Copy link

⚡ Test exempted: merge already tested.

rh-atomic-bot pushed a commit that referenced this pull request Oct 19, 2018
Previously, we were preparing the root very late in the boot process;
right before we switch root. The issue with that is that most services
in the initrd that run `After=initrd-root-fs.target` expect that
`/sysroot` already points to the rootfs we'll be pivoting to. Running
this late violates that assumption.

This patch fixes this by making `ostree-prepare-root.service` instead
run right after `sysroot.mount` (the physical sysroot mounted by
systemd) but still before `initrd-root-fs.target` (which is the target
signalling that `/sysroot` is now valid and ready).

This should make it easier to integrate OSTree with other initrd
services such as Ignition.

Related: https://github.com/dustymabe/ignition-dracut/issues/20

Closes: #1759
Approved by: cgwalters
@dbnicholson
Copy link
Member

We do have a couple initrd services in https://github.com/endlessm/eos-boot-helper/tree/master/dracut that depend on the mount ordering. I haven't looked closely at the ordering yet. @dsd FYI.

mbilker pushed a commit to mbilker/ostree that referenced this pull request Aug 25, 2020
- Fixes systemd failing to determine if `/sysroot` is valid because of
  `/etc/os-release` not being available yet.

- Related: ostreedev#1759
@jlebon jlebon deleted the pr/prepare-root-early branch April 24, 2023 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants