-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document how to modify kargs via
rpm-ostree
Closes: #88
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
= Modifying Kernel Arguments | ||
|
||
Currently to change kernel arguments, you must script a systemd service which runs `rpm-ostree kargs --reboot`. The command supports appending kernel arguments (via `--append KEY[=VAL]`), deleting them (via `--delete KEY[=VAL]`), and replacing them (via `--replace KEY[=VALUE]`). | ||
|
||
NOTE: In the future, we will have a more Ignition-friendly method of doing this with stronger guarantees. See https://github.com/coreos/ignition/issues/1051 for more information. | ||
|
||
Here's an example which drops the default `systemd.unified_cgroup_hierarchy=0` kernel argument so that the machine uses cgroups v2: | ||
|
||
.Removing systemd.unified_cgroup_hierarchy=0 to switch to cgroups v2 | ||
[source,yaml] | ||
---- | ||
variant: fcos | ||
version: 1.1.0 | ||
passwd: | ||
users: | ||
- name: core | ||
ssh_authorized_keys: | ||
- $pubkey | ||
systemd: | ||
units: | ||
- name: cgroups-v2-karg.service | ||
enabled: true | ||
contents: | | ||
[Unit] | ||
Description=Switch To cgroups v2 | ||
After=systemd-machine-id-commit.service | ||
ConditionKernelCommandLine=systemd.unified_cgroup_hierarchy | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/bin/rpm-ostree kargs --reboot --delete=systemd.unified_cgroup_hierarchy | ||
[Install] | ||
WantedBy=multi-user.target | ||
---- | ||
|
||
NOTE: Make sure to use `After=systemd-machine-id-commit.service`. Otherwise there is a chance that systemd services with `ConditionFirstBoot=true` will rerun on the next boot. | ||
|
||
The systemd service above will execute on every boot. This means that e.g. manually re-adding the kernel argument later on will cause the service to kick in again on reboot. If this is a concern, you can additionally use a stamp file: | ||
|
||
.Removing systemd.unified_cgroup_hierarchy=0 to switch to cgroups v2 with a stamp file | ||
[source,yaml] | ||
---- | ||
variant: fcos | ||
version: 1.1.0 | ||
passwd: | ||
users: | ||
- name: core | ||
ssh_authorized_keys: | ||
- $pubkey | ||
systemd: | ||
units: | ||
- name: cgroups-v2-karg.service | ||
enabled: true | ||
contents: | | ||
[Unit] | ||
Description=Switch To cgroups v2 | ||
After=systemd-machine-id-commit.service | ||
ConditionKernelCommandLine=systemd.unified_cgroup_hierarchy | ||
ConditionPathExists=!/var/lib/cgroups-v2-karg.stamp | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/bin/rpm-ostree kargs --delete=systemd.unified_cgroup_hierarchy | ||
ExecStart=/bin/touch /var/lib/cgroups-v2-karg.stamp | ||
ExecStart=/bin/systemctl --no-block reboot | ||
[Install] | ||
WantedBy=multi-user.target | ||
---- |