`copy-to-storage` does not include repo file in /etc/yum.repos.d
In my test, I build rhel nightly compose repo into rhel base image https://gitlab.com/fedora/bootc/tests/bootc-workflow-test/-/blob/main/tmt/tests/bootc-install.sh?ref_type=heads#L108. Then install that image into package mode system. After reboot, I run bootc image copy-to-storage. But copied image does not include repo file I built into container image before.
Hmmm, this one needs a bit of debugging. What do you see in e.g. ostree admin config-diff? Do you see the files in /usr/etc/yum.repos.d?
We chatted live about this and my guess is that this is about rhel.repo and it may be a symlink into /run which won't exist on redeploy
rhel.repo is in deployed system.
$ ls -al /etc/yum.repos.d/
total 20
drwxr-xr-x. 2 root root 42 Jun 4 04:22 .
drwxr-xr-x. 92 root root 8192 Jun 4 04:36 ..
-rw-r--r--. 1 root root 376 Jun 4 04:22 redhat.repo
-rw-r--r--. 1 root root 587 Jun 4 04:22 rhel.repo
And no rhel.repo in deployed image.
$ sudo podman --storage-opt=additionalimagestore=/usr/lib/bootc/storage run --rm localhost/bootc:latest ls -al /etc/yum.repos.d
total 0
drwxr-xr-x. 2 root root 6 Jan 1 1970 .
drwxr-xr-x. 1 root root 41 Jun 4 05:01 ..
Yes, I configured rhel.repo in deployed container image, but it got lost after deployment. That does not make any sense for me.
--storage-opt=additionalimagestore=/usr/lib/bootc/storage
I don't think this one is necessary; it won't hurt but until we have https://github.com/containers/bootc/issues/20 for container images used in a "podman build" + bootc switch containers-storage: the image will remain in /var/lib/containers/storage.
This is because the repo files are in the current image, but not in the new one. So we reconcile and drop them.
[root@copy-to-storage-repo-missting-10-1 ~]# ostree ls -R ostree/container/image/containers-storage_3A_localhost/bootc_3A_tmt /usr/etc/yum.repos.d
d00755 0 0 0 /usr/etc/yum.repos.d
-00644 0 0 376 /usr/etc/yum.repos.d/redhat.repo
-00644 0 0 587 /usr/etc/yum.repos.d/rhel.repo
[root@copy-to-storage-repo-missting-10-1 ~]# ostree admin config-diff|grep yum.repos.d
[root@copy-to-storage-repo-missting-10-1 ~]#
Two possible fixes to the build process:
- Add the repo files into the new target image too
- Explicitly modify the
.repofiles so that bootc/ostree carry them as local state
It's still not clear to me why it doesn't appears in the new target image.
When you say "This is because the repo files are in the current image,", does this points to the container image in the bootc container storage?
what exact image you mean for "but not in the new one", does it points to the new target image created by copy-to-storage?
Why this relates to the output of ostree admin config-diff|grep yum.repos.d, by reading the man page I see it compares the diff between /etc and /usr/etc, it's expected to see no drift here since there is no need to touch repo files after installation, because it's already baked in the booted container image
I think what would be most helpful for me is a stripped down failing tmt test that represents this scenario.
@shi2wei3 @henrywang kindly asking for follow up :)