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 already have a container based development workflow (using manually created systemd.nspawn containers) but would like to switch over to a properly maintained solution like toolbox.
I have several customers that I need to keep separate from each other. In my current workflow I have a root-owned folder in ~/.local/share/machines, with sub-folders owned by my user.
When I start my development container, it checks for ~/.local/share/machine/<CONTAINER_NAME> and if that exists, then it bind-mounts that as my home directory into the container. It also bind-mounts the ~/Download folder into all container images, so that I can (ab-)use that to transfer data between different containers;-) That way I can have private keys and whatever other customer related information separate from each other and not even available to programs that can access my home directory (as they can not enter ~/-local/share/machines as that is only accessible by root:-)
If there is no folder with the same name as the container in ~/.local/share/machines, then I mount the normal /home/USERNAME (much less sophisticated than what toolboox does!)
Would a similar setup be possible somehow using toolbox? I did not find anything in the manual pages, so I think this can be considered a feature request;-)
Reacted by nodefourtytwo, 大関 金城 秀喜 カシオ, Zihad, William Vandervalk, ErrorNoInternet, Cleo Menezes Jr., Roger Binns, Raura and JaneSmith
I doubt it is useful anywhere but in my specific setup: I generate container filesystems from a configuration file and the same file also generates systemd-nspawn settings and a start script.
My setup is strictly less useful than toolbox: I have to restart my containers whenever the network changes:-/
Would using bubblewrap outside toolbox to do the bind mounting work for you? Something like:
bwrap --bind $HOME/.local/share/machine/<CONTAINER_NAME> $HOME toolbox enter ...
Actually, since the toolboxes are themselves stored in the home dir, I think under .config/toolbox and .local/share/containers, you'd have your choice of either starting out with those within your container -- meaning, you created the toolbox with:
Or, first bind mounting your own .config/toolbox and .local/share/containers into your container with initial --bind options to that bwrap toolbox enter call. I'd probably choose the create-toolbox-within-bwrap case because I don't have a clue what sharing those toolbox folders across multiple users would do - so one per container seems safest.
I also have container-based systems I'm in the process of testing out with toolbox. I'm not sure bwrap and toolbox work together, but I might try something like this myself.
#348 so in this thread there seems to be a programming code that you can add into your ".bashrc" before "unset rc" line, and it will work. Although I don't know if using this approach has any disadvantages.
Yes, this is something that has come up before several times. Unfortunately, doing this properly is going to be a lot of work.
Various people have come up with various hacks that work for their specific use-case. eg., some folks run toolbox with a overriden HOME.
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.
Hey @debarshiray, I'm interested in working on this. I don't think this is a duplicate of #183
For example there are many local configuration files that are useful to have unique across different containers (apart from any security concerns), you might want to test a containerfile without any configuration from the system home interfering, etc. I find myself using distrobox for that purpose.
Do you have thoughts on the design/concerns about a simple approach that just binds a configurable home directory as a flag? I'm happy to file a PR and iterate on this.
Any updates on this? I create .spec files for COPR in a toolbox (some build packages are conflicting with my host packages). However, a bunch of programs I use within the container keep creating cache files in my home directory, which is really annoying. rpmbuild also creates a rpmbuild directory in my home directory (I know its possible to use a different directory, but sometimes I forget to do that). I would love to be able to set a custom home directory, or automatically use a different home directory for each container (with an option to just share the user's home directory, of course).
Any updates on this? I create .spec files for COPR in a toolbox (some build packages are conflicting with my host packages). However, a bunch of programs I use within the container keep creating cache files in my home directory, which is really annoying. rpmbuild also creates a rpmbuild directory in my home directory (I know its possible to use a different directory, but sometimes I forget to do that). I would love to be able to set a custom home directory, or automatically use a different home directory for each container (with an option to just share the user's home directory, of course).
What if you temporarily overrode HOME when using the Toolbx container?
Yes, that's my current solution but I have to manually do it every time for toolbox enter, and I sometimes forget.
Some apps still use /home/ instead of $HOME though.
please mention the info to override the $HOME env-variable,
along with a general note - that actions inside a toolbox's bind-mounted paths , e.g. ~/.dot-directories like ~/.cache/fontconfig/ - might cause sideeffects for the user in the host env.
From the Quick Docs
Containers are a good way to isolate and organise the dependencies needed for different projects.
Which is misleading as the use of /home would not keep it organized. . .
It looks like Go's os/user isn't respecting the HOME environment variable:
user.Current() gives the current user information with their uisual home directory. os.UserHomeDir() gives the current user's home directory as it's been set or overridden.
It looks like Go's os/user isn't respecting the HOME environment variable:
user.Current() gives the current user information with their uisual home directory. os.UserHomeDir() gives the current user's home directory as it's been set or overridden.
Bingo! That might be it. Thank you for figuring it out.
Activity
nodefourtytwo commentedon Jun 13, 2022
If you wrote a script for your workflow, would you care sharing it?
hunger commentedon Jun 17, 2022
I doubt it is useful anywhere but in my specific setup: I generate container filesystems from a configuration file and the same file also generates systemd-nspawn settings and a start script.
My setup is strictly less useful than toolbox: I have to restart my containers whenever the network changes:-/
jonleivent commentedon Jul 26, 2022
Would using bubblewrap outside toolbox to do the bind mounting work for you? Something like:
Actually, since the toolboxes are themselves stored in the home dir, I think under .config/toolbox and .local/share/containers, you'd have your choice of either starting out with those within your container -- meaning, you created the toolbox with:
Or, first bind mounting your own .config/toolbox and .local/share/containers into your container with initial --bind options to that bwrap toolbox enter call. I'd probably choose the create-toolbox-within-bwrap case because I don't have a clue what sharing those toolbox folders across multiple users would do - so one per container seems safest.
I also have container-based systems I'm in the process of testing out with toolbox. I'm not sure bwrap and toolbox work together, but I might try something like this myself.
jonleivent commentedon Jul 26, 2022
Oh - sorry - those bwrap calls should all have
--dev-bind / /first. I keep forgetting that.inikishev commentedon Sep 6, 2022
#348 so in this thread there seems to be a programming code that you can add into your ".bashrc" before "unset rc" line, and it will work. Although I don't know if using this approach has any disadvantages.
debarshiray commentedon Oct 27, 2022
Yes, this is something that has come up before several times. Unfortunately, doing this properly is going to be a lot of work.
Various people have come up with various hacks that work for their specific use-case. eg., some folks run
toolboxwith a overridenHOME.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.
debarshiray commentedon Oct 27, 2022
Thanks for your interest in Toolbx.
mjlbach commentedon Mar 25, 2023
Hey @debarshiray, I'm interested in working on this. I don't think this is a duplicate of #183
For example there are many local configuration files that are useful to have unique across different containers (apart from any security concerns), you might want to test a containerfile without any configuration from the system home interfering, etc. I find myself using distrobox for that purpose.
Do you have thoughts on the design/concerns about a simple approach that just binds a configurable home directory as a flag? I'm happy to file a PR and iterate on this.
ErrorNoInternet commentedon Apr 23, 2023
Any updates on this? I create .spec files for COPR in a toolbox (some build packages are conflicting with my host packages). However, a bunch of programs I use within the container keep creating cache files in my home directory, which is really annoying. rpmbuild also creates a
rpmbuilddirectory in my home directory (I know its possible to use a different directory, but sometimes I forget to do that). I would love to be able to set a custom home directory, or automatically use a different home directory for each container (with an option to just share the user's home directory, of course).debarshiray commentedon Jun 28, 2023
What if you temporarily overrode
HOMEwhen using the Toolbx container?ErrorNoInternet commentedon Jun 29, 2023
Yes, that's my current solution but I have to manually do it every time for
toolbox enter, and I sometimes forget.Some apps still use /home/ instead of $HOME though.
ffimnsr commentedon Oct 26, 2023
I think it's simple to create a wrapper script for the problem above. It is not the best design but that works great for me.
juhp commentedon Oct 30, 2023
Doesn't seem to work for me (only seems to duplicate the podman/toolbox configs now):
I feel this highly requested feature could be implemented and polished incrementally:
it doesn't have to be perfect out of the door IMHO.
debarshiray commentedon Feb 1, 2024
It looks like Go's os/user isn't respecting the
HOMEenvironment variable:christiansam commentedon Mar 10, 2024
somewhere at: https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/
superuser-miguel commentedon Jun 18, 2024
From the Quick Docs
Which is misleading as the use of /home would not keep it organized. . .
SolarLune commentedon Aug 18, 2024
user.Current()gives the current user information with their uisual home directory.os.UserHomeDir()gives the current user's home directory as it's been set or overridden.Running this, for example:
with the command
HOME=~/test/ go run ./main.goworks.So, replacing
user.HomeDirattoolbox/src/cmd/run.go
Line 440 in b684b19
toolbox/src/cmd/create.go
Line 306 in b684b19
os.UserHomeDir()might resolve the issue?debarshiray commentedon Oct 10, 2024
Bingo! That might be it. Thank you for figuring it out.
I have filed a new issue to track this: #1564
Do you want to submit a pull request for it?
cmd/create, cmd/run, cmd/utils: Unbreak overriding the HOME variable
test/system: Isolate the host's HOME from the system tests
pkg/utils: Preserve HOME environment variable when forwarding to host