systemd / mkosi

💽 Build Bespoke OS Images
https://mkosi.systemd.io/
1.15k stars 310 forks source link

DNF5 says no cache for "fedora" even though cache is enabled #2387

Closed septatrix closed 7 months ago

septatrix commented 7 months ago

When trying to build my image I get the following error:

Updating and loading repositories:
Cache-only enabled but no cache for repository "fedora"
‣ "env HOME=/ dnf5 --assumeyes --best --releasever=39 --installroot=/home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root --setopt=keepcache=1 --setopt=logdir=/var/log --setopt=cachedir=/var/cache/libdnf5 --setopt=persistdir=/var/lib/libdnf5 --setopt=install_weak_deps=0 --setopt=check_config_file_age=0 '--disable-plugin=*' --enable-plugin=builddep --setopt=debuglevel=10 --setopt=metadata_expire=never --setopt=cacheonly=metadata --use-host-config install dbus e2fsprogs gstreamer1-plugins-bad-free-extras gstreamer1-plugins-good gstreamer1-vaapi htop intel-media-driver iproute iputils iwd iwlwifi-dvm-firmware kernel-core kernel-modules less libbpf libva mesa-va-drivers mesa-vulkan-drivers nano node-exporter openssh-server openvpn python3 python3-dateutil python3-httpx python3-icalendar python3-pydantic systemd systemd-boot systemd-container systemd-networkd systemd-resolved systemd-udev tpm2-tss udev urw-base35-nimbus-roman-fonts weston zram-generator zram-generator-defaults /etc/mime.types" returned non-zero exit code 1.

Executed command from the debug output:

‣ + sh -c 'trap '"'"'rm -rf /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/tmp/mkosi-var-tmp-c6e2d2bcbfee4c97'"'"' EXIT && mkdir --mode 1777 /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/tmp/mkosi-var-tmp-c6e2d2bcbfee4c97 && $0 "$@"' bwrap --ro-bind /home/septatrix/Documents/Simply5/programming/digital-signage-linux/mkosi.output/fedora-tools/usr /usr --die-with-parent --proc /proc --setenv SYSTEMD_OFFLINE 1 --unsetenv TMPDIR --tmpfs /tmp --unshare-ipc --dev /dev --bind /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/tmp/mkosi-var-tmp-c6e2d2bcbfee4c97 /var/tmp --symlink usr/bin /bin --symlink usr/sbin /sbin --symlink usr/lib /lib --symlink usr/lib64 /lib64 --setenv PATH :/usr/bin:/usr/sbin --bind /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/pkgmngr/etc/yum.repos.d /etc/yum.repos.d --bind /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/pkgmngr/etc/dnf /etc/dnf --bind /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/pkgmngr/etc/rpm /etc/rpm --bind /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root --ro-bind /home/septatrix/Documents/Simply5/programming/digital-signage-linux/mkosi.output/fedora-tools/etc/crypto-policies /etc/crypto-policies --ro-bind /home/septatrix/Documents/Simply5/programming/digital-signage-linux/mkosi.output/fedora-tools/etc/pacman.d/gnupg /etc/pacman.d/gnupg --ro-bind /home/septatrix/Documents/Simply5/programming/digital-signage-linux/mkosi.output/fedora-tools/etc/pki /etc/pki --ro-bind /home/septatrix/Documents/Simply5/programming/digital-signage-linux/mkosi.output/fedora-tools/etc/ssl /etc/ssl --bind /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/packages /work/packages --bind /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/var/cache/libdnf5 /var/cache/libdnf5 --bind '/home/septatrix/.cache/mkosi/fedora~39~x86-64/cache/libdnf5/fedora-ffabc111530caf27/packages' /var/cache/libdnf5/fedora-ffabc111530caf27/packages --bind '/home/septatrix/.cache/mkosi/fedora~39~x86-64/cache/libdnf5/copr:copr.fedorainfracloud.org:philn:wpewebkit-0696373d83189b8c/packages' /var/cache/libdnf5/copr:copr.fedorainfracloud.org:philn:wpewebkit-0696373d83189b8c/packages --bind '/home/septatrix/.cache/mkosi/fedora~39~x86-64/cache/libdnf5/rpmfusion-nonfree-b12710c2dd9d3ae4/packages' /var/cache/libdnf5/rpmfusion-nonfree-b12710c2dd9d3ae4/packages --bind '/home/septatrix/.cache/mkosi/fedora~39~x86-64/cache/libdnf5/updates-bd3073827cb7bdf8/packages' /var/cache/libdnf5/updates-bd3073827cb7bdf8/packages --bind /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/var/lib/libdnf5 /var/lib/libdnf5 --dir /work/src --bind /home/septatrix/Documents/Simply5/programming/digital-signage-mkosi-copy /work/src/digital-signage --chdir /work/src --bind /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/pkgmngr/var/log /var/log --symlink ../proc/self/mounts /etc/mtab --ro-bind /home/septatrix/Documents/Simply5/programming/digital-signage-linux/mkosi.output/fedora-tools/etc/alternatives /etc/alternatives --bind /etc/resolv.conf /etc/resolv.conf sh -c 'chmod 1777 /dev/shm && chmod 755 /etc && exec $0 "$@"' bwrap --dev-bind / / --tmpfs /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/run --tmpfs /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/tmp --bind /var/tmp /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/var/tmp --proc /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/proc --dev /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/dev --ro-bind-try /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/etc/machine-id /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/etc/machine-id --ro-bind-try /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/etc/passwd /etc/passwd --ro-bind-try /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/etc/group /etc/group --ro-bind-try /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/etc/shadow /etc/shadow --ro-bind-try /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/etc/gshadow /etc/gshadow sh -c 'chmod 1777 /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/tmp /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/var/tmp /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/dev/shm && chmod 755 /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/run && mkdir -m 755 /home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/run/host && echo mkosi >/home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root/run/host/container-manager && exec $0 "$@"' env HOME=/ dnf5 --assumeyes --best --releasever=39 --installroot=/home/septatrix/.cache/mkosi/mkosi-workspaceq6egm5ib/root --setopt=keepcache=1 --setopt=logdir=/var/log --setopt=cachedir=/var/cache/libdnf5 --setopt=persistdir=/var/lib/libdnf5 --setopt=install_weak_deps=0 --setopt=check_config_file_age=0 '--disable-plugin=*' --enable-plugin=builddep --setopt=debuglevel=10 --setopt=metadata_expire=never --setopt=cacheonly=metadata --use-host-config install dbus e2fsprogs gstreamer1-plugins-bad-free-extras gstreamer1-plugins-good gstreamer1-vaapi htop intel-media-driver iproute iputils iwd iwlwifi-dvm-firmware kernel-core kernel-modules less libbpf libva mesa-va-drivers mesa-vulkan-drivers nano node-exporter openssh-server openvpn python3 python3-dateutil python3-httpx python3-icalendar python3-pydantic systemd systemd-boot systemd-container systemd-networkd systemd-resolved systemd-udev tpm2-tss udev urw-base35-nimbus-roman-fonts weston zram-generator zram-generator-defaults /etc/mime.types

Normal output of the run excluding build of the tools tree:

‣ Building DSPlayerOS image
‣  Syncing package manager metadata for DSPlayerOS image
Create subvolume '/home/septatrix/.cache/mkosi/mkosi-workspace0hbjmdnb/root'
‣   Copying in package manager file trees…
Updating and loading repositories:
 fedora                                                                                                      100% | 172.4 KiB/s |  23.3 KiB |  00m00s
 Copr repo for wpewebkit owned by philn                                                                      100% |   5.5 KiB/s |   1.5 KiB |  00m00s
 RPM Fusion for Fedora 39 - Nonfree                                                                          100% |  35.8 KiB/s |   6.6 KiB |  00m00s
 updates                                                                                                     100% | 125.0 KiB/s |  20.6 KiB |  00m00s
Repositories loaded.
Metadata cache created.
‣   Fixing ownership of package manager cache directory
Create subvolume '/home/septatrix/.cache/mkosi/mkosi-workspacei4u86e77/root'
‣  Copying in package manager file trees…
‣  Copying in skeleton file trees…
‣  Installing Fedora
Updating and loading repositories:
Repositories loaded.
Package                                           Arch         Version                                           Repository                      Size
Installing:                                                                                                                                          
 filesystem                                       x86_64       3.18-6.fc39                                       fedora                     106.0   B
Installing dependencies:                                                                                                                             
 fedora-gpg-keys                                  noarch       39-1                                              fedora                     123.2 KiB
 fedora-release                                   noarch       39-34                                             updates                      0.0   B
 fedora-release-common                            noarch       39-34                                             updates                     18.9 KiB
 fedora-release-identity-basic                    noarch       39-34                                             updates                    666.0   B
 fedora-repos                                     noarch       39-1                                              fedora                       4.5 KiB
 setup                                            noarch       2.14.4-1.fc39                                     fedora                     720.3 KiB

Transaction Summary:
 Installing:        7 packages

Total size of inbound packages is 1 MiB. Need to download 0 B.
After this operation 868 KiB will be used (install 868 KiB, remove 0 B).
[1/7] filesystem-0:3.18-6.fc39.x86_64                                                                        100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
[2/7] setup-0:2.14.4-1.fc39.noarch                                                                           100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
[3/7] fedora-release-0:39-34.noarch                                                                          100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
[4/7] fedora-release-common-0:39-34.noarch                                                                   100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
[5/7] fedora-repos-0:39-1.noarch                                                                             100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
[6/7] fedora-gpg-keys-0:39-1.noarch                                                                          100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
[7/7] fedora-release-identity-basic-0:39-34.noarch                                                           100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
-----------------------------------------------------------------------------------------------------------------------------------------------------
[7/7] Total                                                                                                  100% |   0.0   B/s |   0.0   B |  00m00s
Running transaction
Importing PGP key 0x18B8E74C:
 Userid     : "Fedora (39) <fedora-39-primary@fedoraproject.org>"
 Fingerprint: E8F23996F23218640CB44CBE75CF5AC418B8E74C
 From       : file:///usr/share/distribution-gpg-keys/fedora/RPM-GPG-KEY-fedora-39-primary
The key was successfully imported.
[1/9] Verify package files                                                                                   100% |  40.0   B/s |   7.0   B |  00m00s
>>> Running pre-transaction scriptlet: filesystem-0:3.18-6.fc39.x86_64
>>> Stop pre-transaction scriptlet: filesystem-0:3.18-6.fc39.x86_64
[2/9] Prepare transaction                                                                                    100% | 700.0   B/s |   7.0   B |  00m00s
[3/9] Installing fedora-release-identity-basic-0:39-34.noarch                                                100% |  90.2 KiB/s | 924.0   B |  00m00s
[4/9] Installing fedora-gpg-keys-0:39-1.noarch                                                               100% |  12.6 MiB/s | 167.6 KiB |  00m00s
[5/9] Installing fedora-repos-0:39-1.noarch                                                                  100% |   5.2 MiB/s |   5.3 KiB |  00m00s
[6/9] Installing fedora-release-common-0:39-34.noarch                                                        100% |   7.5 MiB/s |  23.1 KiB |  00m00s
[7/9] Installing fedora-release-0:39-34.noarch                                                               100% | 121.1 KiB/s | 124.0   B |  00m00s
[8/9] Installing setup-0:2.14.4-1.fc39.noarch                                                                100% |  64.4 MiB/s | 725.7 KiB |  00m00s
>>> Running post-install scriptlet: setup-0:2.14.4-1.fc39.noarch
>>> Stop post-install scriptlet: setup-0:2.14.4-1.fc39.noarch
[9/9] Installing filesystem-0:3.18-6.fc39.x86_64                                                             100% |   3.8 MiB/s | 212.4 KiB |  00m00s
>>> Running post-transaction scriptlet: filesystem-0:3.18-6.fc39.x86_64
>>> Stop post-transaction scriptlet: filesystem-0:3.18-6.fc39.x86_64
Updating and loading repositories:
Cache-only enabled but no cache for repository "fedora"
‣ "env HOME=/ dnf5 --assumeyes --best --releasever=39 --installroot=/home/septatrix/.cache/mkosi/mkosi-workspacei4u86e77/root --setopt=keepcache=1 --setopt=logdir=/var/log --setopt=cachedir=/var/cache/libdnf5 --setopt=persistdir=/var/lib/libdnf5 --setopt=install_weak_deps=0 --setopt=check_config_file_age=0 '--disable-plugin=*' --enable-plugin=builddep --setopt=metadata_expire=never --setopt=cacheonly=metadata --use-host-config install dbus e2fsprogs gstreamer1-plugins-bad-free-extras gstreamer1-plugins-good gstreamer1-vaapi htop intel-media-driver iproute iputils iwd iwlwifi-dvm-firmware kernel-core kernel-modules less libbpf libva mesa-va-drivers mesa-vulkan-drivers nano node-exporter openssh-server openvpn python3 python3-dateutil python3-httpx python3-icalendar python3-pydantic systemd systemd-boot systemd-container systemd-networkd systemd-resolved systemd-udev tpm2-tss udev urw-base35-nimbus-roman-fonts weston zram-generator zram-generator-defaults /etc/mime.types" returned non-zero exit code 1.
‣  (Fixing ownership of package manager cache directory)

When I set MKOSI_DNF=dnf it seems to work.


Continuing an incremental build after the first half was build with MKOSI_DNF, afterwards one gets:

FileNotFoundError: [Errno 2] No such file or directory: '/home/septatrix/.cache/mkosi/mkosi-workspacejlmg7o94/root/var/cache/libdnf5'

This happens during the build step so I guess this is missing some kind of warning that switching the DNF backend for an incremental build is buggy. Regardless, this seems unrelated to the original bug and usually people should not have to tinker with MKOSI_DNF. I just happen to run around this unexpected interaction whlie trying to find out what the hell was going on.

DaanDeMeyer commented 7 months ago

@septatrix The MKOSI_DNF issue should be fixed by #2388

The other issue that you're running into is probably https://bugzilla.redhat.com/show_bug.cgi?id=2263771. Check if you're using paths in your package lists somewhere and change them to be the actual package name.

septatrix commented 7 months ago

@septatrix The MKOSI_DNF issue should be fixed by #2388

Yes that seem to have resolved that issue.

The other issue that you're running into is probably https://bugzilla.redhat.com/show_bug.cgi?id=2263771. Check if you're using paths in your package lists somewhere and change them to be the actual package name.

Indeed, I am using /etc/mime.types instead of the more obscure mailcap (as that file is all I need from that package) but the latter will do for now.

DaanDeMeyer commented 7 months ago

Ah any path outside of /usr/bin and /usr/sbin requires the filelists metadata, which is huge so dnf5 doesn't download it anymore by default. So don't use file paths unless they're in those locations (and don't use those either until that dnf5 bug is fixed).