It was working great, but when I rebuilt a toolbox image dervied from ubuntu-toolbox, suddenly $SHELL is /bin/sh and /etc/passwd shows my toolbox user has /bin/sh as its shell. I note that my toolbox script has not changed, and neither has my ubuntu-toolbox container image. I suspect this is the unintended consequence of a sudo apt-get update in a proprietary installer I am running in a derived toolbox image. Haha no actually that's my fault for alias cat=bat recently, which is of course a terrible blunder and I have undone that, but perhaps that's also another bug in the toolbox script - not specifying the full path to cat? I see that even with cat unaliased, when I enter that toolbox, my $SHELL is /bin/sh, as configured in /etc/passwd, contrary to my desires.
I see in the toolbox script that you are using useradd. On Ubuntu systems, useradd is considered "low level", intended to add both human users and system users, and so the default shell for useradd (configured in /etc/default/useradd) is set to /bin/sh. For interactive users, Ubuntu would prefer that you use adduser instead. Ubuntu further optimises sh by using a fast shell called dash instead.
In my Dockerfile for toolboxen derived from ubuntu-toolbox, I am in fact disabling the dash optimisation because it doesn't play nice with some proprietary tools I'm using.
As a work-around, I could set the system-wide default in the Ubuntu toolbox with sudo useradd -D -s /bin/bash. However, I am concerned about possible unintended consequences for system users added thereafter when packages are installed.
In this context, toolbox is adding an interactive user (usually) and so should use the shell that the interactive user would like to use. So my request is, please add the -s ${TOOLBOX_SHELL} argument to your use of useradd in the toolbox script.
All that said: I tried adding the -s ${TOOLBOX_SHELL} to my local toolbox script and it didn't work, and useradd says that my user already exists in the toolbox, which I find confusing since I am creating a new toolbox and have previously deleted all of the locally cached images with podman rmi. It looks to me like the base ubuntu-toolbox doesn't add a user and it looks like toolbox does add the user on the first create, so I'm confused.
Since I can't work it out, I have resorted to adding:
I'm on OpenSuSE with an Ubuntu Toolbox built according to the toolbox-images/images Ubuntu 20.04 Containerfile.
It was working great, but when I rebuilt a toolbox image dervied from
ubuntu-toolbox
, suddenly$SHELL
is/bin/sh
and/etc/passwd
shows my toolbox user has/bin/sh
as its shell. I note that mytoolbox
script has not changed, and neither has myubuntu-toolbox
container image.I suspect this is the unintended consequence of aHaha no actually that's my fault forsudo apt-get update
in a proprietary installer I am running in a derived toolbox image.alias cat=bat
recently, which is of course a terrible blunder and I have undone that, but perhaps that's also another bug in thetoolbox
script - not specifying the full path tocat
? I see that even withcat
unaliased, when I enter that toolbox, my$SHELL
is/bin/sh
, as configured in/etc/passwd
, contrary to my desires.I see in the
toolbox
script that you are usinguseradd
. On Ubuntu systems,useradd
is considered "low level", intended to add both human users and system users, and so the default shell foruseradd
(configured in/etc/default/useradd
) is set to/bin/sh
. For interactive users, Ubuntu would prefer that you useadduser
instead. Ubuntu further optimisessh
by using a fast shell calleddash
instead.In my Dockerfile for toolboxen derived from
ubuntu-toolbox
, I am in fact disabling thedash
optimisation because it doesn't play nice with some proprietary tools I'm using.As a work-around, I could set the system-wide default in the Ubuntu toolbox with
sudo useradd -D -s /bin/bash
. However, I am concerned about possible unintended consequences for system users added thereafter when packages are installed.In this context,
toolbox
is adding an interactive user (usually) and so should use the shell that the interactive user would like to use. So my request is, please add the-s ${TOOLBOX_SHELL}
argument to your use ofuseradd
in thetoolbox
script.All that said: I tried adding the
-s ${TOOLBOX_SHELL}
to my localtoolbox
script and it didn't work, anduseradd
says that my user already exists in the toolbox, which I find confusing since I am creating a new toolbox and have previously deleted all of the locally cached images withpodman rmi
. It looks to me like the baseubuntu-toolbox
doesn't add a user and it looks liketoolbox
does add the user on the first create, so I'm confused.Since I can't work it out, I have resorted to adding:
and that works.