How to get EL7 toolbox environment?

I’m trying to get an EL7 toolbox environment for some vendor related work that still depends on EL7 at the moment. Unfortunately, I’ve been unable to setup a RHEL or CentOS 7 toolbox environment from Fedora 36. If I specify --distro as RHEL, it doesn’t seem to grok any --release for it (7, EL7, 7Server, etc.). If I specify --distro centos --release 7, it almost works but seems to be trying and failing to pull Fedora 7 instead of CentOS 7:

$ toolbox create --distro centos --release 7 euca-tools
Image required to create toolbox container.
Download registry.fedoraproject.org/fedora-toolbox:7 (500MB)? [y/N]: y
Error: failed to pull image registry.fedoraproject.org/fedora-toolbox:7
If it was a private image, log in with: podman login registry.fedoraproject.org
Use 'toolbox --verbose ...' for further details.

If I specify CentOS 7 from quay.io with --image, the toolbox is created, but not useful as it is missing things like sudo, so I can’t install the software I’m trying to install interactively this way.

Is there a way to get a proper RHEL or CentOS 7 toolbox environment in Fedora 36?

It looks like the bug of it defaulting to fedora when --distro and --release are passed appears to have been fixed upstream but not released/packaged for Fedora yet, so that partially explains the weird behavior, but I’m still looking for a way to run an EL7 toolbox (RHEL or CentOS) in Fedora 36.

It looks like rhel/rhel-toolbox should be supported at least based on the upstream code and the current Silverblue Toolbox documentation (though I’m running Workstation here).

Going through the code a bit more, I finally got something that looked like it might work but it sadly fails pull/create the environment, even after logging into the redhat registry:

$ podman login registry.redhat.io
Username: <redacted>
Password: 
Login Succeeded!

$ 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
If it was a private image, log in with: podman login registry.access.redhat.com

So, getting a bit closer, but I’m guessing that the hard-coded ubi8 in the image definition for rhel might be an issue.

Well, I got something that almost works. I can get a RHEL7 toolbox by overriding the image to the UBI7, but unfortunately, sudo is still missing here, so we’re back to the same problem as the centos7 containers. Any obvious way to get sudo in here or do I need to make a custom image and add it?

[scott@samus ~]$ 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
If it was a private image, log in with: podman login registry.access.redhat.com
Use 'toolbox --verbose ...' for further details.
[scott@samus ~]$ toolbox create -i registry.access.redhat.com/ubi7/ubi:7.9 rhel
Image required to create toolbox container.
Download registry.access.redhat.com/ubi7/ubi:7.9 (500MB)? [y/N]: y
Created container: rhel
Enter with: toolbox enter rhel
[scott@samus ~]$ toolbox enter rhel
bash: /usr/lib/os-release: No such file or directory
⬢[scott@toolbox ~]$ yum install http://downloads.eucalyptus.cloud/software/euca2ools/3.4/rhel/7/x86_64/euca2ools-release-3.4-2.2.as.el7.noarch.rpm
Loaded plugins: ovl, product-id, search-disabled-repos, subscription-manager
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/Group'
You need to be root to perform this command.
⬢[scott@toolbox ~]$ sudo yum install http://downloads.eucalyptus.cloud/software/euca2ools/3.4/rhel/7/x86_64/euca2ools-release-3.4-2.2.as.el7.noarch.rpm
bash: sudo: command not found

OK, I got it to work.

I checked out the toolbox repo and updated the RHEL definition in src/pkg/utils.go:

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

Then built it locally with meson/ninja and created the toolbox with it:

$ src/toolbox create --distro rhel --release 7.9 rhel7
Created container: rhel7
Enter with: toolbox enter rhel7

sudo isn’t in it, but su - works to get root, so I installed sudo from there and dropped back to regular user and installed the vendor client normally from there.

I submitted an issue upstream with toolbox to get this to work without having to do all this mess.

1 Like

You could also consider to use another tool: Distrobox.

There is an article on Fedora Magazine Run Distrobox on Fedora Linux - Fedora Magazine

The package is now available in the Fedora repository.

3 Likes