Distrobox: Difference between revisions
Added a fix to a problem I encountered with NixOS on Orbstack. I'm not sure how common it is, but it took a bit to debug. |
|||
Line 39: | Line 39: | ||
distrobox enter debian | distrobox enter debian | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==== "potentially insufficient UIDs and GUIDs" error ==== | |||
When setting up containers that do not run as root, you may see an error along the following lines: (this example uses podman, lilipod has a different error) | |||
<syntaxhighlight lang="console"> | |||
# distrobox create container | |||
... | |||
Error: copying system image from manifest list: writing blob: adding layer with blob ...: | |||
unpacking failed (error: exit status 1; | |||
output: potentially insufficient UIDs or GIDs available in user namespace (requested 1000:1000 for /home/ubuntu): Check /etc/subuid and /etc/subgid if configured locally and run "podman system migrate": lchown /home/ubuntu: invalid argument) | |||
</syntaxhighlight> | |||
adding the following to your config might help: | |||
<syntaxhighlight lang="nix"> | |||
users.users.ilyagr = { | |||
extraGroups = [ "podman" ]; | |||
subGidRanges = [ | |||
{ | |||
count = 65536; | |||
startGid = 1000; | |||
} | |||
]; | |||
subUidRanges = [ | |||
{ | |||
count = 65536; | |||
startUid = 1000; | |||
} | |||
]; | |||
}; | |||
</syntaxhighlight> | |||
Rebuild your system, run <code>podman system migrate</code>, and try creating the distrobox container again. | |||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:Container]] | [[Category:Container]] |
Revision as of 01:31, 7 January 2025
Distrobox offers you to use any linux distribution inside your terminal as a simple wrapper for Podman, Docker or Lilipod.
Setup
Distrobox uses Docker internally to fetch and run system images. Easily get started by enabling Podman with Docker-compatibility mode.
virtualisation.podman = {
enable = true;
dockerCompat = true;
};
environment.systemPackages = [ pkgs.distrobox ];
Usage
Setup container with latest Arch Linux image
# distrobox create --name archlinux --init --image archlinux:latest
Enter Arch Linux container
# distrobox enter archlinux
For further usage, please refer to the Distrobox documentation.
Tips and tricks
Using different architecture
Following example will run an Ubuntu container with a different architecture than the host, in this case arm64.
Add following line to your system configuration, apply it and then reboot the system.
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
Run a Debian container with arm64 architecture
sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
distrobox create -n debian --image arm64v8/debian
distrobox enter debian
"potentially insufficient UIDs and GUIDs" error
When setting up containers that do not run as root, you may see an error along the following lines: (this example uses podman, lilipod has a different error)
# distrobox create container
...
Error: copying system image from manifest list: writing blob: adding layer with blob ...:
unpacking failed (error: exit status 1;
output: potentially insufficient UIDs or GIDs available in user namespace (requested 1000:1000 for /home/ubuntu): Check /etc/subuid and /etc/subgid if configured locally and run "podman system migrate": lchown /home/ubuntu: invalid argument)
adding the following to your config might help:
users.users.ilyagr = {
extraGroups = [ "podman" ];
subGidRanges = [
{
count = 65536;
startGid = 1000;
}
];
subUidRanges = [
{
count = 65536;
startUid = 1000;
}
];
};
Rebuild your system, run podman system migrate
, and try creating the distrobox container again.