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

Document package layering via systemd #294

Merged
merged 9 commits into from
May 27, 2021
Merged

Conversation

rugk
Copy link
Contributor

@rugk rugk commented May 18, 2021

As discussed in the forum thread here.

Heavily inspired by the cargs v2 example.

Thanks a lot to the community for the help!

@travier
Copy link
Member

travier commented May 19, 2021

Took a quick look and this looks good! Thanks!

@rugk
Copy link
Contributor Author

rugk commented May 24, 2021

Tested practically and it worked except that a network error occurred, but I guess this is related to a known CoreOS problem. (linked it)

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for filing this!

RemainAfterExit=yes
ExecStart=/usr/bin/rpm-ostree install --allow-inactive nano
ExecStart=/bin/touch /var/lib/rpm-ostree-install-nano.stamp
ExecStart=/bin/systemctl --no-block reboot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a long thread on this somewhere; the problem with rebooting like this is it doesn't compose - what if e.g. two units want to reboot? They'll race, but you only want to reboot once.

What I think would be cleanest is having something like a coreos-firstboot-reboot.service that is off by default and is ordered After=first-boot-complete.target - that way multiple units can request a reboot via Wants=coreos-firstboot-reboot.service.

Copy link
Contributor Author

@rugk rugk May 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a long thread on this somewhere

Likely when you’ve discussed the cgroups example, because I’ve literally taken it from there and it’s also still there – so if we’d change that, we would possibly need to adjust it there, don’t we?

What I think would be cleanest is having something like a coreos-firstboot-reboot.service that is off by default

Okay, so is this something an admin should configure?
Or is this a service that should be included in Fedora CoreOS, so that an admin should only do Wants=coreos-firstboot-reboot.service as you say?

Again, we can hardly explain that on two totally separate pages… so I’d tend to having that included in FCOS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For package layering in specific, I think the end goal for coreos/fedora-coreos-tracker#681 is that the packages are available from first boot so that you wouldn't have to reboot at all.

@cgwalters
Copy link
Member

To be clear, I'm mostly OK with merging this as is if you prefer after fixing the network-online.target bits, and let's document the caveats.

We can pursue better reboot handling with patches to either fedora-coreos-config or upstream systemd, then circle back and improve this.

@cgwalters
Copy link
Member

Yet another alternative though is to put this logic in https://github.com/coreos/butane

@cgwalters cgwalters closed this May 24, 2021
@cgwalters cgwalters reopened this May 24, 2021
@rugk
Copy link
Contributor Author

rugk commented May 24, 2021

Oh only read your further comments now. Okay, so should I document these potential problems?
And is there anything to change for the cgroups v2 example?

Yet another alternative though is to put this logic in https://github.com/coreos/butane

Well… concerning layering the issues are already linked (in the doc too), but given cgroups also uses this reboot switch, I guess there are a lot of other use cases to reboot during the provisioning. So having something “built-in” would indeed be nice for this.

Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

RemainAfterExit=yes
ExecStart=/usr/bin/rpm-ostree install --allow-inactive nano
ExecStart=/bin/touch /var/lib/rpm-ostree-install-nano.stamp
ExecStart=/bin/systemctl --no-block reboot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For package layering in specific, I think the end goal for coreos/fedora-coreos-tracker#681 is that the packages are available from first boot so that you wouldn't have to reboot at all.

rugk and others added 4 commits May 26, 2021 08:57
Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Do you mind squashing all your commits into one? Or alternatively, we can do so on merge if you prefer.

@rugk
Copy link
Contributor Author

rugk commented May 27, 2021

I don’t mind, but you can also do so when merging. I guess it makes no difference, so just do so, if you want. 😉

@jlebon jlebon changed the title Add package layering Document package layering via systemd May 27, 2021
@jlebon jlebon merged commit 2a682ae into coreos:main May 27, 2021
@rugk rugk deleted the package-layering branch May 27, 2021 21:27
@jlebon
Copy link
Member

jlebon commented May 27, 2021

Thanks a lot for writing this up!

I suggested a few tweaks to this in #296.

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.

5 participants