-
Notifications
You must be signed in to change notification settings - Fork 197
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
Treecompose kernel cleanup #959
Conversation
Mmm...this is even messier than I thought. Marking WIP. |
8c3a60d
to
02967c6
Compare
Updated 🆕. There was a lot of internal churn here as I settled on things...there may be some artifacts from intermediate state. One thing that clearly sucks is:
This means we now get 3 copies of both the kernel and initramfs due to separate SELinux labels 😿. It's tempting to just do Anyways, we now with |
Folded #927 into this |
bot, retest this please |
02967c6
to
1e04920
Compare
Lifting WIP, should be ready for review 👁. |
src/libpriv/rpmostree-postprocess.c
Outdated
if (!old_machine_id) | ||
return FALSE; | ||
} | ||
if (strlen (old_machine_id) != 33) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will segfault in the ENOENT
case, right? Seems like this one and the trimming should be under the != NULL
check.
src/libpriv/rpmostree-kernel.c
Outdated
int upto_index; | ||
switch (dest) | ||
{ | ||
case RPMOSTREE_FINALIZE_KERNEL_AUTO: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This confuses me; don't we always want to put the kernel in /usr/lib/ostree-boot
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes; we do/should - this was more about "update /boot only if we find a kernel there".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh gotcha. OK, the implementation here is really tricky. Can we just drop the loop approach, factor out the unlink
& linkat
bits and just go through the two locations one at a time? Also, maybe a comment where the enum is declared for AUTO
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, reworked, and fixed some bugs along the way. Also did a git add
of a test case I'd written that had been sitting in my tree for a while without me doing a git clean -dfx
(lucky!).
1e04920
to
9b03d1b
Compare
We have 3 locations to find kernels now; I can't think of a reason to support placing kernels *only* in `/boot`. The original commit 15ecaac doesn't give a reason, and I certainly can't think of one now. This makes `legacy` be an alias for `both`, which should be fully compatible. Prep for further refactoring towards changing `new` to mean both `/usr/lib/ostree-boot` *and* `/usr/lib/modules`.
This helped me debug/fix the tests faster.
Prep for changing `boot_location: new` to use `/usr/lib/ostree-boot` and `/usr/lib/modules`. Rework our kernel postprocessing so that we unify the `boot_location` handling with initramfs generation. Instead of doing the initramfs first in postprocessing, we do it nearly last, after e.g. `etc` is renamed to `usr/etc`. This has some consequences, such as the fact that `run_bwrap_mutably()` is now called in both situations. In general, our handling of `etc` is inconsistent, although understandably so. As part of this, I finally got around to implementing the bit from systemd/systemd#4174 however suboptimal it is; need the unified core so we can cleanly ignore the posttrans like we do others. We intentionally keep the file around in the generated tree so that installing a kernel RPM per client doesn't try to do any of this either. This all gets folded together so that the logic for handling the bootloader gets simpler - in the Fedora case, we now know to find kernels in `/usr/lib/modules` and can ignore `/boot`.
9b03d1b
to
4aad7d1
Compare
src/libpriv/rpmostree-kernel.c
Outdated
/* Given a @rootfs_dfd and path to kernel/initramfs that live in | ||
* usr/lib/modules/$kver, possibly update @bootdir to use them. | ||
* @bootdir should be one of either /usr/lib/ostree-boot or /boot. | ||
* If @copy_if_not_found is set, we do the copy unconditionally, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter is still called is_auto
, though I prefer copy_if_not_found
as well. :) Or maybe keep it reversed and name it something like only_if_found
?
src/libpriv/rpmostree-postprocess.c
Outdated
/* This gets called both by treecompose, where in the non-unified path we just | ||
* have /etc, and in kernel postprocessing where we have usr/etc. | ||
*/ | ||
if (fstatat (rootfs_fd, "etc", &stbuf, 0) < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glnx_fstatat_allow_noent
?
src/libpriv/rpmostree-kernel.c
Outdated
if (rebuild_from_initramfs) | ||
bwrap = rpmostree_bwrap_new (rootfs_dfd, RPMOSTREE_BWRAP_IMMUTABLE, error, | ||
"--ro-bind", "/etc", "/etc", | ||
NULL); | ||
else | ||
bwrap = rpmostree_bwrap_new (rootfs_dfd, RPMOSTREE_BWRAP_IMMUTABLE, error, | ||
"--ro-bind", "./usr/etc", "/etc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor/optional: this can just be usr/etc
, right? (To be more consistent with other relative bindings we do elsewhere).
return FALSE; | ||
|
||
/* If the boot location includes /boot, we also need to copy /usr/lib/ostree-boot there */ | ||
switch (boot_location) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be if (boot_location == RPMOSTREE_POSTPROCESS_BOOT_LOCATION_BOTH)
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but I usually like doing an explicit switch
over enums so one gets warnings when adding a new case (and down the line we'll probably add a LOCATION_MODULES
or so).
Saw this in testing with
|
LGTM! We might have to wait until the CentOS repos settle down though. |
We have 3 locations to find kernels now; I can't think of a reason to support placing kernels *only* in `/boot`. The original commit 15ecaac doesn't give a reason, and I certainly can't think of one now. This makes `legacy` be an alias for `both`, which should be fully compatible. Prep for further refactoring towards changing `new` to mean both `/usr/lib/ostree-boot` *and* `/usr/lib/modules`. Closes: #959 Approved by: jlebon
This helped me debug/fix the tests faster. Closes: #959 Approved by: jlebon
Prep for changing `boot_location: new` to use `/usr/lib/ostree-boot` and `/usr/lib/modules`. Rework our kernel postprocessing so that we unify the `boot_location` handling with initramfs generation. Instead of doing the initramfs first in postprocessing, we do it nearly last, after e.g. `etc` is renamed to `usr/etc`. This has some consequences, such as the fact that `run_bwrap_mutably()` is now called in both situations. In general, our handling of `etc` is inconsistent, although understandably so. As part of this, I finally got around to implementing the bit from systemd/systemd#4174 however suboptimal it is; need the unified core so we can cleanly ignore the posttrans like we do others. We intentionally keep the file around in the generated tree so that installing a kernel RPM per client doesn't try to do any of this either. This all gets folded together so that the logic for handling the bootloader gets simpler - in the Fedora case, we now know to find kernels in `/usr/lib/modules` and can ignore `/boot`. Closes: #959 Approved by: jlebon
💔 Test failed - status-atomicjenkins |
@rh-atomic-bot retry |
This helped me debug/fix the tests faster. Closes: #959 Approved by: jlebon
Prep for changing `boot_location: new` to use `/usr/lib/ostree-boot` and `/usr/lib/modules`. Rework our kernel postprocessing so that we unify the `boot_location` handling with initramfs generation. Instead of doing the initramfs first in postprocessing, we do it nearly last, after e.g. `etc` is renamed to `usr/etc`. This has some consequences, such as the fact that `run_bwrap_mutably()` is now called in both situations. In general, our handling of `etc` is inconsistent, although understandably so. As part of this, I finally got around to implementing the bit from systemd/systemd#4174 however suboptimal it is; need the unified core so we can cleanly ignore the posttrans like we do others. We intentionally keep the file around in the generated tree so that installing a kernel RPM per client doesn't try to do any of this either. This all gets folded together so that the logic for handling the bootloader gets simpler - in the Fedora case, we now know to find kernels in `/usr/lib/modules` and can ignore `/boot`. Closes: #959 Approved by: jlebon
☀️ Test successful - status-atomicjenkins |
This breaks with anaconda UEFI: https://github.com/rhinstaller/anaconda/issues/1188 |
(with |
Followup in https://pagure.io/fedora-atomic/issue/94 |
This ensures that hardlinking works. See https://bugzilla.redhat.com/show_bug.cgi?id=1526191 coreos/rpm-ostree#959 (comment) coreos/rpm-ostree#1142
Moved from: fedora-selinux/selinux-policy-contrib#43 This ensures that hardlinking works with `/usr/share/rpm` (once the contrib patch to make it `usr_t` is merged too). See https://bugzilla.redhat.com/show_bug.cgi?id=1526191 coreos/rpm-ostree#959 (comment) coreos/rpm-ostree#1142
This ensures that hardlinking works, once the corresponding base policy PR is merged: fedora-selinux/selinux-policy#209 See https://bugzilla.redhat.com/show_bug.cgi?id=1526191 coreos/rpm-ostree#959 (comment) coreos/rpm-ostree#1142
This ensures that hardlinking works, once the corresponding base policy PR is merged: fedora-selinux/selinux-policy#209 See https://bugzilla.redhat.com/show_bug.cgi?id=1526191 coreos/rpm-ostree#959 (comment) coreos/rpm-ostree#1142
Moved from: fedora-selinux/selinux-policy-contrib#43 This ensures that hardlinking works with `/usr/share/rpm` (once the contrib patch to make it `usr_t` is merged too). See https://bugzilla.redhat.com/show_bug.cgi?id=1526191 coreos/rpm-ostree#959 (comment) coreos/rpm-ostree#1142
No description provided.