Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vwbusguy opened this issue Jun 7, 2022 · 9 comments
Closed

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

vwbusguy opened this issue Jun 7, 2022 · 9 comments
Labels
1. Bug Something isn't working 2. Host Realm The issue is related to what happens on the host machine where Toolbox is executed 2. Under The Hood Multiple areas of the app are influenced by this ticket

Comments

@vwbusguy
Copy link

vwbusguy commented Jun 7, 2022

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,
        },
@vwbusguy vwbusguy added the 1. Bug Something isn't working label Jun 7, 2022
@vwbusguy
Copy link
Author

vwbusguy commented Jun 7, 2022

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

@HarryMichal HarryMichal added 2. Host Realm The issue is related to what happens on the host machine where Toolbox is executed 2. Under The Hood Multiple areas of the app are influenced by this ticket labels Jun 8, 2022
@vwbusguy
Copy link
Author

vwbusguy commented Jun 9, 2022

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

@vwbusguy vwbusguy changed the title RHEL7 environments not loaded due to ubi8 hard-coding RHEL7/9 environments not loaded due to ubi8 hard-coding Jun 14, 2022
@ClashTheBunny
Copy link
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...

@vwbusguy
Copy link
Author

vwbusguy commented Jun 21, 2022

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.

@debarshiray
Copy link
Member

debarshiray commented Jan 28, 2023

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.

@debarshiray
Copy link
Member

debarshiray commented Jan 28, 2023

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.

@vwbusguy
Copy link
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.

debarshiray added a commit to debarshiray/toolbox that referenced this issue Jan 29, 2023
debarshiray added a commit to debarshiray/toolbox that referenced this issue Jan 29, 2023
The URLs for the RHEL Toolbx images based on the Red Hat Universal Base
Images (or UBI) are a bit more complicated to construct, in comparison
to the URLs for Fedora's fedora-toolbox images.  It's not enough to just
concatenate the registry, the image's basename and the release.  Some
parts of the URL depend on the release's major number, which requires
custom code.

So far, the release's major number was hard coded to 8 since only RHEL 8
Toolbx containers were supported.

To support other RHEL major releases, it's necessary to have custom code
to construct the URLs for the Toolbx images.

containers#1065
debarshiray added a commit to debarshiray/toolbox that referenced this issue Jan 29, 2023
debarshiray added a commit to debarshiray/toolbox that referenced this issue Jan 29, 2023
The URLs for the RHEL Toolbx images based on the Red Hat Universal Base
Images (or UBI) are a bit more complicated to construct, in comparison
to the URLs for Fedora's fedora-toolbox images.  It's not enough to just
concatenate the registry, the image's basename and the release.  Some
parts of the URL depend on the release's major number, which requires
custom code.

So far, the release's major number was hard coded to 8 since only RHEL 8
Toolbx containers were supported.

To support other RHEL major releases, it's necessary to have custom code
to construct the URLs for the Toolbx images.

containers#1065
@debarshiray
Copy link
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.

@debarshiray
Copy link
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
Labels
1. Bug Something isn't working 2. Host Realm The issue is related to what happens on the host machine where Toolbox is executed 2. Under The Hood Multiple areas of the app are influenced by this ticket
Projects
None yet
Development

No branches or pull requests

4 participants