-
Notifications
You must be signed in to change notification settings - Fork 302
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
Support kargs.d directories for default kargs #1836
base: main
Are you sure you want to change the base?
Conversation
679bc5b
to
c8ab08f
Compare
Add an ostree-kargs-override flag which is set to true if the kargs of the current deployment were overridden. The flag is written to the bootconfig, and persists in subsequent deployments. This is in preparation for ostreedev#1836 which needs a way to determine whether the previous deployment's kargs were modified by the user, so that user-modified kargs can be carried forward to the next deployment.
Add an ostree-kargs-override flag which is set to true if the kargs of the current deployment were overridden. The flag is written to the bootconfig, and persists in subsequent deployments. This is in preparation for ostreedev#1836 which needs a way to determine whether the previous deployment's kargs were modified by the user, so that user-modified kargs can be carried forward to the next deployment.
cc3abc3
to
256226e
Compare
Add an ostree-kargs-override flag which is set to true if the kargs of the current deployment were overridden. The flag is written to the bootconfig, and persists in subsequent deployments. This is in preparation for ostreedev#1836 which needs a way to determine whether the previous deployment's kargs were modified by the user, so that user-modified kargs can be carried forward to the next deployment.
5a24fe1
to
bb91d98
Compare
bb91d98
to
9c0404d
Compare
Commands to test this on Fedora Atomic Host 29 (also works with FCOS setting
|
OK - this is ready for a look now! |
bb64139
to
483d369
Compare
f154467
to
6c2610e
Compare
Add the following config directories for setting default kernel arguments: /etc/ostree/kargs.d (host config) /usr/lib/ostree-boot/kargs.d (base config) These directories contain files whose contents consist of a karg snippet, which is a collection kernel parameter keys and values. Example of a snippet: ``` KEY=FOO KEYFLAG ANOTHERKEY=VALUE1 ANOTHERKEY=VALUE2 ``` Snippets are read in alphanumeric order of the karg snippet filename when generating the final kernel options from the host and base config directories. Ordering may be specified by prefixing a number, e.g. `/etc/ostree/kargs.d/4000_localhost`. The bootconfig key `ostree-kargs-generated-from-config` indicates whether the kargs were generated by ostree from the kargs.d directories (`true`), or copied from the previous deployment (`false`). Editing the kargs through the command line (e.g. `ostree admin deploy --karg=`) will set the flag to `false`, and kargs will be copied from the previous deployment for subsequent deployments. Also add support for `ostree admin instutil set-kargs` so that installer programs using this command (such as Anaconda) remain managed by the kargs.d directories from the first deployment. Closes: ostreedev#479
6c2610e
to
e1d2e47
Compare
Tested this in FCOS with the following commands: From a coreos-assembler repo clone: git clone https://github.com/coreos/coreos-assembler
cd coreos-assembler
git remote add rfairley https://github.com/rfairley/coreos-assembler
git fetch rfairley
git checkout rfairley-localostree (The above coreos-assembler branch has the following patch applied): diff --git a/src/virt-install b/src/virt-install
index 2ad6578..61761fb 100755
--- a/src/virt-install
+++ b/src/virt-install
@@ -150,6 +150,10 @@ if args.ostree_repo:
assert args.ostree_ref
ks_tmp.write(f"""
ostreesetup --nogpg --osname={args.ostree_stateroot} --remote={args.ostree_remote} --url=http://{ipv4}:{PORT}/ --ref="{args.ostree_ref}"
+%pre
+curl -L -O http://{ipv4}:{PORT}/ostreebuild.tar.gz
+tar -C / -xf ostreebuild.tar.gz
+%end
""")
if args.fs9p: From the COSA/FCOS working directory: cosadir=/path/to/coreos-assembler
export COREOS_ASSEMBLER_GIT=$cosadir
cosa init https://github.com/coreos/fedora-coreos-config # see coreos-assembler README.md (https://github.com/coreos/coreos-assembler#setup) for the `cosa` alias From an OSTree repo checkout of this PR: fcosdir=/path/to/fcos
ostreedir=/path/to/ostree
cd $ostreedir/ci
./build-rpm.sh
cd ..
make install DESTDIR=$ostreedir/install/ && rm -rf ./ostreebuild && rm -rf ./ostreebuild.tar.gz && mkdir -p ./ostreebuild && cp -r ./install/* ./ostreebuild && cd ./ostreebuild && tar -czvf ../ostreebuild.tar.gz ./
cp $ostreedir/ostreebuild.tar.gz $fcosdir/repo/
cp $ostreedir/ci/x86_64/ostree-* $fcosdir/overrides/rpm/ From the FCOS workdir: cosa build
cosa run In the booted FCOS VM, see that the
If you use diff --git a/fedora-coreos-base.yaml b/fedora-coreos-base.yaml
index 617d000..17e8993 100644
--- a/fedora-coreos-base.yaml
+++ b/fedora-coreos-base.yaml
@@ -150,3 +150,10 @@ packages:
- console-login-helper-messages-profile
# CoreOS Installer
- coreos-installer coreos-installer-dracut
+
+add-files:
+ - - 2000_hello
+ - /usr/lib/ostree-boot/kargs.d/2000_hello
+ - - 2001_foo
+ - /usr/lib/ostree-boot/kargs.d/2001_foo then empty files will be written to |
Lifting WIP - now in a working/reviewable state. The commands CI tests looks to fail on |
☔ The latest upstream changes (presumably be2572b) made this pull request unmergeable. Please resolve the merge conflicts. |
Any updates about this? |
The same question here. This would be useful. |
This would be useful for us as well. @rfairley do you plan on working further on this? Otherwise I might do a rebase and submit a new merge request. |
Hi @agners, I'm not currently planning to work further on this - feel free to continue to further this. Note, these changes may still be blocked/dependent on resolving some of the issues brought up in #479 - e.g. support to run OSTree in the initramfs (coreos/fedora-coreos-tracker#34), so that systems where the kargs.d files can change in the initramfs (such as FCOS, through Ignition), can reboot with the new args before the real root switch. Alternative solutions have been suggested in #479 too, like storing the default kargs within the kernel binary. I think some discussion is still needed there before this approach is finalized and this kind of support is accepted into OSTree (and machines start depending on kargs.d). But as a POC, this has been tested per #1836 (comment). A lot has changed in the FCOS build tooling used since that comment (e.g. Anaconda is no longer used, so no need to inject an OSTree build with these changes into an Anaconda image -- it should be installed in the COSA container image instead), but the general testing method is still valid (apply a build of OSTree with this patch included into the OS build environment/tooling, build an OS image which incorporates this build of OSTree, and add the kargs.d files to the OS image through some means, e.g. the rpm-ostree compose treefile, to trigger this functionality). |
@rfairley: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@rfairley: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Add the following config directories for setting default kernel
arguments:
/etc/ostree/kargs.d (host config)
/usr/lib/ostree-boot/kargs.d (base config)
These directories contain files whose contents consist of a karg
snippet, which is a collection kernel parameter keys and values.
Example of a snippet:
Snippets are read in alphanumeric order of the karg snippet filename
when generating the final kernel options from the host and base config
directories. Ordering may be specified by prefixing a number, e.g.
/etc/ostree/kargs.d/4000_localhost
.The bootconfig key
ostree-kargs-generated-from-config
indicateswhether the kargs were generated by ostree from the kargs.d directories
(
true
), or copied from the previous deployment (false
). Editing thekargs through the command line (e.g.
ostree admin deploy --karg=
) willset the flag to
false
, and kargs will be copied from the previousdeployment for subsequent deployments.
Also add support for
ostree admin instutil set-kargs
so that installerprograms using this command (such as Anaconda) remain managed by the
kargs.d directories from the first deployment.
Closes: #479
Self notes (to fix in this PR):
which is a collection kernel parameter keys and values
glnx_autofd
where appropriateTo do (as follow-ups to this PR):
/etc/ostree/kargs
and/usr/lib/ostree-boot/kargs
(in Fedora RPM, etc).next_arg()
function).