coreos / rpm-ostree

⚛📦 Hybrid image/package system with atomic upgrades and package layering
https://coreos.github.io/rpm-ostree
Other
856 stars 193 forks source link

Can't install local packages because of broken repo #4910

Open rrendec opened 5 months ago

rrendec commented 5 months ago

Describe the bug

I'm trying to install a bunch of local rpm packages using rpm-ostree install *.rpm. The installation fails with the error below.

# rpm-ostree install  *.rpm
Checking out tree bb6e714... done
Enabled rpm-md repositories: centos-automotive autosd baseos appstream osbuild extras-common
Updating metadata for 'osbuild'... done
error: Updating rpm-md repo 'osbuild': cannot update repo 'osbuild': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 404 for https://download.copr.fedorainfracloud.org/results/@osbuild/osbuild-stable/centos-stream-9-$arch/repodata/repomd.xml (IP: 13.226.34.103)

Reproduction steps

  1. System installed with rpm-ostree, but one of the repos that were used when the image was created no longer works.
  2. Attempt to install local packages using rpm-ostree install *.rpm.

Expected behavior

There should be a way to disable or remove the broken repo during installation, and then the installation should succeed. I did try a few things (see "additional information" below, but nothing worked).

Actual behavior

Installation fails with error:

error: Updating rpm-md repo 'osbuild': cannot update repo 'osbuild': Cannot download repomd.xml: ...

System details

# rpm-ostree --version 
rpm-ostree:
 Version: '2024.4'
 Git: 712c0f53ba61836457f64ccf1887feed31900c8d
 Features:
  - rust
  - compose
  - container

Additional information

I tried to add enabled=0 to the offending repo configuration in /etc/yum.repos.d/osbuild.repo. I also tried to remove the repo file altogether. Neither worked. Further (clumsy) investigation using strace revealed that rpm-ostree opens the repo file from /ostree/deploy/centos/deploy/bb6e714e25417374aa9d6b86f5e6c5e57a687b30cb120bcfab35ff6d7fbb6412.0/etc/yum.repos.d/osbuild.repo.

I also tried rpm-ostree reload and rpm-ostree refresh-md but neither helped. However, rpm-ostree refresh-md completed without errors, and the output suggests that the offending repo was omitted as expected:

# rpm-ostree refresh-md 
Enabled rpm-md repositories: autosd centos-automotive extras-common baseos appstream
Importing rpm-md... done
rpm-md repo 'autosd' (cached); generated: 2024-04-08T02:34:01Z solvables: 6426
rpm-md repo 'centos-automotive' (cached); generated: 2024-04-05T14:31:41Z solvables: 100
rpm-md repo 'extras-common' (cached); generated: 2024-04-04T11:36:58Z solvables: 77
rpm-md repo 'baseos' (cached); generated: 2024-04-08T14:23:36Z solvables: 3518
rpm-md repo 'appstream' (cached); generated: 2024-04-08T14:26:05Z solvables: 12668

However, running rpm-ostree install *.rpm again still insists on using the broken repo and fails.

rrendec commented 5 months ago

I found this workaround, which is good enough for my use case, since it's on a test system.

mount /sysroot/ -o remount,rw
rm /ostree/deploy/centos/deploy/bb6e714e25417374aa9d6b86f5e6c5e57a687b30cb120bcfab35ff6d7fbb6412.0/etc/yum.repos.d/osbuild.repo
mount /sysroot/ -o remount,ro
jlebon commented 5 months ago

If you have a pending deployment, it'll use that as the source of repo information.

So, try rpm-ostree cleanup -p first.