This article below describes a similar approach as distrobox:
However, I have tmux as my default shell. My ~/.bashrc includes the following to make sure tmux is only ran with an interactive shell. However, toolbox --container fedora-toolbox run sudo dnf upgrade --quiet --refresh --assumeyes is also regarded as an interactive shell. Which doesn’t allow me to run that dnf upgrade command. It goes to an empty tmux shell.
if [[ -n "$DISPLAY" ]]; then # Only continue if in a GUI environment
if [[ -z "$SSH_CLIENT" ]] || [[ -z "$SSH_TTY" ]] && [[ -f /run/.toolboxenv ]]; then # Only continue if not in an SSH session
if command -v tmux &> /dev/null && [[ -z "$TMUX" ]]; then # Only continue if tmux is installed and not already started
exec tmux -2
fi
fi
fi
Which makes me wonder. How do you update your toolbox containers automatically? A different update approach might work as well.
If you’re embedding that command in a systemd unit, how do you know that it’s going into an empty tmux shell?
Also, are you certain “fedora-toolbox” is your container name? The default naming convention that’s used is “fedora-toolbox-##”. That’s what’s created when toolbox create is executed, and “##” being the Fedora release number that was used when that command was executed.
It’s custom indeed, because I build my custom Fedora toolbox. Since Toolbox doesn’t have an easy way to template containers (like Distrobox), I created my own build with overlay packages. That’s why I also have a custom name for the container.
Then it works. The method described in that blog post in the top post indeed works, but tmux intercepts it.
But I think nobody here auto-updates their container (in any other way). It sucks a bit, since distrobox makes this so easy and then it does work with tmux as default shell in bashrc.