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

Provide a standard way to change kernel command line options via Ignition #318

Closed
martinpitt opened this issue Nov 18, 2019 · 19 comments
Closed

Comments

@martinpitt
Copy link

martinpitt commented Nov 18, 2019

EDIT: Current solution: https://docs.fedoraproject.org/en-US/fedora-coreos/kernel-args/


On FCOS there is no official way how to change the kernel command line, e. g. the mitigations=auto,nosmt option. The only place where they occur is in /boot/loader.0/entries/ostree-{1,2}-fedora-coreos.conf, but that's not very predictable, nor is it clear whether modifying these will also apply to installing kernel updates. Right now, none of the standard mechanisms (grubby, /etc/default/grub, /boot/grub/grubenv) are available.

Background: In Cockpit we have a UI for detecting/enabling/disabling the nosmt option. Changing a kernel command line option is annoyingly hard, we have quite an elaborate script for that.

Could grubby be added to FCOS images, or if not, what's the recommended way to persist kernel options? Thanks!

@lucab lucab transferred this issue from coreos/fedora-coreos-config Nov 18, 2019
@lucab
Copy link
Contributor

lucab commented Nov 18, 2019

Thanks for the report.
On FCOS, rpm-ostree owns the kernel command-line arguments. This is exposed to consumers via rpm-ostree kargs (or DBus).

That said, I agree the UX here could be enhanced by:

@martinpitt
Copy link
Author

rpm-ostree kargs sounds promising, I'll have a look at that. Thank you!

@cgwalters
Copy link
Member

coreos/rpm-ostree#1789 also redirects grubby.

@martinpitt
Copy link
Author

I added rpm-ostree kargs to cockpit's kernelopt.sh script, now this works great on FCOS. Thanks for your help!

@bgilbert bgilbert closed this as completed Dec 2, 2019
@cgwalters
Copy link
Member

Just to xref this, for RHCOS (OpenShift) we support kernelArguments in MachineConfig.

@cgwalters cgwalters reopened this Feb 14, 2020
@cgwalters
Copy link
Member

Going to reopen this since I think we do want to standardize an Ignition method for this for FCOS and ideally have that same method apply to RHCOS.

@cgwalters
Copy link
Member

cgwalters commented Feb 14, 2020

For anyone who wants to change kargs today with FCOS, you'll basically need to write a systemd unit that runs rpm-ostree kargs --append ... --reboot, and you'll also need to use e.g. ConditionFirstBoot=yes.

@dustymabe dustymabe added the jira for syncing to jira label Feb 14, 2020
@travier travier changed the title Provide a standard way how to change kernel command line options (grubby?) Provide a standard way to change kernel command line options Oct 22, 2020
@kelvinfan001
Copy link
Member

kelvinfan001 commented Oct 22, 2020

I think we do want to standardize an Ignition method for this for FCOS and ideally have that same method apply to RHCOS.

Would this "standard way" be support for kargs.d as implemented in ostreedev/ostree#2217? This way, once Ignition supports rebooting in the initramfs, we can use Ignition configs to specify our desired default kargs, write a file into kargs.d, create a new deployment, and reboot.

@jlebon
Copy link
Member

jlebon commented Oct 22, 2020

Would this "standard way" be support for kargs.d as implemented in ostreedev/ostree#2217? This way, once Ignition supports rebooting in the initramfs, we can use Ignition configs to specify our desired default kargs, write a file into kargs.d, create a new deployment, and reboot.

I think we'd probably want to optimize it so that we don't create a new deployment at all. So e.g. the user's Ignition config drops files in kargs.d, we notice it, add the kargs to the BLS, and reboot. All before ever switching root.

@kelvinfan001
Copy link
Member

After some discussion today, we've decided that for CoreOS purposes, the BLS will still be the source of truth. In FCOS, there will be no new API or standard way for changing/setting kargs through OSTree. Setting/editing custom kernel arguments on first boot will be handled by Ignition.

@jlebon jlebon changed the title Provide a standard way to change kernel command line options Provide a standard way to change kernel command line options via Ignition Nov 16, 2020
@cgwalters
Copy link
Member

To remove the default mitigations=auto,nosmt default, currently you can write a systemd unit in ignition that does e.g.

[Unit]
ConditionKernelCommandLine=mitigations

[Service]
ExecStart=/usr/bin/rpm-ostree kargs --remove=mitigations --reboot
RemainAfterExit=yes

If you're running other units that might depend on this, you should change them to order After= this unit.

@jlebon
Copy link
Member

jlebon commented Nov 16, 2020

The rpm-ostree kargs approach is currently documented here: https://docs.fedoraproject.org/en-US/fedora-coreos/kernel-args/.

@bgilbert
Copy link
Contributor

This will be addressed via Ignition's new kernel argument support (coreos/ignition#1168), which has been implemented in an experimental config spec but not yet stabilized. Leaving this open until the functionality is stabilized and documented.

@sohankunkerkar
Copy link
Member

sohankunkerkar commented Jun 22, 2021

This will be addressed via Ignition's new kernel argument support (coreos/ignition#1168), which has been implemented in an experimental config spec but not yet stabilized. Leaving this open until the functionality is stabilized and documented.

@bgilbert This feature has already landed in the latest stable release: https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/34.20210529.3.0/x86_64/commitmeta.json

@bgilbert
Copy link
Contributor

@sohankunkerkar Yep, and we've added documentation with a suitable warning. However, we can't unconditionally recommend the functionality until Ignition spec 3.3.0 is stabilized, since Ignition configs using the experimental spec will break at that point.

@dustymabe
Copy link
Member

dustymabe commented Jul 1, 2021

v3.3.0 stabilization happened in ignition 2.11.0 which is in testing. See the proposed docs change: coreos/fedora-coreos-docs#307

@dustymabe
Copy link
Member

The fix for this went into testing stream release 34.20210626.2.0. Please try out the new release and report issues.

@dustymabe dustymabe added the status/pending-stable-release Fixed upstream and in testing. Waiting on stable release. label Jul 1, 2021
@dustymabe
Copy link
Member

The fix for this went into stable stream release 34.20210626.3.1.

@dustymabe dustymabe removed the status/pending-stable-release Fixed upstream and in testing. Waiting on stable release. label Jul 15, 2021
@dustymabe
Copy link
Member

Docs will get updated soon when the new butane hits Fedora repos: coreos/fedora-coreos-docs#307 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants