Toolbox: failed to create /run/.toolboxenv

Created on 29 Sep 2019  路  15Comments  路  Source: containers/toolbox

Steps to reproduce:

$ toolbox create --image docker.io/kalilinux/kali-linux-docker:latest
Image required to create toolbox container.
Download docker.io/kalilinux/kali-linux-docker:latest (500MB)? [y/N]: y
Created container: kali-linux-docker-latest
Enter with: toolbox enter --container kali-linux-docker-latest
$ toolbox enter --container kali-linux-docker-latest
toolbox: failed to create /run/.toolboxenv in container kali-linux-docker-latest
1. Bug

Most helpful comment

I extended README.md in https://github.com/containers/toolbox/pull/300 to cover distro support and how to create custom images.

All 15 comments

I don't think toolbox currently works OOTB with any other images than fedora-toolbox though icbw.
Certainly more OS's could be supported and patches would be welcome I think.

oh right. Might be worth recommending an update to the README

I have read comments (examples: [1], [2]) suggesting it is possible to use other images; but my attempts fail with this same error, both on toolbox-0.0.14-1.fc30.noarch and a checkout from master:

git clone [email protected]:containers/toolbox.git
cd toolbox
./toolbox create --image docker.io/library/debian:buster
$ ./toolbox enter --container debian-buster
toolbox: failed to create /run/.toolboxenv in container debian-buster


Same command above with verbose output

$ ./toolbox -v enter --container debian-buster
toolbox: running as real user ID 1000
toolbox: resolved absolute path for ./toolbox to /var/home/maxwell-k/toolbox/toolbox
toolbox: checking if /etc/subgid and /etc/subuid have entries for user maxwell-k
toolbox: TOOLBOX_PATH is /var/home/maxwell-k/toolbox/toolbox
toolbox: migration not needed: 1.5.1 is unchanged
toolbox: Fedora generational core is f30
toolbox: base image is fedora-toolbox:30
toolbox: container is debian-buster
toolbox: checking if container debian-buster exists
toolbox: calling org.freedesktop.Flatpak.SessionHelper.RequestSession
toolbox: starting container debian-buster
toolbox: /etc/profile.d/toolbox.sh already mounted in container debian-buster
Error: cannot exec into container that is not running: container state improper
toolbox: failed to create /run/.toolboxenv in container debian-buster

$ git rev-parse HEAD
9474bf35489b488605c5d40f16b1438d4436ba2d

I don't know what causes the Error: cannot exec into container that is not running: container state improper just before toolbox: failed to create /run/.toolboxenv...

After debugging a bit same error on different image on IRC, this error may potentially be a red herring. I would suggest doing "podman logs containername" to try to get more output.

Thank you! Running the same commands as before, and looking at the logs, I get:

$ git rev-parse HEAD
4d03cc6eb85ebbcab733e9422fecc46730a018b5
$ podman logs debian-buster
toolbox: running as real user ID 0
toolbox: resolved absolute path for /usr/bin/toolbox to /usr/bin/toolbox
toolbox: TOOLBOX_PATH is /var/home/maxwell-k/toolbox/toolbox
toolbox: creating /run/.toolboxenv
toolbox: redirecting /etc/host.conf to /run/host/etc/host.conf
toolbox: redirecting /etc/hosts to /run/host/etc/hosts
unlink: cannot unlink 'hosts': No such file or directory
toolbox: failed to redirect /etc/hosts to /run/host/etc/hosts

Is that where you're going with #294 ?

What is the right IRC channel for this project? I might be able to help debugging.

It's probably not right in general but Silverblue's channel is the place where I have been asking questions about Toolbox. My hunch here is the container is failing to start at all. The image in my case works when I play with it directly with podman so working hypothesis is Toolbox has some unintended expectations about what the image is supposed to look like. Yes, the PR is an example but I don't yet know if it fixes this.

Oh, it's a different file it's failing to unlink for you than me. For me it was host.conf, for you it's hosts. I think both are optional.

I extended README.md in https://github.com/containers/toolbox/pull/300 to cover distro support and how to create custom images.

I extended README.md in #300 to cover distro support and how to create custom images.

That has cleared everything up for me. the official kali linux container doesn't come with sudo installed.

I think that the original failed to create /run/.toolboxenv ... problem is either a Podman bug or related to the problem https://github.com/containers/toolbox/pull/305 tried to fix, but likely unrelated to distro support.

I'd encourage you to try Toolbox 0.0.16.

I got this error today, after doing dnf upgrade inside toolbox and exiting the toolbox.
Here are the errors from dnf upgrade:

...
  Running scriptlet: crypto-policies-20191128-2.gitcd267a5.fc31.noarch                                                                                                                                                                324/326 
warning: %posttrans(crypto-policies-20191128-2.gitcd267a5.fc31.noarch) scriptlet failed, signal 11                                                                                                                                            

Error in POSTTRANS scriptlet in rpm package crypto-policies                                                                                                                                                                                   
  Running scriptlet: tzdata-2019c-1.fc31.noarch                                                                                                                                                                                       324/326 
warning: %triggerin(man-db-2.8.4-5.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                                   

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerin(desktop-file-utils-0.24-1.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                        

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerpostun(glibc-common-2.30-10.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                         

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerpostun(man-db-2.8.4-5.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                               

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerpostun(desktop-file-utils-0.24-1.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                    

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerpostun(glib2-2.62.4-2.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                               

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerpostun(glib2-2.62.4-2.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                               

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerpostun(shared-mime-info-1.15-1.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                      

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerpostun(adwaita-icon-theme-3.34.3-1.fc31.noarch) scriptlet failed, signal 11                                                                                                                                                  

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerpostun(vim-common-2:8.2.236-1.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                       

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerpostun(gtk3-3.24.13-1.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                               

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerin(glibc-common-2.30-10.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                             

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerin(glib2-2.62.4-2.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                                   

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerin(glib2-2.62.4-2.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                                   

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerin(shared-mime-info-1.15-1.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                          

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerin(adwaita-icon-theme-3.34.3-1.fc31.noarch) scriptlet failed, signal 11                                                                                                                                                      

Error in <unknown> scriptlet in rpm package tzdata                                                                                                                                                                                            
warning: %triggerin(vim-common-2:8.2.236-1.fc31.x86_64) scriptlet failed, signal 11                                                                                                                                                           

Error in <unknown> scriptlet in rpm package tzdata 

...
Failed:                                                                                                                                                                                                                                       
  unbound-libs-1.9.6-1.fc31.x86_64  trousers-0.3.13-13.fc31.x86_64             dnf-4.2.9-5.fc31.noarch  iputils-20190515-3.fc31.x86_64  sssd-client-2.2.2-1.fc31.x86_64  systemd-243.7-1.fc31.x86_64  systemd-243-4.gitef67743.fc31.x86_64    
  systemd-udev-243.7-1.fc31.x86_64  systemd-udev-243-4.gitef67743.fc31.x86_64                                                                                                                                                                 

Error: Transaction failed                                                                                                                                                                                                                     
fish: Job 5, 'command git rev-parse --show-...' terminated by signal SIGSEGV (Address boundary error)                                                                                                                                         
fish: Job 3, 'date $theme_date_format' terminated by signal SIGSEGV (Address boundary error)                                                                                                                                                  

I wanted to install another package after the error above and dnf install just printed:

fish: 'sudo dnf install rpm2cpio' terminated by signal SIGSEGV (Address boundary error)                                                                                                                                                       
fish: Job 5, 'command git rev-parse --show-...' terminated by signal SIGSEGV (Address boundary error)                                                                                                                                         
fish: Job 3, 'date $theme_date_format' terminated by signal SIGSEGV (Address boundary error)       

After exiting from the toolbox and trying toolbox enter again, I got the error in the title:

toolbox: failed to create /run/.toolboxenv in container fedora-toolbox-31

I will now recreate the toolbox and try to do just dnf upgrade to see if this happens again.

After removing any toolbox and even removing current image, so the latest could be retrieved, I reproduced the issue as follows:

  1. toolbox create
  2. tooblox enter
  3. sudo dnf upgrade (this will end with failed transaction)
  4. exit
  5. toolbox enter

Expected output:
Toolbox is entered.

Current output:
toolbox: failed to create /run/.toolboxenv in container fedora-toolbox-31

Hi @Zlopez, I just tried to create a new container and follow the steps you specified but I could not reproduce the behaviour (but I did not try to pull the latest image). What version of Podman do you use?

podman version 1.8.0

Yes, this was very likely a Podman bug, which got fixed somewhere along the way.

Let's close this.

Was this page helpful?
0 / 5 - 0 ratings