containers / toolbox

Tool for interactive command line environments on Linux
https://containertoolbx.org/
Apache License 2.0
2.47k stars 211 forks source link

/home inside toolbox should not be symlink even though outside ostree has it linked to /var/home #1078

Open jonleivent opened 2 years ago

jonleivent commented 2 years ago

I am using Kinoite (fully updated). Which has /home symlinked to /var/home. When I create a default toolbox, hence Fedora based, inside the toolbox /home is still symlinked to /var/home. Some software doesn't like symlinked /home. In my case, I was testing firejail within the toolbox, which does its own mounting over /home, and so expects /home to be a directory.

My attempted solution, which failed, was to rm /home, replace it with a dir to the user's home, and mount /var/home/user over that within the toolbox:

toolbox enter
sudo rm /home
sudo mkdir -p /home/user
sudo mount -B /var/home/user /home/user

This worked up until I rebooted the Kinoite machine and tried re-entering the toolbox. What happened is that the mount I set up persisted until I rebooted, then vanished and the toolbox was left with a vacant /home/user. At which point I got the following error:

Error: invalid entry point PID of container fedora-toolbox-36

and no way to re-enter the toolbox. I had to toss the toolbox and start over. I didn't expect such a bad result from an empty /home/user dir, but I guess toolbox was expecting something to be there?

So, my request is for a way around this problem. I think somehow toolbox itself should be responsible for arranging the internal / hierarchy to not look ostree-based with symlinks. After all, there probably is other software that people would like to use within a toolbox that expects a standard / hierarchy without symlinks.

Short of that (or until that happens), I have other ideas: maybe I need to setup something like /etc/rc.local within the toolbox to repair the mount? Would setting up /etc/fstab to do the mount within the toolbox work? I can't find any documentation on what happens on entrance into a toolbox. Anyone know what might work?

debarshiray commented 2 years ago

There were a few iterations over the nuances of how a user's $HOME is set up in Fedora Silverblue. eg., whether $HOME should be set to the /home symbolic link or to the final location in /var/home. This was important because it had subtle effects on things like when Bash would show a location as ~ in a terminal emulator and when not.

The current set-up seems to be holding OK so far.

Toolbx tries to replicate the same set-up. If Toolbx was to go and invent another scheme, it would only add to the confusion.

At this point, I would suggest fixing Firejail to not assume that /home is a directory that holds all the home directories of users. Is there something that forces it to make that assumption? Can't it check $HOME and use the parent directory?