containers / toolbox

Tool for interactive command line environments on Linux
https://containertoolbx.org/
Apache License 2.0
2.54k stars 217 forks source link

fedora 37 image doesn't build #1222

Closed akdev1l closed 1 year ago

akdev1l commented 1 year ago

Describe the bug

Fedora 37 image doesn't build

$ podman build . --pull
STEP 1/15: FROM registry.fedoraproject.org/fedora:37
Trying to pull registry.fedoraproject.org/fedora:37...
Getting image source signatures
Copying blob 1842e4e4b562 skipped: already exists  
Copying config 19c0ae4dd2 done  
Writing manifest to image destination
Storing signatures
STEP 2/15: ENV NAME=fedora-toolbox VERSION=37
--> Using cache b6e479217ad9657dfffc3ea0a97066cd76b24bd6c6f249c9870a3f3ca1e0db78
--> b6e479217ad
STEP 3/15: LABEL com.github.containers.toolbox="true"       com.redhat.component="$NAME"       name="$NAME"       version="$VERSION"       usage="This image is meant to be used with the toolbox command"       summary="Base image for creating Fedora toolbox containers"       maintainer="Debarshi Ray <rishi@fedoraproject.org>"
--> Using cache 1dc4603185bc8af9cf078fc6eb8a6e6af365206de3f66623c01cd0bd2ad96d9a
--> 1dc4603185b
STEP 4/15: COPY README.md /
--> Using cache e7be47a3e1d70636e413bd90924815930d808ad0536ac2b6c80b5387755a516d
--> e7be47a3e1d
STEP 5/15: RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
--> Using cache 73faf712e069d404e29376d405d81cc90740ffee5e6bcbc024e2119fde97dcfc
--> 73faf712e06
STEP 6/15: RUN dnf -y swap coreutils-single coreutils-full
--> Using cache 536a5df240035b78c2d311e5abbf3007f7da7b6be59fd42e72546ffd266dd0bf
--> 536a5df2400
STEP 7/15: RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
--> Using cache c9a646ec7729e06f780b5a030b70812ce84efdb2fb9e1a17d6653dc522895515
--> c9a646ec772
STEP 8/15: RUN rm /etc/rpm/macros.image-language.conf
rm: cannot remove '/etc/rpm/macros.image-language.conf': No such file or directory
Error: building at STEP "RUN rm /etc/rpm/macros.image-language.conf": while running runtime: exit status 1

Steps how to reproduce the behaviour

  1. git clone https://github.com/containers/toolbox.git at commit 825c7e8 .github/workflows: Remove golangci-lint
  2. cd images/fedora/f37
  3. podman build . --pull
  4. See error

Expected behaviour

The image should build successfully.

Actual behaviour

STEP 8/15: RUN rm /etc/rpm/macros.image-language.conf
rm: cannot remove '/etc/rpm/macros.image-language.conf': No such file or directory
Error: building at STEP "RUN rm /etc/rpm/macros.image-language.conf": while running runtime: exit status 1

Podman package info (rpm -q podman)

podman --version
podman version 4.3.1

Info about your OS Fedora Silverblue 37 - don't think it matters because the container should build on any host with podman

Additional context

Seems introduced by:

commit f5388cfc0694ba3e6911bddf0191afa74c0a8b1a
Author: Nieves Montero <nmontero@redhat.com>
Date:   Wed Oct 19 13:13:00 2022 +0200

    Add corrections to avoid duplicate packages

    The following lines have been added to the fedora 37 and 38 images:
    RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
    RUN rm /etc/rom/macros.image-language.conf
    These two lines avoid redundant packages inside the images.

    https://github.com/containers/toolbox/issues/1136
    https://github.com/containers/toolbox/issues/1137

    Signed-off-by: Nieves Montero <nmontero@redhat.com>

Perhaps a change that should've only affected F38? Fedora 37 doesn't seem to know anything about that file we are trying to remove:

$ podman run --rm -it -v ~/.local/dnf:/var/cache/dnf --security-opt label=disable fedora:37 dnf --refresh whatprovides /etc/rpm/macros.image-language.conf
Fedora 37 - x86_64                                                                                                                                             64 kB/s |  22 kB     00:00    
Fedora 37 openh264 (From Cisco) - x86_64                                                                                                                      7.7 kB/s | 989  B     00:00    
Fedora Modular 37 - x86_64                                                                                                                                     61 kB/s |  22 kB     00:00    
Fedora 37 - x86_64 - Updates                                                                                                                                  135 kB/s |  23 kB     00:00    
Fedora Modular 37 - x86_64 - Updates                                                                                                                          135 kB/s |  23 kB     00:00    
Error: No matches found. If searching for a file, try specifying the full path or using a wildcard prefix ("*/") at the beginning.

fwiw I tried fedora 38 and it doesn't recognize that file:

$ podman run --rm -it --security-opt label=disable fedora:38 dnf --refresh whatprovides /etc/rpm/macros.image-language.conf 
Resolved "fedora" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull registry.fedoraproject.org/fedora:38...
Getting image source signatures
Copying blob da388e270dd2 done  
Copying config f98312da79 done  
Writing manifest to image destination
Storing signatures
Fedora rawhide openh264 (From Cisco) - x86_64                                                                                                                 2.9 kB/s | 2.5 kB     00:00    
Fedora - Rawhide - Developmental packages for the next Fedora release                                                                                          39 MB/s |  65 MB     00:01    
Fedora - Modular Rawhide - Developmental packages for the next Fedora release                                                                                 3.0 MB/s | 2.3 MB     00:00    
Error: No matches found. If searching for a file, try specifying the full path or using a wildcard prefix ("*/") at the beginning.

linked issue: https://github.com/containers/toolbox/issues/1136 suggest this was to install all languages in the container image but I don't see that file in the fedora images either:

$ podman run --rm -it fedora:37
[root@923c7b1186fe /]# find . -type f -name 'macros.image-language.conf'
find: ‘./proc/tty/driver’: Permission denied
$ podman run --rm -it fedora:38
[root@8a047abbb5d5 /]# find . -type f -name 'macros.image-language.conf'
find: ‘./proc/tty/driver’: Permission denied
akdev1l commented 1 year ago

this also seems to affect the f38 image, maybe that file was there before but it's not there now.

this fixes the issue:

diff --git a/images/fedora/f37/Containerfile b/images/fedora/f37/Containerfile
index 2a9a001..a1c0f93 100644
--- a/images/fedora/f37/Containerfile
+++ b/images/fedora/f37/Containerfile
@@ -14,7 +14,6 @@ COPY README.md /
 RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
 RUN dnf -y swap coreutils-single coreutils-full
 RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
-RUN rm /etc/rpm/macros.image-language.conf

 COPY missing-docs /
 RUN dnf -y reinstall $(<missing-docs)
diff --git a/images/fedora/f38/Containerfile b/images/fedora/f38/Containerfile
index 897500a..34264a6 100644
--- a/images/fedora/f38/Containerfile
+++ b/images/fedora/f38/Containerfile
@@ -14,7 +14,6 @@ COPY README.md /
 RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
 RUN dnf -y swap coreutils-single coreutils-full
 RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
-RUN rm /etc/rpm/macros.image-language.conf

 COPY missing-docs /
 RUN dnf -y reinstall $(<missing-docs)
debarshiray commented 1 year ago

Thanks for pointing this out, @akdev1l I happened to notice it an hour ago when playing with the Containerfile:s, but hadn't noticed this issue yet.

This was fixed in commit 42dbd8e18261f427bfd5ca3f0b652194bfbbe593 which is part of https://github.com/containers/toolbox/pull/1225

debarshiray commented 1 year ago

We really should extend our CI to build images from the image definitions and use them, in addition to the images that are already out there on the registries.