Default to use a different home directory
Distrobox is great in that it even has this ability, unlike toolbox.
But it is opt-in and kinda hidden and manual, meaning 90% of people will not use it.
It is extremely important to separate dotfiles from each other, so the only good way to do that is using a different homedir.
Otherwise, using a different Distro, or a newer or older version of programs or simply the same in a container and on the host, can result in extreme breakages.
Its basically a ticking bomb, when these dotfiles will clash.
I would propose to create a directory ~/distrobox/ and in there one with the boxname or if NULL the image name and use that by default.
The benefits of sharing a homedir are naive and can be accomplished by symlinking the needed files or directories.
You mean the functionality of --HOME path/to should be default and therefore a required arg, and a --SHARE_CURRENT_HOME path/to should be created as a option instead?
hm, yes, by default the home should be in $HOME/distrobox/$BOXNAME.
I dont think a path is needed when sharing the current home, so distrobox create --use-host-home NAME would be sufficient.
I think you're right - a default to a predictable directory within the user's current $HOME (and informed as such in the output) Overidable by:
--homeas I said a few hours ago--share-current-home
I can't get --home working at all presently. I must be doing something wrong.
no I use --home now all the time, successfully.
I might uninstall podman and install docker to test again.
no I use podman on Fedora 39 Kinoite without issues.
mkdir ~/Distrobox
distrobox-create Tests --home ~/Distrobox/Tests
And as you enter it and do pwd and ls its the dir you expect and empty?
I dont know, but cd ~ goes into that directory, which means that it worked!
Me on Chromebook (Debian 12):
paul@penguin:~$ mkdir ~/Distrobox
distrobox-create Tests --home ~/Distrobox/Tests
Image registry.fedoraproject.org/fedora-toolbox:39 not found.
Do you want to pull the image now? [Y/n]: Y
Trying to pull registry.fedoraproject.org/fedora-toolbox:39...
Getting image source signatures
Copying blob 544ab65c4027 done
Copying config 841c1b7297 done
Writing manifest to image destination
Storing signatures
841c1b7297c9e8bfc291b0206288f0697053c010564bcc4da626e2d7babece10
Creating 'Tests' using image registry.fedoraproject.org/fedora-toolbox:39 Resource limits are not supported and ignored on cgroups V1 rootless systems
[ OK ]
Distrobox 'Tests' successfully created.
To enter, run:
distrobox enter Tests
paul@penguin:~$ distrobox enter Tests
Starting container... [ OK ]
Installing basic packages... [ OK ]
Setting up devpts mounts... [ OK ]
Setting up read-only mounts... [ OK ]
Setting up read-write mounts... [ OK ]
Setting up host's sockets integration... [ OK ]
Integrating host's themes, icons, fonts... [ OK ]
Setting up package manager exceptions... [ OK ]
Setting up rpm exceptions... [ OK ]
Setting up distrobox profile... [ OK ]
Setting up sudo... [ OK ]
Setting up user groups... [ OK ]
Setting up kerberos integration... [ OK ]
Setting up user's group list... [ OK ]
Setting up existing user... [ OK ]
Setting up user home... [ OK ]
Ensuring user's access... [ OK ]
Setting up skel... [ OK ]
Container Setup Complete!
π¦[paul@Tests paul]$ pwd
/home/paul
π¦[paul@Tests paul]$ ls
Desktop Distrobox Downloads fleet gems pve_mounts.sh scm sshfs WebstormProjects
π¦[paul@Tests paul]$ exit
logout
paul@penguin:~$ distrobox --version
distrobox: 1.7.1.0
It looks to have ignored the --home directive
Me on Ubuntu 22.04 on a NUC:
paul@paul-nuclin:~$ mkdir ~/Distrobox
distrobox-create Tests --home ~/Distrobox/Tests
Image registry.fedoraproject.org/fedora-toolbox:39 not found.
Do you want to pull the image now? [Y/n]: Y
Trying to pull registry.fedoraproject.org/fedora-toolbox:39...
Getting image source signatures
Copying blob 544ab65c4027 done
Copying config 841c1b7297 done
Writing manifest to image destination
Storing signatures
841c1b7297c9e8bfc291b0206288f0697053c010564bcc4da626e2d7babece10
Creating 'Tests' using image registry.fedoraproject.org/fedora-toolbox:39 [ OK ]
Distrobox 'Tests' successfully created.
To enter, run:
distrobox enter Tests
paul@paul-nuclin:~$ distrobox enter Tests
Starting container... [ OK ]
Installing basic packages... [ OK ]
Setting up devpts mounts... [ OK ]
Setting up read-only mounts... [ OK ]
Setting up read-write mounts... [ OK ]
Setting up host's sockets integration... [ OK ]
Integrating host's themes, icons, fonts... [ OK ]
Setting up package manager exceptions... [ OK ]
Setting up rpm exceptions... [ OK ]
Setting up distrobox profile... [ OK ]
Setting up sudo... [ OK ]
Setting up user groups... [ OK ]
Setting up kerberos integration... [ OK ]
Setting up user's group list... [ OK ]
Setting up existing user... [ OK ]
Setting up user home... [ OK ]
Ensuring user's access... [ OK ]
Setting up skel... [ OK ]
Container Setup Complete!
π¦[paul@Tests paul]$ pwd
/home/paul
π¦[paul@Tests paul]$ ls
debian-12.qcow2 Public Desktop flasktest pve_mounts.sh snap
bin Distrobox PycharmProjects sshfs
Documents Music Downloads graffle.txt Notepad++.desktop Pictures Videos
π¦[paul@Tests paul]$ exit
logout
paul@paul-nuclin:~$ distrobox --version
distrobox: 1.7.1.0
Seems to have ignore --home too.
If you're on an older version of distrobox, maybe that's the difference
did you do a cd ~ ? If the home is correctly set, or if the user automatically moves to that directory are 2 different things.
And why does Distrobox create a Fedora container on Debian??
$ distrobox enter Tests
π¦[paul@Tests paul]$ ls
Desktop Distrobox Downloads fleet gems pve_mounts.sh scm sshfs WebstormProjects
π¦[paul@Tests paul]$ cd ~
π¦[paul@Tests ~]$ ls
π¦[paul@Tests ~]$
Well you learn something new every day. I'm not in my home directory by default on "enter"?
well this may be a missing feature but actually helps here, as the separate home dir is unobtrusive ;D
There is an environment variable which you can set which will place all distroboxes' homes into their respective folders. DBX_CONTAINER_HOME_PREFIX is meant to be a folder. If you set it then your distrobox named test will have its home folder located in $DBX_CONTAINER_HOME_PREFIX/test.
I don't think distrobox is for me. I wanted to have as simple way of making a linux guest that was fully file-system isolated from the host, and I don't think that can be done. Sorry for wasting everyone's time
@misobarisic is right, DBX_CONTAINER_HOME_PREFIX will default all the containers to a custom HOME
@paul-hammant if you're searching for something isolated, yes, distrobox is not for you, this is not in scope with the project
@misobarisic okay so I would use DBX_CONTAINER_HOME_PREFIX=distrobox to place all boxes in $HOME/distrobox/name ?
Is there a good way to set the environment variable permanently?
other than
sudo echo "DBX_CONTAINER_HOME_PREFIX=distrobox" >> /etc/environment ?
I dont know much about this but it doesnt feel right to set this variable for all apps.
@boredsquirrel I use the config file, see: https://github.com/89luca89/distrobox#configure-distrobox
@archerallstars thanks for solving the issue!
So... for sure this could be added by distros. But do you all agree that sharing the dotfiles is a huge problem? Imagine running an Ubuntu container on Fedora. You may have the same software, different versions, different tweaks. These will overwrite their dotfiles and cause breakages.
I would very much appreciate having this value set by default. Otherwise Distrobox can not be seen as "well the apps can access your files but they run isolated" as they can literally break the host system.
The container_user_custom_home key in the config file is a way to achieve "guest apps in distrobox containers CANNOT access your host files AND they run isolated"?
not sure if I understand your comment