RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2144586 - Previous container images are not GC'd by default
Summary: Previous container images are not GC'd by default
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: rpm-ostree
Version: 9.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Colin Walters
QA Contact: HuijingHei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-11-21 18:58 UTC by Colin Walters
Modified: 2023-05-09 07:56 UTC (History)
3 users (show)

Fixed In Version: rpm-ostree-2022.16-2.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 07:23:50 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab redhat/centos-stream/rpms rpm-ostree merge_requests 19 0 None opened Rebase to 2022.16 2022-11-22 17:50:57 UTC
Red Hat Issue Tracker RHELPLAN-140071 0 None None None 2022-11-21 18:58:53 UTC
Red Hat Product Errata RHEA-2023:2164 0 None None None 2023-05-09 07:23:54 UTC

Description Colin Walters 2022-11-21 18:58:19 UTC
Update or backport https://github.com/coreos/rpm-ostree/pull/4138 to ensure that we don't leak space across OS upgrades in OCP (and elsewhere).

Comment 1 Colin Walters 2022-11-22 19:21:34 UTC
The primary change here is https://github.com/coreos/rpm-ostree/pull/4138

To verify, use e.g. `rpm-ostree rebase` to different container images.  In versions before this, you will see the *old* image listed in `ostree container image list --repo=/ostree/repo`.

After applying this update, the previous image should no longer be displayed and hence its data will be garbage collected.

To do a deeper verification, try rebooting into the new system, run `rpm-ostree cleanup -r`, then look in `/ostree/repo/objects` for a file/object that was only present in the *old* image.

Comment 2 HuijingHei 2022-11-24 13:07:50 UTC
Verify passed with rpm-ostree-2022.16-2.el9.x86_64 using rhcos (with rhel9.0).

1) Test with old rpm-ostree-2022.14-1.el9, after rebase 2 different images, get the 2 images listed in `ostree container image list --repo=/ostree/repo`. After reboot and run `rpm-ostree cleanup -r`, the old files are still existed in repo.
[root@cosa-devsh ~]# rpm -qa | grep rpm-ostree
rpm-ostree-libs-2022.14-1.el9.x86_64
rpm-ostree-2022.14-1.el9.x86_64
[root@cosa-devsh ~]# rpm-ostree rebase --experimental ostree-unverified-registry:registry.ci.openshift.org/coreos/hhei-rhcos-test:9
[root@cosa-devsh ~]# rpm-ostree rebase --experimental ostree-unverified-registry:registry.ci.openshift.org/coreos/hhei-rhcos-test:9-new
[root@cosa-devsh ~]# ostree container image list --repo=/ostree/repo
docker://registry.ci.openshift.org/coreos/hhei-rhcos-test:9-new
docker://registry.ci.openshift.org/coreos/hhei-rhcos-test:9

# reboot

[root@cosa-devsh ~]# find /sysroot/ -inum 5566165
/sysroot/ostree/repo/objects/34/75f4995af551e300f34e2c6609abf9bf9c1d346b1aebc993090ff8451744a9.file
/sysroot/ostree/deploy/rhcos/deploy/cd9e5050e984ce843f2f691f6c2f4e08d69d0e89e274810df466b2180f695dc7.0/usr/bin/ostree
[root@cosa-devsh ~]# rpm-ostree cleanup -r
Bootloader updated; bootconfig swap: yes; bootversion: boot.1.1, deployment count change: -1
Freed: 124.1?MB (pkgcache branches: 0)
[root@cosa-devsh ~]# find /sysroot/ -inum 5566165
/sysroot/ostree/repo/objects/34/75f4995af551e300f34e2c6609abf9bf9c1d346b1aebc993090ff8451744a9.file

============================================================================
2) Test with fixed rpm-ostree, after rebase 2 different images, only get the latest image listed in `ostree container image list --repo=/ostree/repo`. After reboot and run `rpm-ostree cleanup -r`, the old files are removed in repo

[core@cosa-devsh ~]$ rpm -qa | grep rpm-ostree
rpm-ostree-libs-2022.16-2.el9.x86_64
rpm-ostree-2022.16-2.el9.x86_64

[root@cosa-devsh ~]# rpm-ostree rebase --experimental ostree-unverified-registry:registry.ci.openshift.org/coreos/hhei-rhcos-test:9
[root@cosa-devsh ~]# rpm-ostree rebase --experimental ostree-unverified-registry:registry.ci.openshift.org/coreos/hhei-rhcos-test:9-new
[root@cosa-devsh ~]# ostree container image list --repo=/ostree/repo
docker://registry.ci.openshift.org/coreos/hhei-rhcos-test:9-new

# reboot

[root@cosa-devsh ~]# find /sysroot/ -inum 5566795
/sysroot/ostree/repo/objects/34/75f4995af551e300f34e2c6609abf9bf9c1d346b1aebc993090ff8451744a9.file
/sysroot/ostree/deploy/rhcos/deploy/35447b0acf046b272501b00726834738546af9cac7555d96c7c4e887a84c3215.0/usr/bin/ostree
[root@cosa-devsh ~]# rpm-ostree cleanup -r
Bootloader updated; bootconfig swap: yes; bootversion: boot.1.1, deployment count change: -1
Freed: 127.0?MB (pkgcache branches: 0)

[root@cosa-devsh ~]# find /sysroot/ -inum 5566795

Comment 5 HuijingHei 2022-11-25 07:14:24 UTC
Thanks Colin for the pointer, change status to VERIFIED according to result in Comment 2.

Comment 7 errata-xmlrpc 2023-05-09 07:23:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (rpm-ostree bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2023:2164


Note You need to log in before you can comment on or make changes to this bug.