-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust home path #348
Comments
I usually just do |
Yeah, overriding |
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
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 Basically, I think it would be great if Toolbox had a user-friendly way to set up a container in one of three modes:
|
This sounds very reasonable to me. What do you think @debarshiray?? |
I support this @JaneSmith , all I need - nicely put! |
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 mkdir ~/somedev && echo export HOME=/home/user/somedev > ~/somedev/.envrc I currently use a similar work flow. |
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 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 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. So you'd have a "middle-ground" here as a new default. |
tlbx fork has a |
Duplicate of #183 |
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. |
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. |
@JaneSmith why not use a fork if it has the features you need? |
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. |
@JaneSmith I agree on all points. I expect the feature will be implemented the first time the current insecure design is publicized to play a part in a security breach, if not sooner. |
The first sentence in the docs says it runs _fully unprivileged _. Sounds secure, huh? Also in the main description: The intention of these systems is to discourage installation of software on the host, and instead install software as (or in) containers. Also sounds like this project must add significant security. Nowhere do the docs highlight that it's sharing every document your user owns with with every container, including SSH keys and files unrelated to what's happening in the container. The current situation is not only insecure, but misleads to convey that using containers like this provides significant security, when it's hardly the case the containers can access all your files! If you search for "home" in the README, there is no documentation that your home directory is shared in this way. |
I want this too. A middle ground (home accessible, but not defined as HOME), and a more untrusted mode (home not accessible at all).
If a middle ground solution is this simple... then why can't it be implemented into Toolbox as an option? Just take the home path as an argument when creating the toolbox and save it somewhere, probably the same way as how the container name is saved. Then read that path and set it when entering the container... |
Relates to issues containers#183, containers#348, containers#467 Added optional boxhome argument to create command. Boxhome is concatenated with homedir in order to be under host's home dir. Homedir is still mounted. No worries. Being under host's home enables easy file sharing, and prevents privilage issues. When boxhome argument is not given, system works as before (uses user's home dir)
To make things a bit more concrete:
So for example if I have source directories in ~/Projects, need to sign things with gpg and need ssh to connect to a server and my git config I could create a toolbox like this:
So is this something would be accepted upstream? I would even work on this if the plan makes sense. |
Relates to issues containers#183, containers#348, containers#467 Added optional boxhome argument to create command. Boxhome is concatenated with homedir in order to be under host's home dir. Homedir is still mounted. No worries. Being under host's home enables easy file sharing, and prevents privilage issues. When boxhome argument is not given, system works as before (uses user's home dir)
Merge branch 'boxhome' of github.com:onuruluag/toolbox into boxhome Added optional boxhome argument to create command. Boxhome is concatenated with homedir in order to be under host's home dir. Homedir is still mounted. No worries. Being under host's home enables easy file sharing, and prevents privilage issues. When boxhome argument is not given, system works as before (uses user's home dir):
Relates to issues containers#348, containers#467 Added optional boxhome argument to create command. Boxhome is concatenated with homedir in order to be under host's home dir. Homedir is still mounted. No worries. Being under host's home enables easy file sharing, and prevents privilage issues. When boxhome argument is not given, system works as before (uses user's home dir)
Relates to issues containers#348, containers#467 Added optional boxhome argument to create command. Boxhome is concatenated with homedir in order to be under host's home dir. Homedir is still mounted. No worries. Being under host's home enables easy file sharing, and prevents privilage issues. When boxhome argument is not given, system works as before (uses user's home dir)
Is there any update on this issue? It looks like |
i would like to see support added for this. not only do i not want my toolboxes polluting my home dir, sometimes i want different toolboxes to have configurations that would conflict with eachother. i also want my toolboxes to be entirely portable. i want to be able to export the image from 1 machine, import them into another machine and keep all of my configuration i've done. on top of that being able to fully back up these environments would be really nice too. that said i do like having access to my native home directory structure from inside the toolbox. i don't want my native home to not be mounted at all, i just don't want it to be the home inside of the toolbox. having functionality to support this would be absolutely awesome. |
Maybe use |
The problem isn't the source code but all the build and runtime tools which have state somewhere in $HOME. |
Can't those be redirected by overriding some default configuration for those toolchains somewhere? Just curious. |
Some do, some don't, sometimes they are used by other tools which don't let you pass the necessary config. Either way it requires much better knowledge of the tools you're using, more complexity you have to deal with and that makes it a lot more error prone. I understand the reluctance to add this feature but I don't really see another way to get a somewhat decent UX. |
I desperately want this feature. This issue has been here for two years now and there's obviously still a lot of support for it. Can I ask why this issue is marked as Closed instead of Open? It was originally marked as Closed on the 18th of May, 2020, as a "duplicate" of #183. However, as has since been pointed out, they're separate issues:
They're two separate issues, so it seems to me that it was invalid to Close it originally as a duplicate. Given the amount of discussion since then, the repeated requests for the feature, people even forking to try to implement it... Could this issue be Opened? Earlier today I read a blog post from Christian F.K. Schaller, about Fedora's vision for the Linux Desktop. It talks about all the main modern innovations, such as OSTree, Flatpak, Silverblue, PipeWire, Wayland — and also Toolbox. The article claims that using Toolbox for containers improves over traditional development by reducing cross-contamination between projects, as you can have one container for each project. Here's a direct quote:
They literally say "ensures that there is no risk". But this is objectively false, because of this specific issue. Sure, you can have separate containers... but if they're sharing the same home directory, there is indeed still cross-contamination. Look at what another person posted earlier in this discussion thread, about how building something that uses Rust polluted the home directory with 800+ MB of stuff. Is this not completely contradictory to the above quote? Now both containers are contaminated with others' dependencies. The article concludes by saying that their vision is for these things to become more mainstream, and they want developers to embrace the pet container model. Well, I would love to embrace the pet container model! Absolutely... But this issue is the main thing holding me back from doing so. In fact, specifically because of this one issue, I spin up entire virtual machines as my "pet containers" instead. This is because I do not want my containers to have cross-contamination, and I do not want my normal home directory to be polluted by all sorts of random development junk. Having to use whole VMs is massively more inconvenient than what Toolbox would offer, but I have to because this crucial feature is not being implemented. Please seriously consider this feature. I'm not a developer for this project and am not familiar with how it is implemented, but to me it seems like something incredibly simple to implement and maintain. It doesn't seem like a highly complex feature that needs thousands of lines of code and constant maintenance to keep working. It's a simple thing that would have an enormous impact on how this software can be used. |
I think it has grown into a contention point and I have given up on it being implemented. Before I go on more detail I want say that was and still kind of am a fan of this project and I understand how hard it is to maintain an opensource project in which people request features without suggesting ways of implementing it or without having to deal with test cases and build failures. But I am going to point out my opinions on this topic for the last time. I also want it to be known that all criticisms arise from my love of the idea behind the project because it think it is exceptionally brilliant one.
Because of all the above issues I was not able to keep using toolbox. But I still stuck with the wonderful idea behind it all the idea of pet containers using podman. People have written several alternatives from simple ones that just manipulate command line arguments to podman to more complicated api level implementations. I am going to list out a few incase people running to this issue might find alternatives.
ps. there might be others I don't know about so we might share them to compare implementations and incase they might be helpful to people facing similar issues. People reporting in issue #183, #331, #320 might find this useful |
@yilkalargaw There's a typo in the |
Thanks @markstos I think I have corrected it. |
@yilkalargaw thank you for the write-up, couldn't agree more. I do work for multiple teams inside our business, and every team / project that I need to run and test has it's own little quirks or patches. I used to run Windows Subsystem for Linux, and it was nice that you could just run completely separate (actually Hyper-V containerized) environments side-by-side. I installed Fedora in the hopes that I could use toolbox in a similar way; Unfortunately the home-directory is shared by default indeed. I guess this can probably be overcome with some scripting here and there and/or using a non-default image. I will instead look into the alternatives you list. The alternatives weren't stable enough and/or required similar hacks that can make this work on toolbox making me doubt about them. |
I think the hard part in this issue is that OCI-containers are created immutably. One of the main components of However, the home-directory is not mounted using this entrypoint. Instead, when As far as I can tell there are two ways to go here (user =
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
|
@maxboone What is this |
Hmm, I thought it was created by the toolbox init script but that seemingly only creates .toolboxenv. Let me check. Seemingly that's a file that podman should create: Unfortunately, the In any case, I have removed toolbox from my system and might fork the project to make it depend less on podman, work with docker & nerdctl as well and allow more customization. Using the |
Why this issue is closed? |
how is this not a standard feature. anyone who programs rust with a toolbox is going to have a polluted home folder like i found out mine was after installing rustup in a toolbox. big mistake. this needs to be added asap imho. |
@debarshiray You couldn't at least respond to all the extensive feedback and explain why this isn't planned? :( |
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. |
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. |
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? |
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:
|
The primary issue is #183 Aren't you getting notifications from updates to it? |
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. |
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
The text was updated successfully, but these errors were encountered: