Nixpkgs: Toolbox

Created on 23 Aug 2020  ยท  3Comments  ยท  Source: NixOS/nixpkgs

Project description

It's a tool to create pet-container using Podman. The container is fully mutable and maps your user home to the container.

Metadata

packaging request

Most helpful comment

I took a brief look at this a couple of months ago after it was rewritten in go. I'll post what I had if I can find it.

It uses meson/ninja as a build system which makes it kind of non-standard and a bit awkward to package compared to other go projects, might be easier to skip it and specify the build/install phases manually.

IIRC it also needed completion/profile.d paths to be patched in, had issues trying to mount other paths on NixOS and it wanted flatpak for some reason.

All 3 comments

I took a brief look at this a couple of months ago after it was rewritten in go. I'll post what I had if I can find it.

It uses meson/ninja as a build system which makes it kind of non-standard and a bit awkward to package compared to other go projects, might be easier to skip it and specify the build/install phases manually.

IIRC it also needed completion/profile.d paths to be patched in, had issues trying to mount other paths on NixOS and it wanted flatpak for some reason.

I also took a shot at getting toolbox working a while back, and wrote a nix expression for building the package, but decided to try it out when podman is rolled out in a stable NixOS channel. Now that 20.09 is released, I'm trying it out but I get cryptic errors like the following:

$ toolbox enter -v
level=debug msg="Running as real user ID 1000"
level=debug msg="Resolved absolute path to the executable as /nix/store/cnddgykvpjnh8a742vl8hcqr459ji0s6-toolbox-0.0.97/bin/toolbox"
level=debug msg="Running on a cgroups v1 host"
level=debug msg="Checking if /etc/subgid and /etc/subuid have entries for user delta"
level=debug msg="TOOLBOX_PATH is /nix/store/cnddgykvpjnh8a742vl8hcqr459ji0s6-toolbox-0.0.97/bin/toolbox"
level=debug msg="Toolbox config directory is /home/delta/.config/toolbox"
level=debug msg="Current Podman version is 2.1.1"
level=debug msg="Old Podman version is 2.1.1"
level=debug msg="Migration not needed: Podman version 2.1.1 is unchanged"
level=debug msg="Resolving container and image names"
level=debug msg="Container: ''"
level=debug msg="Image: ''"
level=debug msg="Release: ''"
level=debug msg="Resolved container and image names"
level=debug msg="Container: 'fedora-toolbox-31'"
level=debug msg="Image: 'fedora-toolbox:31'"
level=debug msg="Release: '31'"
level=debug msg="Checking if container fedora-toolbox-31 exists"
level=debug msg="Container fedora-toolbox-31 not found"
level=debug msg="Fetching containers with label=com.redhat.component=fedora-toolbox"
level=debug msg="Fetching containers with label=com.github.debarshiray.toolbox=true"
level=debug msg="Found 1 containers"
Error: container fedora-toolbox-31 not found
Entering container fedora-toolbox-30 instead.
Use the 'create' command to create a different toolbox.
Run 'toolbox --help' for usage.
level=debug msg="Inspecting mounts of container fedora-toolbox-30"
level=debug msg="Requires org.freedesktop.Flatpak.SessionHelper"
level=debug msg="Calling org.freedesktop.Flatpak.SessionHelper.RequestSession"
level=debug msg="Starting container fedora-toolbox-30"
level=debug msg="Inspecting entry point of container fedora-toolbox-30"
level=debug msg="Entry point PID is a float64"
level=debug msg="Entry point of container fedora-toolbox-30 is toolbox (PID=0)"
Error: invalid entry point PID of container fedora-toolbox-30

I might look into this further when I get the time, but people are welcome to look into this issue to try and fix it. Meanwhile, here's the nix expression to build it: https://github.com/mt-caret/nix-config/blob/55ca5a343feec9c0cdef9d6a035ac9e99d1d0208/packages/toolbox.nix
Note that in order to use toolbox on NixOS, you seem to need the following config:

{
  virtualisation.podman.enable = true;
  services.flatpak.enable = true;
  xdg.portal.enable = true;
}

People seem to be against usage of buildGoModule (see https://github.com/NixOS/nixpkgs/issues/84826), so if people are interested in seeing this in nixpkgs, someone probably needs to port this to buildGoPackage.

Hi @mt-caret ,

I modified a little your nix expression https://github.com/tfmoraes/nixoscfg/blob/main/overlays/pkgs/toolbox/default.nix

I added a patch to check if /mtn exists (it not exists in my system for instance). I also changed to copy profile.d/toolbox.sh to $out/share/profile.d/toolbox.sh and it's mapping this file inside the container.

I'm having the same error. So I tried to start the container using podman, this way:

โฏ podman start  --interactive  -a  fedora-toolbox-33                                                                                                                                                        
WARN[0000] cannot toggle freezer: cgroups not configured for container 
WARN[0000] lstat : no such file or directory            
standard_init_linux.go:219: exec user process caused: no such file or directory

Maybe the problem now is because o cgroups. I don't now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rzetterberg picture rzetterberg  ยท  3Comments

retrry picture retrry  ยท  3Comments

vaibhavsagar picture vaibhavsagar  ยท  3Comments

tomberek picture tomberek  ยท  3Comments

domenkozar picture domenkozar  ยท  3Comments