Distrobox: Difference between revisions

Ilyagr (talk | contribs)
m Fixup heading level
Luflosi (talk | contribs)
Use "distrobox --root" instead of running as root directly since distrobox does not want to be run with sudo or doas
 
(6 intermediate revisions by 4 users not shown)
Line 16: Line 16:


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# distrobox create --name archlinux --init --image archlinux:latest
distrobox create --root --name archlinux --init --image archlinux:latest
</syntaxhighlight>
</syntaxhighlight>


Line 22: Line 22:


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# distrobox enter archlinux
distrobox enter --root archlinux
</syntaxhighlight>
</syntaxhighlight>


Line 30: Line 30:


=== Using different architecture ===
=== Using different architecture ===
Following example will run an Ubuntu container with a different architecture than the host, in this case arm64.
The 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.<syntaxhighlight lang="nix">
Add following line to your system configuration, apply it and then reboot the system.<syntaxhighlight lang="nix">
Line 42: Line 42:
=== "potentially insufficient UIDs and GUIDs" error ===
=== "potentially insufficient UIDs and GUIDs" error ===
When setting up containers that do not run as root, as <code>podman</code> does by default, you may see an error along the following lines: (this example uses podman, lilipod has a different error)
When setting up containers that do not run as root, as <code>podman</code> does by default, you may see an error along the following lines: (this example uses podman, lilipod has a different error)
<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# distrobox create container
# distrobox create container
Line 52: Line 50:
</syntaxhighlight>
</syntaxhighlight>


adding the following to your config might help:
To fix it, adding the following to your config might help:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 73: Line 71:


Rebuild your system, run <code>podman system migrate</code>, and try creating the distrobox container again.
Rebuild your system, run <code>podman system migrate</code>, and try creating the distrobox container again.
=== Exposing your profile ===
If you get errors like <code>/home/user/.zshenv:.:2: no such file or directory: /etc/profiles/per-user/user/etc/profile.d/hm-session-vars.sh</code> or <code>_atuin_preexec: command not found: atuin</code> that is because your shell init is referencing paths that are not accessible to Distrobox. By default, Distrobox only gets access to your home directory. You can mount additional volumes with <code>distrobox create --volume /your/custom/volume/path</code>, but it is more convenient to define defaults in <code>distrobox.conf</code>: <syntaxhighlight lang="nix">environment.etc."distrobox/distrobox.conf".text = ''
  container_additional_volumes="/nix/store:/nix/store:ro /etc/profiles/per-user:/etc/profiles/per-user:ro /etc/static/profiles/per-user:/etc/static/profiles/per-user:ro"
''; </syntaxhighlight>


[[Category:Applications]]
[[Category:Applications]]
[[Category:Container]]
[[Category:Container]]