Skip to content

RHEL7/9 environments not loaded due to ubi8 hard-coding #1065

Closed

Description

@vwbusguy

Describe the bug
toolbox create --distro rhel --version 7.9 fails to pull the correct image base

Steps how to reproduce the behaviour

  1. podman login to redhat registries (this might be optional)
  2. Attempt to create a RHEL7 toolbox: toolbox create --distro rhel --version 7.9
  3. Mark Y to pull the image
  4. Note that it attempts to resolve the wrong image for this version of RHEL

Expected behaviour
It should pull from registry.access.redhat.com/ubi7/ubi:7.9

Actual behaviour
It attempts to pull from registry.access.redhat.com/ubi8/ubi:7.9

Screenshots

$ toolbox create --distro rhel  --release 7.9 rhel
Image required to create toolbox container.
Download registry.access.redhat.com/ubi8/ubi:7.9 (500MB)? [y/N]: y
Error: failed to pull image registry.access.redhat.com/ubi8/ubi:7.9

Output of toolbox --version (v0.0.90+)
toolbox version 0.0.99.3

Toolbox package info (rpm -q toolbox)
toolbox-0.0.99.3-4.fc36.x86_64

Output of podman version

$ podman version
Client:       Podman Engine
Version:      4.1.0
API Version:  4.1.0
Go Version:   go1.18
Built:        Fri May  6 09:15:54 2022
OS/Arch:      linux/amd64

Podman package info (rpm -q podman)
podman-4.1.0-1.fc36.x86_64

Info about your OS
Fedora Linux 36

Additional context
Documented my steps here on ask.fedoraproject.org, but I was able to get it to work by hacking src/pkg/util.go and overriding the rhel definition to work for 7.x and after compiling, it actually does work, however, this hack alone isn't sufficient since it's now hard-coded for EL7 instead of EL8.

        "rhel": {
            "rhel-toolbox",
            "ubi",
            parseReleaseRHEL,
            "<major.minor>",
            "registry.access.redhat.com",
            "ubi7",
            false,
        },

Activity

  1. added
    1. Bug
    on Jun 7, 2022
  2. vwbusguy commented on Jun 7, 2022

    @vwbusguy
    Author

    One further point - this EL8 hard-coding also impacts RHEL9 as well:

    $ toolbox create --distro rhel --release 9.0 rhel9
    Image required to create toolbox container.
    Download registry.access.redhat.com/ubi8/ubi:9.0 (500MB)? [y/N]: y
    Error: failed to pull image registry.access.redhat.com/ubi8/ubi:9.0
    
  3. added
    2. Host Realm
    2. Under The Hood
    on Jun 8, 2022
  4. vwbusguy commented on Jun 9, 2022

    @vwbusguy
    Author

    I don't see an obvious simple, elegant solution, but it should be possible to add some logic to intercept the RHEL image repo base and rewrite it to the correct major version at this point here: https://github.com/containers/toolbox/blob/main/src/pkg/utils/utils.go#L312

  5. changed the title [-]RHEL7 environments not loaded due to ubi8 hard-coding[/-] [+]RHEL7/9 environments not loaded due to ubi8 hard-coding[/+] on Jun 14, 2022
  6. ClashTheBunny commented on Jun 19, 2022

    @ClashTheBunny
    Contributor

    I think a better workaround than hacking utils.go would be to just specify the image, not that that fixes the problem...

    toolbox create --image registry.access.redhat.com/ubi7/ubi:7.9 rhel7
    
    toolbox create --image registry.access.redhat.com/ubi9/ubi:9.0 rhel7
    

    I can't test this, since it does need the login, but it does try to pull correctly:

    ❯ toolbox create --image registry.access.redhat.com/ubi9/ubi:9.0 rhel9
    Image required to create toolbox container.
    Download registry.access.redhat.com/ubi9/ubi:9.0 (500MB)? [y/N]: y
    Error: failed to pull image registry.access.redhat.com/ubi9/ubi:9.0
    If it was a private image, log in with: podman login registry.access.redhat.com
    Use 'toolbox --verbose ...' for further details.
    

    You may need to add the --authfile $XDG_RUNTIME_DIR/containers/auth.json option if podman isn't correctly logged in, but also, no way to test...

  7. vwbusguy commented on Jun 21, 2022

    @vwbusguy
    Author

    a better workaround

    Sure, I agree, but this image path is not obvious to the end user based on tool feedback, which is all the more complicated by this bug still being present in Fedora at the moment.

    If it's helpful, a free-as-in-coffee Red Hat Developer Sub should be sufficient for the login credentials to test.

  8. debarshiray commented on Jan 28, 2023

    @debarshiray
    Member

    Sorry about all the confusion here.

    The story is that the initial attempt to support RHEL Toolbx containers (ie., commit 21d25f8 or #667) using the base UBI image (ie., registry.access.redhat.com/ubi8) was 1.5 years before RHEL 9.0 was released in May 2022. That's why it didn't support RHEL 9. It also didn't support RHEL 7, because RHEL 7 was already too old at that point. It would be quite difficult to drive changes into the distribution for something fairly new like Toolbx to work (well) with it. Hence, the only supported version was RHEL 8.

    Back then we already knew that, just like the base registry.fedoraproject.org/fedora images, the base UBI image was not ideal for creating Toolbx containers, because it's optimized for deploying services running on servers, not for daily interactive use. eg., it doesn't have sudo(8).

    That's why, since then, we have put up Toolbx images that are still based on the UBI RPM repositories but are designed for daily interactive use with Toolbx. These are available for both RHELs 8 and 9 at registry.access.redhat.com/ubi8/toolbox and registry.access.redhat.com/ubi9/toolbox respectively. However, RHEL 7, continues to be unsupported due to its age.

    Neither of these images are part of a Toolbx release because they are relatively new. It took some time to work through the process to add some of the necessary packages to the UBI RPM repositories, then eventually the images themselves, and finally making sure that they are sufficiently tested. Although, astute observers will notice that @HarryMichal had added the Toolbx image for RHEL 8 in current Git main (ie., commit f456c17) in January 2022, but that was still almost half a year before RHEL 9.0 came out.

    Anyway, things have fairly settled down by now, so I feel confident about wiring the RHEL 9 image to the --distro flag too.

  9. debarshiray commented on Jan 28, 2023

    @debarshiray
    Member

    Note that none of these images should require any form of authentication. The images under registry.access.redhat.com should be publicly available.

    You don't even need the gratis RHEL Developer Suite to create the container, but you might need it later to unlock more content afterwards.

  10. vwbusguy commented on Jan 29, 2023

    @vwbusguy
    Author

    Note that none of these images should require any form of authentication. The images under registry.access.redhat.com should be publicly available.

    I'm curious when this change was made. It's certainly a welcome one.

  11. debarshiray commented on Jan 29, 2023

    @debarshiray
    Member

    Note that none of these images should require any form of authentication. The images under registry.access.redhat.com should be publicly available.

    I'm curious when this change was made. It's certainly a welcome one.

    It's been like this from the first time I started poking at UBI and the Red Hat OCI registries. The images on registry.access.redhat.com have always been public, but there's another registry at registry.redhat.io that requires authentication.

    Note that the toolbox image for RHEL 9.0 seems to be oddly tagged on the registry. It only has a 9.0.0 tag and no 9.0 tag, while both are present for the RHEL 9.1 image.

  12. debarshiray commented on Jan 29, 2023

    @debarshiray
    Member

    I have attempted to add support for RHEL 9 Toolbx containers in #1220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    1. Bug2. Host Realm2. Under The Hood

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions