Description of problem: The toolbox command always ignores [command] the first time. Version-Release number of selected component (if applicable): toolbox-0.0.8-3.rhaos4.8.el8.noarch How reproducible: The first time: ``` sh-4.4# toolbox ls # <== add `ls` Trying to pull registry.redhat.io/rhel8/support-tools:latest... Getting image source signatures Checking if image destination supports signatures Copying blob adffa6963146 done Copying blob 29bfe07dbe66 done Copying blob 26f1167feaf7 done Copying config e0a3910607 done Writing manifest to image destination Storing signatures e0a3910607766bb10a9d84a0223db78d9856407e34af50a4f8fc0587c6c041a9 Spawning a container 'toolbox-root' with image 'registry.redhat.io/rhel8/support-tools' Detected RUN label in the container image. Using that as the default... [root@master-1 /]# # <== ls will not run [root@master-1 /]# [root@master-1 /]# exit ``` From the second time onwards: ``` sh-4.4# sh-4.4# toolbox ls Container 'toolbox-root' already exists. Trying to start... (To remove the container and start with a fresh toolbox, run: sudo podman rm 'toolbox-root') toolbox-root Container started successfully. To exit, type 'exit'. bin boot dev etc home host lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var sh-4.4# ``` Steps to Reproduce: 1. Execute it with the [command] option on the node that has never started toolbox. Actual results: The toolbox command always ignores [command] the first time. Expected results: The [command] is executed even at the first time. Additional info: There are no notes in the --help: ``` sh-4.4# toolbox --help USAGE: toolbox [-h/--help] [command] toolbox is a small script that launches a container to let you bring in your favorite debugging or admin tools. The toolbox container is a pet container and will be restarted on following runs. To remove the container and start fresh, do sudo podman rm toolbox-root. ``` The case where [command] is executed is the pattern that through container_exec(), but it is not executed because it through only container_runlabel() at the first time. https://github.com/coreos/toolbox/blob/0.0.8/rhcos-toolbox ``` run() { if ! image_exists; then image_pull fi local runlabel=$(image_runlabel) if ! container_exists; then echo "Spawning a container '$TOOLBOX_NAME' with image '$TOOLBOX_IMAGE'" if [[ -z "$runlabel" ]] || [[ "$runlabel" == "<no value>" ]]; then container_run return else echo "Detected RUN label in the container image. Using that as the default..." container_runlabel <== here return fi else echo "Container '$TOOLBOX_NAME' already exists. Trying to start..." echo "(To remove the container and start with a fresh toolbox, run: sudo podman rm '$TOOLBOX_NAME')" fi local state=$(container_state) if [[ "$state" == configured ]] || [[ "$state" == exited ]] || [[ "$state" == stopped ]]; then container_start elif [[ "$state" != running ]]; then echo "Container '$TOOLBOX_NAME' in unknown state: '$state'" return 1 fi echo "Container started successfully. To exit, type 'exit'." container_exec "$@" } ``` ``` container_runlabel() { if ! sudo podman container runlabel --name "$TOOLBOX_NAME" RUN "$TOOLBOX_IMAGE" 2>&1; then echo "$0: failed to runlabel on image '$TOOLBOX_IMAGE'" exit 1 fi } ``` ``` container_exec() { local cmd=$@ if [ ! -n "$cmd" ]; then cmd=$(sudo podman inspect "$TOOLBOX_IMAGE" | jq -re ".[].Config.Cmd[0]") || cmd="/bin/sh" fi sudo podman exec \ --env LANG="$LANG" \ --env TERM="$TERM" \ --tty \ --interactive \ "$TOOLBOX_NAME" \ "$cmd" <== here } ```
The toolbox command issue has been fixed and merged PR - https://github.com/coreos/toolbox/pull/75
@aaradhak As you've made a new toolbox release with this PR merged and backported this change to 4.9 and up, this should have been updated to MODIFIED.
Get fixed toolbox-0.0.9-1.rhaos4.11.el8.noarch.rpm from: https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=2020320 Verify passed with rhcos-411.85.202206032330-0-qemu.x86_64.qcow2 (include fixed toolbox), can reproduce the problem with toolbox-0.0.8-4.rhaos4.11.el8.noarch [core@cosa-devsh ~]$ rpm -q toolbox toolbox-0.0.9-1.rhaos4.11.el8.noarch [core@cosa-devsh ~]$ toolbox ls Trying to pull registry.redhat.io/rhel8/support-tools:latest... Getting image source signatures Checking if image destination supports signatures Copying blob cae7320018ab done Copying blob 545277d80005 done Copying blob f70d60810c69 done Copying config a8419564b7 done Writing manifest to image destination Storing signatures a8419564b7cc1417d26300d4560ce5812dccaee0c5ec88e22956ad5e67b32037 Spawning a container 'toolbox-core' with image 'registry.redhat.io/rhel8/support-tools' Detected RUN label in the container image. Using that as the default... 93fed46f36ad58e5bb9cb52ccbf397a1b7105cdd0a22f4dc54be37c565e0388e toolbox-core bin boot dev etc home host lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:5069