Open ZefQ opened 4 months ago
I am having the same issue. I have installed and exported Android Studio in an Ubuntu container as well as the Flutter/Dart SDKs which are all in the container path. Exporting Android Studio works but the path is still the hosts' which breaks everything.
I am having the same issue.
The problem relies in the command you're using to test this, just doing enter -- echo $PATH
will just print the host PATH because $PATH is evaluated by the shell BEFORE entering into distrobox
try
luca-linux@framework13:~$ distrobox enter default_distrobox -- sh -c "echo \$PATH"
/var/lib/flatpak/exports/bin:/home/luca-linux/bin:/home/luca-linux/.local/share/flatpak/exports/bin:/home/luca-linux/.local/bin:/home/luca-linux/.config/emacs/bin/:/var/lib/flatpak/exports/bin:/home/luca-linux/bin:/home/luca-linux/.local/share/flatpak/exports/bin:/home/luca-linux/.local/bin:/home/luca-linux/.config/emacs/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/luca-linux/.local/flutter/flutter/bin:/home/luca-linux/.local/flutter/flutter/bin/cache/dart-sdk/bin/snapshots:/usr/sbin:/usr/local/sbin:/home/luca-linux/.local/flutter/flutter/bin:/home/luca-linux/.local/flutter/flutter/bin/cache/dart-sdk/bin/snapshots:/usr/sbin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
luca-linux@framework13:~$ echo $PATH
/var/lib/flatpak/exports/bin:/home/luca-linux/bin:/home/luca-linux/.local/share/flatpak/exports/bin:/home/luca-linux/.local/bin:/home/luca-linux/.config/emacs/bin/:/var/lib/flatpak/exports/bin:/home/luca-linux/bin:/home/luca-linux/.local/share/flatpak/exports/bin:/home/luca-linux/.local/bin:/home/luca-linux/.config/emacs/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/luca-linux/.local/flutter/flutter/bin:/home/luca-linux/.local/flutter/flutter/bin/cache/dart-sdk/bin/snapshots:/usr/sbin:/usr/local/sbin:/home/luca-linux/.local/flutter/flutter/bin:/home/luca-linux/.local/flutter/flutter/bin/cache/dart-sdk/bin/snapshots:/usr/sbin:/usr/local/sbin
luca-linux@framework13:~$
This indeed shows a different path
Describe the bug When exporting applications installed in a distrobox container to the host, the environment variables within the container are not correctly set up when executing commands via distrobox-enter -- command. This results in the PATH environment variable from the host being used instead of the one from the container, causing the application to fail to find its executable.
To Reproduce
Expected behavior The PATH environment variable should reflect the container's environment, ensuring that the application can locate its executable.
Actual behavior The PATH environment variable reflects the host's environment, causing the application to fail due to missing paths.
Example On the host:
Using distrobox-enter -- command:
Entering the container interactively:
Desktop (please complete the following information):
Additional context Im using openSUSE with the nix package-manager inside the container so i need ~/.nix-profile/bin on the path to able to find the applications.
If you would like to reproduce it with a nix package there is also a bug with the distrobox-export command. because the path
.nix-profile/share/applications
is a symlinc to /nix/store/... I solved that problem by adding a trailing / to line 435 so the find command only checks for files and links inside applications[ -d "${xdg_data_dir}/applications" ] && canon_dirs="${canon_dirs} ${xdg_data_dir}/applications/"