Skip to content

Conversation

@ckyrouac
Copy link
Collaborator

This will remove all rpms and containers/images from the previous install (found in /sysroot) on reboot after running install to-existing-root.


WIP: using this PR to test the rpm build

@ckyrouac ckyrouac marked this pull request as draft April 28, 2025 16:03
@ckyrouac ckyrouac force-pushed the to-existing-cleanup branch from 755931d to fef5861 Compare April 28, 2025 17:36
@ckyrouac ckyrouac force-pushed the to-existing-cleanup branch from fef5861 to bac58ec Compare April 28, 2025 20:45
@github-actions github-actions bot added the area/install Issues related to `bootc install` label Apr 28, 2025
@ckyrouac ckyrouac force-pushed the to-existing-cleanup branch 2 times, most recently from 8fecfee to 3595ed1 Compare April 29, 2025 18:28
@ckyrouac ckyrouac force-pushed the to-existing-cleanup branch from 3595ed1 to 2199529 Compare April 30, 2025 15:39
@github-actions github-actions bot added the area/system-reinstall-bootc Issues related to system-reinstall-botoc label Apr 30, 2025
Copy link
Collaborator

@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 working on this, looking sane to me so far!

mount -o remount,rw /sysroot
rpm -qa --root=/sysroot --dbpath=/usr/lib/sysimage/rpm | xargs rpm -e --root=/sysroot --dbpath=/usr/lib/sysimage/rpm

mount --bind -o rw /sysroot/var/lib/containers /var/lib/containers
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also I guess conceptually since podman is OS independent in theory this could be a shared fragment, but let's not overengineer now, just noting.

Makefile Outdated
# Install bootc-destructive-cleanup in fedora derivatives
@ID=$$(grep '^ID=' /usr/lib/os-release | cut -d'=' -f2 | tr -d '"'); \
ID_LIKE=$$(grep '^ID_LIKE=' /usr/lib/os-release | cut -d'=' -f2 | tr -d '"'); \
if [ "$$ID" = "fedora" ] || [ "$$ID_LIKE" = "fedora" ]; then \
Copy link
Collaborator

Choose a reason for hiding this comment

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

ID_LIKE needs to be a substring match

$ podman run --rm quay.io/centos-bootc/centos-bootc:stream10 grep ID_LIKE /usr/lib/os-release
ID_LIKE="rhel fedora"
$

Maybe we can factor out a lib/install.sh or something?

@ckyrouac ckyrouac force-pushed the to-existing-cleanup branch from 2199529 to 738d5c6 Compare April 30, 2025 18:08
@ckyrouac ckyrouac marked this pull request as ready for review April 30, 2025 18:09
@ckyrouac ckyrouac changed the title WIP: Add alongside-cleanup systemd service Add alongside-cleanup systemd service May 1, 2025
@ckyrouac ckyrouac force-pushed the to-existing-cleanup branch 2 times, most recently from a079b37 to 80a4660 Compare May 1, 2025 15:34
@cgwalters
Copy link
Collaborator

Hmm, something is still leaking in the install tests. This test passed on other PRs. I'm not seeing the bug though.

@ckyrouac ckyrouac force-pushed the to-existing-cleanup branch from 80a4660 to 3526b87 Compare May 1, 2025 20:09
@cgwalters cgwalters enabled auto-merge May 1, 2025 20:28
@cgwalters cgwalters disabled auto-merge May 1, 2025 20:29
ckyrouac added 2 commits May 1, 2025 18:28
When set, the bootc-destructive-cleanup flag is added to /sysroot/etc
which enables the bootc-destructive-cleanup systemd service to remove
the previous installation's rpm packages and podman containers/images.

The service is only installed on fedora based systems.

Signed-off-by: ckyrouac <[email protected]>
@ckyrouac ckyrouac force-pushed the to-existing-cleanup branch from 3526b87 to b6300d8 Compare May 1, 2025 22:28
Copy link
Collaborator

@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.

OK this version is even simpler! Nice work.

Just thinking about testing...right now we don't quite have a suite that would cover this flow, though we should. But, something for this could go in https://gitlab.com/fedora/bootc/tests/bootc-workflow-test/ probably too.

Hm, I guess really this is just about an e2e test for s-r-b really, since we added this cleanup option by default there.

.await?;

if matches!(cleanup, Cleanup::TriggerOnNextBoot) {
let sysroot_dir = crate::utils::sysroot_dir(&sysroot)?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is fine as is, really. It's just interesting to note that it's equivalent to rootfs.physical_root and I think that one's clearer. would probably make sense to try to port more things to it.

@cgwalters cgwalters merged commit 3b41d81 into bootc-dev:main May 2, 2025
31 checks passed
@jmarrero jmarrero mentioned this pull request May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install Issues related to `bootc install` area/system-reinstall-bootc Issues related to system-reinstall-botoc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants