100 Commits
Author SHA1 Message Date
Luca Di Maio 10bab91563 Merge pull request #2195 from 89luca89/fix/nvidia_arch_tests
fix(e2e): update host distros on nvidia tests, avoid problems with stale dependencies
2026-08-09 21:27:03 +02:00
Luca Di Maio 77ca686be6 fix(e2e): update host distros on nvidia tests, avoid problems with stale dependencies
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-08-09 21:16:18 +02:00
Luca Di Maio eafe590a8d Merge pull request #2190 from 89luca89/feat/test_overhaul
ci(e2e): add end-to-end behavioral tests across distros and engines
2026-08-08 19:32:23 +02:00
Luca Di Maio 6aee0c552b Merge pull request #2139 from 89luca89/migrate-subcommand-implementation
feat(migrate): add `distrobox migrate` subcommand for v1→v2 containers
2026-08-07 21:43:12 +02:00
Luca Di Maio b0b6b56b67 docs: refresh compatibility list, drop EOL distros and add current releases
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-08-07 15:44:50 +02:00
Luca Di Maio f01efac527 ci(e2e): verify the v2 binary end-to-end across distros and engines
Unit tests can't prove the rewritten binary actually works on each supported
distro and on both podman and docker; this exercises the real thing.

Move the tests in a set of simple scripts to run them.
Make a smaller e2e test for CLI and Images that runs on every PR
Keep the full compatibility suite in a separate job for main merge and
manual runs.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-08-07 14:46:19 +02:00
Luca Di Maio 1f3fa8109e test: pin slug, env-filter, and ps-parser behavior
Lock down the container-name slug, enter env allow/deny, and podman/docker
ps parsers so provider JSON drift and symlink/env edge cases fail in CI
instead of in the field. Fixtures also capture the known doc/code and
comma-in-label quirks so they're tracked rather than silently accepted.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-08-07 11:12:13 +02:00
Luca Di Maio 0c3f8d6472 test(nvidia): add debian as a tested host and guest distro
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-26 17:59:08 +02:00
Luca Di Maio 32bb5e8727 Merge pull request #2171 from 89luca89/feat/gpu-integration-improvements
fix(gpu): isolate NVIDIA libraries and fix Docker device groups for ROCm
2026-07-25 18:00:53 +02:00
Luca Di Maio 3b5253e5c5 ci(nvidia): run the --nvidia VM e2e test on relevant PRs
The harness boots real VMs, so gate it to PRs touching distrobox-init or the
test itself instead of every push.

Base images use a split cache restore/save and on failure the per-distro log
dir is uploaded so it's debuggable without a re-run.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-25 17:19:55 +02:00
Luca Di Maio 5611967de8 test(nvidia): add local VM e2e test for --nvidia driver mirroring
The --nvidia path had no automated coverage and regresses easily (silent
32/64-bit collisions, dropped files), and GPU CI runners to exercise it
don't exist. This harness needs no GPU: it installs the nvidia driver in a
throwaway VM, runs `distrobox create --nvidia` against ubuntu/fedora/arch
guests, and checks every file the host package manager ships is mirrored in
with a matching checksum and resolvable deps. The package manifest is the
source of truth, so any gap fails loudly instead of silently.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-25 17:19:55 +02:00
Luca Di Maio 4fadc607d3 fix(docker): forward host supplementary groups for GPU device access
ROCm and other GPU workloads reach the device through /dev/kfd and
/dev/dri/renderD*, which are typically owned by group render (mode 0660).
Podman keeps the invoking user's supplementary groups via the
run.oci.keep_original_groups annotation, but the docker path forwarded only
the primary gid, so the container user was not in render/video and hit EACCES.

This generally puts docker on par with podman+crun
run.oci.keep_original_groups annotation.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-25 17:19:21 +02:00
Luca Di Maio ee5724ee62 fix(init): isolate NVIDIA driver libraries in a dedicated dir
The --nvidia path mapped each driver library to a guest destination by
rewriting its host path (x86_64-linux-gnu / lib64 / lib32 via sed), which is
fragile across distros and can shadow the guest's own libGL/glvnd/Mesa.

Mount libs into /usr/lib/distrobox-nvidia/{lib64,lib32} bucketed by ELF class +
one ld.so.conf, instead of guessing the guest path; 4 mount loops fold into one.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-25 17:19:21 +02:00
Luca Di Maio 24eeae0f86 test(commands): make generate-all-entries test hermetic
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-25 11:56:17 +02:00
Luca Di Maio e15c09fe97 Merge pull request #2175 from 89luca89/fix/ci_failures
fix(init): resolve compatibility-matrix container setup failures
2026-07-25 11:55:15 +02:00
Luca Di Maio 1ed078f68a fix(init): mask systemd-tmpfiles rules over host-shared paths
In rootless containers systemd-tmpfiles chowns the bind-mounted /tmp,
/dev and /sys and fails with EPERM, aborting package setup (systemd
>= 261, tpm-udev). Masks those configs.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-25 11:37:16 +02:00
Luca Di Maio 270bdba514 fix(init): accept zypper informational exit codes on install
zypper returns >= 100 when the transaction committed but a caveat
applies - e.g. 107 when a package %post fails, common in containers.
Only 106 was accepted; warn on the whole band except 105 (a real abort).

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-25 11:36:59 +02:00
Luca Di Maio 7c26238742 fix(init): sync alpine base to the repo before installing
alpine:edge's base image musl can lag the repo, so new package binaries
fail to relocate newer symbols (e.g. renameat2) and their post-install
scripts abort.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-25 11:36:01 +02:00
Luca Di Maio 9c2ba30891 fix(docs): remove broken distro from compatibility list
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-25 11:32:38 +02:00
Luca Di Maio 1308ae11ce chore(license): add GPL-3.0 SPDX header to Go sources (#2173)
The legacy shell tree carried a per-file license header; the Go rewrite
shipped without one. Add it to all files and enforce it going forward
via golangci-lint's goheader linter, so the notice can't be dropped.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-24 18:08:51 +02:00
Luca Di Maio 64acbeade6 refactor(providers): drop unused InspectImageOutput type
The exported struct was produced and consumed by nothing — no
InspectImage method exists and no caller references it — so it was
dead public surface, not a usable affordance.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-24 14:25:52 +02:00
Luca Di Maio 60103b1da1 refactor(containermanager): use slices.Contains for PATH segment checks
The (:|^)…(:|$) regexes only tested whether a path was an exact
colon-delimited segment — what slices.Contains over strings.Split does
directly, without recompiling a regex on every loop iteration.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-24 14:25:45 +02:00
Luca Di Maio e513cf8d8a refactor(cleanup): remove dead code and duplication (#2172)
* refactor(userenv): drop unreachable UID/GID id-command fallbacks

os.Getuid/os.Getgid only return -1 on Windows, and distrobox is
Linux/macOS only, so the `id -ru`/`id -rg` fallbacks never executed.
Call them directly and drop the now-unused //nolint:gocognit.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* refactor(config): use maps.Copy in mergeConfigMaps

Replace the hand-rolled nested-loop map merge with the stdlib
maps.Copy. Rename the variadic parameter to configMaps so it no
longer shadows the maps package.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* refactor(ephemeral): drop DryRun field shadowing CreateOptions

EphemeralOptions embedded CreateOptions yet redeclared DryRun,
shadowing it. Remove the field and rely on promotion; set DryRun
in the embedded CreateOptions at the call sites instead.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* refactor(create): drop duplicate local --verbose flag

The root command already declares --verbose/-v as a persistent
flag, so create's local copy was redundant. Remove it; -v and
--verbose on `distrobox create` still resolve to the global.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* refactor(containermanager): use time.RFC3339Nano in TimestampNow

Replace the hand-written "…000000000+00:00" layout with the stdlib
RFC3339Nano constant. Output is equivalent RFC3339 (UTC "Z", trailing
zeros trimmed), still valid input for `podman/docker logs --since`.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

---------

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-24 11:01:07 +02:00
Luca Di Maio 8561affccb fix(enter): parse distrobox flags after the container name (#2165)
`distrobox enter my-box --help` and any distrobox flag placed after the
container name, was passed to the container manager as the command instead
of being parsed, so it failed with a crun error. This diverged from the
original bash distrobox-enter, which keeps parsing flags after the name and
only starts the command at -e/--exec/--.

The port stopped flag parsing at the first positional (StopOnNthArg), which
cannot tell the name from the command: when --name or DBX_CONTAINER_NAME
already supplies the name, the first positional *is* the command. So the
command boundary is resolved before parsing and everything past it is handed
to urfave verbatim, letting flags be recognized wherever they appear while
the custom command is still passed through untouched. ephemeral gets the
same treatment.

Unknown flags after the name are rejected, as in bash, so a mistyped flag
surfaces instead of being silently executed inside the container.

Fixes https://github.com/89luca89/distrobox/issues/2160

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-07-18 17:00:12 +02:00
Luca Di Maio 94ae7fa1ac feat(compat): preserve v1 entry points after v2 single-binary split
v1 containers bind-mount distrobox-{init,export,host-exec} from host
$bindir, and v1 desktop entries launch via `distrobox-enter`. Both
would silently break under v2's single binary. argv[0] dispatch
routes distrobox-* symlinks to the right subcommand, and the helpers
ship at the v1 paths so v1 containers keep working.

BREAKING CHANGE: v2 rc1 and rc2 prerelease containers used ~/.local/share/distrobox/v2/
for their helpers and must be recreated.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-29 15:09:53 +02:00
Luca Di Maio 94d62f5e36 fix(list): scope distrobox detection to known label keys (#2143)
IsDistrobox matched any label key OR value containing "distrobox", so
unrelated containers carrying a path or project tag that happened to
include the substring (e.g. a workdir under a "distrobox" directory)
leaked into `distrobox list` — and into the rm/upgrade/stop pipelines
that filter through the same call.

Label values are never authoritative; only `manager=distrobox` and the
`distrobox.*` key namespace are ever set by us. Check those directly,
keeping 24b31ed8 working for manager-overridden boxes (apx).

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-29 14:13:58 +02:00
Luca Di Maio 2fa1339409 Merge pull request #2136 from 89luca89/dependabot/go_modules/gopkg.in/ini.v1-1.67.3
chore(deps): bump gopkg.in/ini.v1 from 1.67.0 to 1.67.3
2026-06-25 16:06:40 +02:00
Luca Di Maio 7d67bdb3d2 Merge branch 'main' into dependabot/go_modules/gopkg.in/ini.v1-1.67.3 2026-06-25 16:06:31 +02:00
Luca Di Maio 566b07d738 Merge pull request #2138 from 89luca89/dependabot/github_actions/golangci/golangci-lint-action-9.2.1
chore(deps): bump golangci/golangci-lint-action from 9.2.0 to 9.2.1
2026-06-25 16:05:44 +02:00
Luca Di Maio 2350c8599f Merge pull request #2137 from 89luca89/dependabot/github_actions/actions/checkout-7.0.0
chore(deps): bump actions/checkout from 6.0.2 to 7.0.0
2026-06-25 16:05:31 +02:00
Luca Di Maio bd8666847b Merge pull request #2135 from 89luca89/dependabot/go_modules/github.com/urfave/cli/v3-3.10.0
chore(deps): bump github.com/urfave/cli/v3 from 3.5.0 to 3.10.0
2026-06-25 16:05:13 +02:00
Luca Di Maio 7fe1539076 Merge pull request #2122 from 89luca89/next
feat: distrobox v2.0
2026-06-25 15:54:13 +02:00
Luca Di Maio 8d96cce479 docs: switch usage and man pages to v2 subcommand syntax
Rewrite distrobox-*.md to `distrobox <cmd>`, reconcile flag tables with
internal/cli, refresh README+useful_tips, regenerate man/man1/*.1.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 13:39:47 +02:00
Luca Di Maio a4d2217a57 feat(install): make install/uninstall scripts work with v2
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 13:39:47 +02:00
Luca Di Maio 4acf784a7d feat(completion): add bash and zsh shell completion
Wrappers in completions/ call --generate-shell-completion; a Go
ShellComplete callback emits flag names so urfave's default response
(subcommands only) is replaced with the full candidate set.

This replaces old hard-coded way to auto-complete using shell script's
parsing.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 13:39:47 +02:00
Luca Di Maio c71075124b chore(commands): tidy error paths and drop v1-comparability code
Fix "contaiers" typo (list, rm), route the upgrade error through the
printer, and simplify joinHooks now that tests/compare.sh is gone.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 13:39:47 +02:00
Luca Di Maio b31ea49e91 chore(cleanup): remove v1 file leftovers
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 13:39:47 +02:00
Luca Di Maio c574800e72 refactor(create): align flag Value with displayed default
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:26 +02:00
Luca Di Maio bdc2576f2c refactor(config): centralize DBX_* env-var resolution
Env vars were read in three layers — cli.EnvVars on flags, os.Getenv
in CLI actions, and the podman provider — leaving library users no
single override point. Funnelling every DBX_* through pkg/config gives
consumers one injection point, lets the container manager receive its
configuration instead of sniffing for it, and fixes the create flags
whose Usage advertised a default the env-set value was already
shadowing.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:25 +02:00
Luca Di Maio 9ab96ee1e0 refactor(rm): route command-layer prints through ui.Printer
Replace four fmt.Print*/Fprintf calls in pkg/commands/rm.go with a
printer field on RmCommand, converting warnUnknownContainers and
findExportedDesktopApps to methods. cli/rm, assemble, and ephemeral
propagate the new constructor arg so library users can control output.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:25 +02:00
Luca Di Maio 9a3b768385 chore(lint): clear golangci-lint findings
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:25 +02:00
Luca Di Maio b9b46b685a fix(test): mock the manager in generate-entry single-mode tests
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:25 +02:00
Luca Di Maio 3a4fc6a89e fix(rm): wire DBX_CONTAINER_RM_CUSTOM_HOME into --rm-home
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:25 +02:00
Luca Di Maio bdc86bbdb9 fix(rm): print 'Cannot find container' for unknown explicit names
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:25 +02:00
Luca Di Maio d0bc6af01b fix(stop): honor DBX_CONTAINER_NAME when no positional given
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:25 +02:00
Luca Di Maio cd2021d247 fix(create): word-split --volume values for shell parity
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:24 +02:00
Luca Di Maio 00514a8ef0 fix(create): strip trailing slashes from --home
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:24 +02:00
Luca Di Maio f89b8dc8d7 fix(create): show the host's hostname in --hostname Usage
Shell distrobox-create:204 prints `default: $(uname -n)`. Compute it
via os.Hostname() at command-build time so --help mirrors the shell.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:24 +02:00
Luca Di Maio a1037e6094 fix(create): drop --image Value default so the empty-check survives
Value: cfg.DefaultContainerImage made cmd.String("image") never empty,
which killed the `containerImage == ""` branch in makeContainerImage
and spuriously triggered the `name == default` fallback for `--name foo`
alone. The Usage string already shows the default.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:24 +02:00
Luca Di Maio ecd155afb1 fix(test): align test with new enter behaviour
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:24 +02:00
Luca Di Maio 333e28ae56 chore(enter): fix gofmt alignment
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:24 +02:00
Luca Di Maio 699a6eba75 fix(rm): use Container.IsRunning() for the force prompt
strings.Contains(container.Status, "Up") missed podman's lowercase
"running" status, leaving the force prompt unreachable under podman.
IsRunning() matches both docker ("Up …") and podman ("running").

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:24 +02:00
Luca Di Maio 556c8bb2ec fix(create): honor positional container_name argument
`distrobox create --image alpine my-box` silently ignored the
positional; only --name was read. Override ContainerName from
cmd.Args().First() to match the shell (distrobox-create:453-461).

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:23 +02:00
Luca Di Maio 07df5ad96b fix(assemble): skip rm step in dry-run mode
dryRun was misrouted into RmOptions.NoTTY, so `assemble rm --dry-run`
and `assemble create --replace --dry-run` actually deleted containers.
Match the shell which skips rm entirely (distrobox-assemble:316-319).

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:23 +02:00
Luca Di Maio 9860650b3d chore(lint): tweak golangci-lint
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:23 +02:00
Luca Di Maio 662edb4d49 fix(upgrade): print a per-container 'Upgrading <name>...' banner
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:23 +02:00
Luca Di Maio 9872c58ab9 fix(create): honor DBX_USERNS_NOLIMIT to drop the keep-id size cap
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:23 +02:00
Luca Di Maio c30b4589b1 fix(create): drop rslave bind propagation on macOS
Centralize in bindPropagation()/roBindPropagation(); Linux output unchanged.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:23 +02:00
Luca Di Maio bc26dfcd35 fix(enter): build --dry-run command without a live container
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:22 +02:00
Luca Di Maio cc11c2d48b fix(generate-entry): refuse a container that does not exist
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:22 +02:00
Luca Di Maio 348b79050f fix(enter): set PWD=<workdir> and stop forwarding the host PWD
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:22 +02:00
Luca Di Maio 8f22547e2b fix(entry): reuse local icons if present, before attempting downloads
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:22 +02:00
Luca Di Maio b7b0537b5b fix(create): request icon auto-detection so entries aren't icon-less
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:22 +02:00
Luca Di Maio cba73c8f04 fix(generate-entry): detect distro from the image, not the box name
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:22 +02:00
Luca Di Maio ca404a285d fix(enter): reorder PATH so /usr/local/{s,}bin precede /usr/{s,}bin
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:22 +02:00
Luca Di Maio 5a3c65bb62 fix(rm): fix(rm): confirm deletions once and default the prompts to yes, match shell behaviour
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 6388503959 fix(upgrade): match shell prompting
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 7ccdd55cf6 fix(assemble): an existing box is not an error, it should be simpl skipped
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 8c5b5658b9 fix(enter): support noworkdir flag
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 9844159d0f fix(enter): match shell version, prompt user to create missing container if not existing
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 3b03c847cb fix(create): mount the rootless marker so init doesn't misdetect rootful
Rootless podman/docker create now mounts /dev/null:/run/.distrobox.rootless:ro
(distrobox-create:577), so distrobox-init skips the /etc/shadow heuristic that
false-positives on Docker Desktop/macOS.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 0026ca068c fix(rm): honor --rm-home and gate the custom-home prompt on it
Thread RemoveHome into removeContainer; only prompt to delete the custom
home when --rm-home is set, interactive, and it differs from the host
home matching the shell. Without the flag the home is never touched.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio c662a153cb fix(assemble): accept the volume manifest key and split values
Map the reference key `volume` (alongside `volumes`) and whitespace-split
the value so `volume="/a:/b /c:/d"` becomes separate mounts, matching
distrobox-assemble.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:20 +02:00
Luca Di Maio 1f2e769fb9 feat(cli): add SUDO/DOAS guard to match shell distrobox
Restore the reference shell's refusal of `sudo distrobox`.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:20 +02:00
Luca Di Maio 6328b71aa4 docs: clarify go rewrite use of config file
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:20 +02:00
Luca Di Maio d0a94a9c27 fix(create): default name to my-distrobox when using the default image
Match the shell: an argument-less distrobox create produces my-distrobox instead of fedora-toolbox-latest.
2026-06-25 09:07:20 +02:00
Luca Di Maio a4618cdbb4 fix(compat): honor DBX_* env vars, autodetect, prompt, root parity
Wire per-command DBX_* env sources, default container_manager to autodetect, reject invalid prompt input, and treat uid 0 as rootful.
2026-06-25 09:07:20 +02:00
Luca Di Maio 65b55ae981 fix(cli): match upstream when no container name is given (#2093)
- enter: fall back to cfg.DefaultContainerName (was passing "" to the manager)
- rm: fall back to cfg.DefaultContainerName (was a silent no-op)
- upgrade: error with "Please specify the name of the container." (was silently using my-distrobox)

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio 1a75e1c562 fix(assemble): preserve section names from manifest (#2092)
`makeContainerName` replaced user-provided names with DefaultContainerName
whenever `image=` was empty, and `sectionToItem` kept whitespace from
headers like `[ generic1]`.
Both made `assemble create` emit `--name my-distrobox` (or a leading-space name)
for sections without an explicit image.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio 039ea68b66 fix(create): don't pull images in --dry-run mode (#2091)
PullImage ignored opts.DryRun and pulled anyway.
Thread DryRun through PullImage and gate
the usesRunc / supportsKeepIDSize probes.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio 37c39a2992 fix: clean up partial containers when interrupted (#2090)
Wire signal.NotifyContext in main so SIGINT/SIGTERM cancel the context
instead of killing the process.

ephemeral and assemble now defer rm on a detached cleanup ctx, so the
in-flight container is removed even when the user hits Ctrl+C.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio d3dac8af1c fix(enter): always attach stdio to final exec (#2089)
`Interactive: !NoTTY` routed stdio to discarded buffers whenever
--no-tty was set, breaking ptyxis. --no-tty only governs whether
`--tty` is appended to the exec args, not stdio plumbing.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio 21c8590288 fix(lint): fix lint warnings
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio 4330b7f901 fix(lint): remove mnd linter
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio af76d23461 fix(enter): preserve argv boundaries in custom command
CustomCommand was joined into a string and re-split on whitespace,
collapsing quoted args — `sh -c "echo a || echo b"` lost its script
body, and any value passed by upgrade/assemble with embedded spaces
or quotes got mangled. Pass argv through as []string end-to-end.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio 868036b229 chore(containermanager): group shared functions in the main containermanager interface
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
8dfb3ad2f7 test(rewrite): add shell-vs-Go compatibility test suite (#44)
* test(rewrite): add shell-vs-Go compatibility test suite

Compares command generation and flag parity between shell distrobox and
the Go rewrite. Uses a single image (alpine:3.21) since all tests
operate at the command-generation level, not runtime.

Shell output is always the reference — if Go differs it's a failure,
not a skip. Go stderr is captured for diagnostics on flag rejections.
Container targeting is per-name only (no --all) to avoid interfering
with existing distroboxes.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* fix add more tests

* fix add more tests

* fix add more tests

* fix(tests): fix malformed test cases in compare.sh

Three value-flag tests were broken by word splitting on unquoted
${flags} expansion — multi-word values caused trailing tokens to
clobber the container name:
- --additional-flags "--ulimit nofile=4096:4096" → --memory=512m
- --init-hooks "echo test-init-hook" → true
- --pre-init-hooks "echo test-pre-init-hook" → true

Also fix flag_slug computation (tr ' -' → tr ' -/:') in all four
loop sites so paths containing / or : don't create bogus filenames,
which silently broke the -H /tmp/dbx-test-home short-flag test.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* fix: test refinement

remove version checks
remove ephemeral until we fix upstream
add test that surfaces go vs shell difference

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* fix: exclude SHLVL from checks, reduce noise

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* fix(test): remove some noise from env vars

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* chore: rename output file so that are grouped by operation

* chore(tests): fix linting issues and port comparison tests to POSIX sh

* chore(tests): apply shfmt

---------

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Co-authored-by: balanza <emanuele@decup.is>
Co-authored-by: Alessio Biancalana <alessio@dottorblaster.it>
2026-06-14 13:04:27 +02:00
Luca Di Maio 3c0a2f3036 fix: sync with shell upstream (#48)
Go rewrite emitted --userns keep-id without :size=65536 and
--platform <val> instead of --platform=<val>, diverging from the
shell reference implementation.

Sync assets internal shell with current upstream

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 83aecc269f feat(enter): support custom commands, fix TTY detection and flag parsing (#47) 2026-06-14 13:04:27 +02:00
Luca Di Maio 75c5e39640 fix(ephemeral): add dry-run flag
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 96974f71a0 fix(podman): fix constant lint
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio ed61cd0c4d fix(enter): add missing dry run
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 2d010dde14 fix(podman): empty DBX_CONTAINER_MANAGER should default to podman
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 792dfd20cc fix(podman): add missing Commit implementation
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio d7c0b3cd81 fix(create): behave like shell, use containerName as default hostname on unsharenetns
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio cbf6a99ff6 Fix DOCS links
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-03-30 15:57:55 +02:00
Luca Di Maio c6cc6a3d5b init: chmod shadow files to 0400 for container storage compatibility (#2020)
On container storage drivers where CAP_DAC_OVERRIDE is not effective
(e.g. fuse-overlayfs in rootless mode, or VMs like Docker Desktop /
Colima on macOS), root cannot read files with mode 000 despite having
the capability in its effective set. This causes pam_unix.so account
management to fail with "Authentication service cannot retrieve
authentication info" when calling getspnam(), because glibc's NSS
files backend cannot open /etc/shadow.

Fedora and Arch ship /etc/shadow and /etc/gshadow as mode 000, relying
on CAP_DAC_OVERRIDE to grant root access. Set them to 0400 (owner-read)
after password setup so that standard POSIX owner checks suffice.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-03-19 14:42:55 +01:00
Luca Di Maio 3eb5c6f1f3 chore(version): bump install to v1.8.2.4
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-02-04 18:43:11 +01:00
Luca Di Maio 4f43814224 init: refactor user setup to modify attributes individually (#1994)
Modify user attributes (username, shell, GID, groups, UID) separately
with individual checks and fallbacks for each, rather than using a
single usermod call. This improves reliability by only modifying
attributes that differ from the expected values and provides more
granular error handling.

This also includes a fix in /etc/group that would make usermod fail if
it does not end with a newline.

Fix #1991
Fix #1979

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-02-04 10:45:24 +01:00
Luca Di Maio 9867e17ec8 fix(init): fix support for newer shadow strictier checks (#1965) 2026-01-17 10:58:07 +09:00