You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like to use several toolboxes, with different content. To properly distinguish these, I'd like to mount them in subdirectories (e.g. container1:/home/user -> host:/var/home/user/container1). It's a similar thing to #183 , but not as security- centric.
Is there a way to achieve this at the moment / via consistent workaround (I don't want to change a line of code and after the next update I'm saving files somewhere else ;) )?
Update: I wouldn't actually mind (maybe even appreciate) having these under different user-contexts - but in the same general directory. That way there is a clear distinction and separation.
For presenting this to the end- user in a "nice way", one could add an extra link opening the file-browser as sudo... (just thinking loud here)
Thanks in advance,
Chris
Reacted by JaneSmith, Reto, rugk, Stefan Marinov, ChrisTucker2000, haryp2309, Serhii, Onur, Nils-Hero Lindemann, dsqrt4 and 7 more
I usually just do HOME=/home/user1/container1 before creating the containers and just use an alias to open them. (alias toolbox1='HOME=/home/user1/container1/toolbox "$@"')
I'd also like to see something like this. My main use case for Toolbox is to set up throwaway development environments, for either working on projects, or just quickly compiling some software from source. I don't want to pollute my system with random files from dependencies, etc. just to compile something once. Toolbox seemed perfect for this, as it claims to provide an isolated container to keep the host clean.
This didn't turn out to work quite how I expected though. While Toolbox does keep the host OS clean, it doesn't keep the home directory clean at all. That still gets totally polluted. For example, using a throwaway container to build something that uses rust, my home directory ended up getting altered in several ways:
A ~/.cargo directory was silently created, containing many Rust-related binaries, source packages, etc. for a total of 123 MB.
A ~/.rustup directory was silently created, containing many more Rust-related binaries, for a total of 683 MB.
My ~/.bash_profile file was silently altered to add the ~/.cargo/bin directory to my $PATH ahead of everything else.
My ~/.profile file was silently altered to add the ~/.cargo/bin directory to my $PATH ahead of everything else.
Who knows what else.
Yikes. What was supposed to be a temporary, throwaway, easy-to-discard system resulted in many permanent changes being silently made to my home directory. I realise now from the comments above that I can override the $HOME environment variable manually to try to work around this, but this was not intuitive or expected to me. Since Toolbox is supposed to be (or at least as I understand it) a simplified and user-friendly way to get into containers, I would appreciate if this could be handled in some better way.
My opinion is that a Toolbox should probably have its own unique user and home directory by default. But if this is too complicated to implement, then perhaps there could at least be a -h or --home argument when creating a new toolbox, to set its default $HOME? So that when you enter the toolbox in future, it would get that $HOME value set automatically. For example, something along the lines of toolbox create -c temp-myproject -h ~/Toolboxes/temp-myproject.
Basically, I think it would be great if Toolbox had a user-friendly way to set up a container in one of three modes:
Seamless mode: How it works now. The container user acts as if it's your real host user, sharing your home directory.
Semi-isolated mode: The container has access to your host user's files, but has its own home directory for software to use by default. You would need to manually access your host user's home directory if you want to read/write to there. It would basically be like the Seamless mode above, but with its own separate working directory.
Fully-isolated (untrusted) mode: The container would have its own separate user and home directory, with absolutely no access to your host user's home directory. This would be useful for running untrusted software, which you don't want to allow to read everything in your home directory.
Reacted by Ondřej Míchal, Christian K., Anatoli Babenia, Emmanuel Galanos, Stefan Marinov, Yuyang, ChrisTucker2000, C-Rio, Onur, kya8 and 31 more
Reacted by Ondřej Míchal, Yuyang, ChrisTucker2000, Max Boone, Zihad, Serhii, Ry, nodefourtytwo, ErrorNoInternet, violetmage and 3 more
I second the idea too. But until it gets implemented you could use direnv. It is a handy tool that allows one to specify environment variables on a per directory basis. You can use the following work flow
- install direnv and hook it to your shell
- create a temporary directory eg. ~/somedev
- add a .envrc file with the environment variables you want (in this case HOME=/home/user/somedev
now every time you go into the somedev directory it will assume it is the home directory and resets when you step out of it . You could do all the steps after installing direnv in one command like:
I agree there should at least be an option to not mount the home dir (ref #183 (comment)). Actually, I would even be fine if it uses – similar to flatpak – some dir in ~/.var/app, maybe better ~/.var/toolbox or so, where all files in the home dir are saved by default.
I quite like that flatpak model, because you have all the data from one container in one place, and if you delete the container, you can also delete all app data. (or just measure the space your new "I've tried out rust" project took), e.g. (as it's done in gnome-control-center)
Then, for convenience, it should possibly always mount in the current $PWD, if you start it from a project folder, you likely expect to have the files in there. Just, your ~/rust-project folder, does not need any access to ~/Pictures/private/… etc.
Anyway, of course one should be able to optionally mount home as read-only or even writable, but I don't think that is really needed for most applications.
And one should be able to not mount the current $PWD.
So you'd have a "middle-ground" here as a new default.
Reacted by Mark Stosberg, Stefan Marinov, JaneSmith, ChrisTucker2000, Serhii and Raura
Noooo… you can still have other use cases/reasons for having a different $HOME then an "Isolated development environments to fend against bugs and malware in code under development"…
IMHO, this is still a feature that toolbox should have.
Reacted by JaneSmith, Stefan Marinov, ankar71, ChrisTucker2000, Gabe De Repentigny, Serhii, Jordan Callicoat, Maximilian Luz, dsqrt4, ErrorNoInternet and 6 more
Reacted by Ondřej Míchal, ErrorNoInternet and dongdigua
I don't understand why this issue was closed. It's not a duplicate of that. This isn't just about security. I really hope this will be reconsidered as I love Fedora Silverblue and love that it has a built-in tool to set up pet containers, but it doesn't really do the job currently. I don't want to have to use a fork just for that... I use toolbox for pet containers to deal with various programming projects, and I don't want my home directory to be cluttered by the containers. It has nothing to do with security.
Reacted by Stefan Marinov, choeffer, Gabe De Repentigny, Serhii, Jordan Callicoat, Maximilian Luz, ErrorNoInternet, 椰格, hof, Raura and 2 more
I'd prefer to use Toolbox rather than a fork, because Toolbox is better supported with more developers, and is included with Fedora out of the box. When I'm moving from machine to machine, Toolbox is already there, without me having to install forks. Part of the reason for using Toolbox in the first place is to avoid cluttering my system with random software installations!
In my humble opinion, this feature request is for something that should be core, basic functionality, as not having it kind of defeats the purpose of Toolbox. I don't see it as a really "out there" unusual special feature. I'm therefore voicing my support for it and hoping that it will be implemented for this project.
Reacted by rugk, ChrisTucker2000, Stefan Marinov, Jeffrey Serio, Kevin Liao, Serhii, Ivan Nikishev, Jordan Callicoat, hof, Raura and 3 more
Could we at least get some rationale or an alternative solution to this problem rather than just a cowardly silent close? This is a very real shortfall that undermines the entire stated purpose of toolboxes. That there are so many proposed fixes and real examples as to why they're needed and yet we get no response is tone deaf.
Reacted by JaneSmith, Zihad, Ivan Nikishev, William Vandervalk, Aleksandr Kadykov, hof, Raura, Axel Wegener, Vladimir, Enteleform and 2 more
while having same home folder is convenient for average desktop user. But it's not ideal for developers. Who likes to try bunch of program to try in separate toolbox.
So, I don't use toolbox in Fedora Kinoite anymore. I always use distrobox.
You can have separate home in your choosing location.
Reacted by JaneSmith, Ivan Nikishev, hof, Raura, Axel Wegener and Blaise Pabon
i'm also using silverblue and have also switched to distrobox. on top of supporting this feature it also natively and actively goes out of it's way to support running non-fedora distros inside of their containers.
Reacted by JaneSmith, Ivan Nikishev, hof and Raura
I think the hard part in this issue is that OCI-containers are created immutably. One of the main components of toolbox is that it has both a host-running management application and a special entrypoint that starts up the container configured properly and up-to-date according to the host set-up.
However, the home-directory is not mounted using this entrypoint. Instead, when toolbox create is run, the host-application checks which home-directories it should pass to the container and creates the mounts for these directories in the OCI-container (immutable) definition.
As far as I can tell there are two ways to go here (user = bark, container = yard):
1. Do not create direct mounts for the home directory when creating the container; Instead, mount the necessary home-directories of the users in `/run/host/home/bark`, have `initContainer.go` create directories on the image & symlink them on boot of the container (similar to existing approach for other exposed files).
2. Upon creation of a container, allow a flag (e.g. `--private`) that creates the `yard::/home/bark` mount but mounts it on the host to a configured directory (default `host::/home/bark/.toolbox/home/yard/bark/...`)
Considering security - as the toolbox runs under the same uid & gid as the host user, I wouldn't see leaving out a mount as secure. I also wouldn't go as far as allowing fully "private" containers, you can just as well use podman / docker / nerdctl without this. I also prefer option 1, as this keeps the door open to later mount the home directory (or even another directory) anyways.
For now, I won't have time to look into contributing to this project before May; I'm using the following lines in my .bashrc to have the containers use a subdirectory as their home:
# Check if we're running inside a toolbox
TOOLBOX_NAME=""
if [ -f "/run/.containerenv" ]; then
TOOLBOX_NAME=$(sed -nr 's/^name="(.*)"$/\1/p' /run/.containerenv)
HOME="$HOME/.toolbox/homedir/$TOOLBOX_NAME/$USER"
mkdir -p "$HOME"
bash
exit 0
fi
is there any reason not to use this solution though? Also what is the correct way of using it, do I add it to the end of .bashrc?
I think the hard part in this issue is that OCI-containers are created immutably. One of the main components of toolbox is that it has both a host-running management application and a special entrypoint that starts up the container configured properly and up-to-date according to the host set-up.
However, the home-directory is not mounted using this entrypoint. Instead, when toolbox create is run, the host-application checks which home-directories it should pass to the container and creates the mounts for these directories in the OCI-container (immutable) definition.
As far as I can tell there are two ways to go here (user = bark, container = yard):
1. Do not create direct mounts for the home directory when creating the container; Instead, mount the necessary home-directories of the users in `/run/host/home/bark`, have `initContainer.go` create directories on the image & symlink them on boot of the container (similar to existing approach for other exposed files).
2. Upon creation of a container, allow a flag (e.g. `--private`) that creates the `yard::/home/bark` mount but mounts it on the host to a configured directory (default `host::/home/bark/.toolbox/home/yard/bark/...`)
Considering security - as the toolbox runs under the same uid & gid as the host user, I wouldn't see leaving out a mount as secure. I also wouldn't go as far as allowing fully "private" containers, you can just as well use podman / docker / nerdctl without this. I also prefer option 1, as this keeps the door open to later mount the home directory (or even another directory) anyways.
For now, I won't have time to look into contributing to this project before May; I'm using the following lines in my .bashrc to have the containers use a subdirectory as their home:
# Check if we're running inside a toolbox
TOOLBOX_NAME=""
if [ -f "/run/.containerenv" ]; then
TOOLBOX_NAME=$(sed -nr 's/^name="(.*)"$/\1/p' /run/.containerenv)
HOME="$HOME/.toolbox/homedir/$TOOLBOX_NAME/$USER"
mkdir -p "$HOME"
bash
exit 0
fi
is there any reason not to use this solution though? Also what is the correct way of using it, do I add it to the end of .bashrc?
okay so although i dont really know what i am doing, from what i can tell it seems to work when you add it just before "unset rc". After doing that when I do cd ~ in a toolbox it goes to the folder. One issue is that after you enter a toolbox you need to write cd ~ to actually go to it's new home dir, I wonder if that is possible to do automatically. I tried adding "cd ~" to the script but I am assuming thats not how it works because it stopped the whole thing from working.
Anyway still is there any disadvantage to using that approach?
I am going to close this issue so that the list of open issues doesn't balloon out of control, and continues to roughly reflect the items that are on the current to-do list. However, it will still be around for future reference.
Not having something on the immediate to-do list isn't the same thing as don't solve it. There's such a thing as priority.
It would be helpful to pick a primary thread (#183, #320, #331, #348, #1044, #1470, #1510) for this issue and reopen it, so that people can be notified when the issue is resolved. #183 and #348 are good candidates, as they have the most activity and dialog surrounding the issue.
It is apparent that this issue is affecting many people, as evidenced by the numerous duplicates of the issue and the extensive ongoing dialog.
Keeping an issue open would:
signal that the issue is intended to be resolved at some point
provide a singular notification channel for those who are currently resorting to workarounds or alternative solutions
mitigate further duplicates from being created
Reacted by JaneSmith, Zihad, Léo de Souza, slavalamp and Amedeo Braggio
In general Linux, the command to change the HOME path is:
# usermod -d /my/new/home -m username
However, the premise for this command to be executed effectively is that the user cannot log in. This command can only be executed by using this user to log in to this container. This is a dead loop. Currently, toolbx does not seem to provide a way for other users to log in.
It's really a very strange inexplicable reluctance to do basic things. Is there any hope that you can accept a high-quality Pull Request, if there is one?
It's really a very strange inexplicable reluctance to do basic things. Is there any hope that you can accept a high-quality Pull Request, if there is one?
There is more than one issue about this and apparently there is a not a insignificant number of people interested in this feature, but the issues are closed (Not planned) so i don't know if is because there is a technical reason or they have other things more important or just they don't want to implement that.
Activity
yilkalargaw commentedon Dec 25, 2019
I usually just do
HOME=/home/user1/container1before creating the containers and just use an alias to open them. (alias toolbox1='HOME=/home/user1/container1/toolbox "$@"')debarshiray commentedon Jan 14, 2020
Yeah, overriding
$HOMEis one way to do it.JaneSmith commentedon Jan 16, 2020
I'd also like to see something like this. My main use case for Toolbox is to set up throwaway development environments, for either working on projects, or just quickly compiling some software from source. I don't want to pollute my system with random files from dependencies, etc. just to compile something once. Toolbox seemed perfect for this, as it claims to provide an isolated container to keep the host clean.
This didn't turn out to work quite how I expected though. While Toolbox does keep the host OS clean, it doesn't keep the home directory clean at all. That still gets totally polluted. For example, using a throwaway container to build something that uses
rust, my home directory ended up getting altered in several ways:~/.cargodirectory was silently created, containing many Rust-related binaries, source packages, etc. for a total of 123 MB.~/.rustupdirectory was silently created, containing many more Rust-related binaries, for a total of 683 MB.~/.bash_profilefile was silently altered to add the~/.cargo/bindirectory to my $PATH ahead of everything else.~/.profilefile was silently altered to add the~/.cargo/bindirectory to my $PATH ahead of everything else.Yikes. What was supposed to be a temporary, throwaway, easy-to-discard system resulted in many permanent changes being silently made to my home directory. I realise now from the comments above that I can override the $HOME environment variable manually to try to work around this, but this was not intuitive or expected to me. Since Toolbox is supposed to be (or at least as I understand it) a simplified and user-friendly way to get into containers, I would appreciate if this could be handled in some better way.
My opinion is that a Toolbox should probably have its own unique user and home directory by default. But if this is too complicated to implement, then perhaps there could at least be a
-hor--homeargument when creating a new toolbox, to set its default $HOME? So that when you enter the toolbox in future, it would get that $HOME value set automatically. For example, something along the lines oftoolbox create -c temp-myproject -h ~/Toolboxes/temp-myproject.Basically, I think it would be great if Toolbox had a user-friendly way to set up a container in one of three modes:
martymichal commentedon Jan 16, 2020
This sounds very reasonable to me. What do you think @debarshiray??
ckaspro commentedon Jan 18, 2020
I support this @JaneSmith , all I need - nicely put!
yilkalargaw commentedon Jan 20, 2020
I second the idea too. But until it gets implemented you could use direnv. It is a handy tool that allows one to specify environment variables on a per directory basis. You can use the following work flow
now every time you go into the
somedevdirectory it will assume it is the home directory and resets when you step out of it . You could do all the steps after installing direnv in one command like:I currently use a similar work flow.
rugk commentedon May 3, 2020
I agree there should at least be an option to not mount the home dir (ref #183 (comment)). Actually, I would even be fine if it uses – similar to flatpak – some dir in
~/.var/app, maybe better~/.var/toolboxor so, where all files in the home dir are saved by default.I quite like that flatpak model, because you have all the data from one container in one place, and if you delete the container, you can also delete all app data. (or just measure the space your new "I've tried out rust" project took), e.g. (as it's done in gnome-control-center)
Then, for convenience, it should possibly always mount in the current $PWD, if you start it from a project folder, you likely expect to have the files in there. Just, your
~/rust-projectfolder, does not need any access to~/Pictures/private/…etc.Anyway, of course one should be able to optionally mount home as read-only or even writable, but I don't think that is really needed for most applications.
And one should be able to not mount the current
$PWD.So you'd have a "middle-ground" here as a new default.
markstos commentedon May 4, 2020
tlbx fork has a
-noption to not bind-mount the home directory.debarshiray commentedon May 18, 2020
Duplicate of #183
rugk commentedon May 20, 2020
Noooo… you can still have other use cases/reasons for having a different $HOME then an "Isolated development environments to fend against bugs and malware in code under development"…
IMHO, this is still a feature that toolbox should have.
JaneSmith commentedon Jun 4, 2020
I don't understand why this issue was closed. It's not a duplicate of that. This isn't just about security. I really hope this will be reconsidered as I love Fedora Silverblue and love that it has a built-in tool to set up pet containers, but it doesn't really do the job currently. I don't want to have to use a fork just for that... I use toolbox for pet containers to deal with various programming projects, and I don't want my home directory to be cluttered by the containers. It has nothing to do with security.
markstos commentedon Jun 4, 2020
@JaneSmith why not use a fork if it has the features you need?
JaneSmith commentedon Jun 20, 2020
I'd prefer to use Toolbox rather than a fork, because Toolbox is better supported with more developers, and is included with Fedora out of the box. When I'm moving from machine to machine, Toolbox is already there, without me having to install forks. Part of the reason for using Toolbox in the first place is to avoid cluttering my system with random software installations!
In my humble opinion, this feature request is for something that should be core, basic functionality, as not having it kind of defeats the purpose of Toolbox. I don't see it as a really "out there" unusual special feature. I'm therefore voicing my support for it and hoping that it will be implemented for this project.
27 remaining items
mikezila commentedon Aug 8, 2022
Could we at least get some rationale or an alternative solution to this problem rather than just a cowardly silent close? This is a very real shortfall that undermines the entire stated purpose of toolboxes. That there are so many proposed fixes and real examples as to why they're needed and yet we get no response is tone deaf.
tazihad commentedon Aug 8, 2022
while having same home folder is convenient for average desktop user. But it's not ideal for developers. Who likes to try bunch of program to try in separate toolbox.
So, I don't use toolbox in Fedora Kinoite anymore. I always use distrobox.
You can have separate home in your choosing location.
xrishox commentedon Aug 8, 2022
i'm also using silverblue and have also switched to distrobox. on top of supporting this feature it also natively and actively goes out of it's way to support running non-fedora distros inside of their containers.
inikishev commentedon Sep 5, 2022
is there any reason not to use this solution though? Also what is the correct way of using it, do I add it to the end of .bashrc?
inikishev commentedon Sep 6, 2022
okay so although i dont really know what i am doing, from what i can tell it seems to work when you add it just before "unset rc". After doing that when I do cd ~ in a toolbox it goes to the folder. One issue is that after you enter a toolbox you need to write cd ~ to actually go to it's new home dir, I wonder if that is possible to do automatically. I tried adding "cd ~" to the script but I am assuming thats not how it works because it stopped the whole thing from working.
Anyway still is there any disadvantage to using that approach?
Enteleform commentedon Sep 1, 2024
@debarshiray
It would be helpful to pick a primary thread (#183, #320, #331, #348, #1044, #1470, #1510) for this issue and reopen it, so that people can be notified when the issue is resolved. #183 and #348 are good candidates, as they have the most activity and dialog surrounding the issue.
It is apparent that this issue is affecting many people, as evidenced by the numerous duplicates of the issue and the extensive ongoing dialog.
Keeping an issue open would:
debarshiray commentedon Oct 10, 2024
The primary issue is #183 Aren't you getting notifications from updates to it?
trarer commentedon Dec 1, 2024
In general Linux, the command to change the HOME path is:
However, the premise for this command to be executed effectively is that the user cannot log in. This command can only be executed by using this user to log in to this container. This is a dead loop. Currently, toolbx does not seem to provide a way for other users to log in.
gattolfo98 commentedon Feb 23, 2025
I'm surprised that is not a base feature of toolbox, i think adding this can help al lot of people that want to maintain their home clear.
dub1401 commentedon Feb 25, 2025
It's really a very strange inexplicable reluctance to do basic things. Is there any hope that you can accept a high-quality Pull Request, if there is one?
gattolfo98 commentedon Feb 28, 2025
There is more than one issue about this and apparently there is a not a insignificant number of people interested in this feature, but the issues are closed (Not planned) so i don't know if is because there is a technical reason or they have other things more important or just they don't want to implement that.
debarshiray commentedon Jun 3, 2026
#1044 is more appropriate.
debarshiray commentedon Jun 3, 2026
Duplicate of #1044
debarshiray commentedon Jun 3, 2026
It turned out that this was a regression in the Go implementation. See #1564