Skip to content

common-utils not installing ZSH correctly if devcontainer is based on pre-build without ZSH #647

@ankudinov

Description

@ankudinov

I'm testing devcontainers/ci for my builds currently.
The plan is:

  • build base (Python slim, low size, no ZSH)
  • build dev (from base with ZSH, d-in-d, etc.)

When base is pre-build with "installZsh": false and "installOhMyZsh": false,
building dev with both parameters set to true will result in no ZSH installed.

Same if I'm trying to build dev locally from pre-build base.

Here is the marker file for the base container:

$ cat /usr/local/etc/vscode-dev-containers/common
    PACKAGES_ALREADY_INSTALLED=true
    LOCALE_ALREADY_SET=true
    EXISTING_NON_ROOT_USER=vscode
    RC_SNIPPET_ALREADY_ADDED=true
    ZSH_ALREADY_INSTALLED=

I can see the following log for the dev build:

  #22 0.074 ===========================================================================
  #22 0.074 Feature       : Common Utilities
  #22 0.074 Description   : Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.
  #22 0.074 Id            : ghcr.io/devcontainers/features/common-utils
  #22 0.074 Version       : 2.0.11
  #22 0.074 Documentation : https://github.com/devcontainers/features/tree/main/src/common-utils
  #22 0.074 Options       :
  #22 0.074     INSTALLZSH="true"
  #22 0.074     CONFIGUREZSHASDEFAULTSHELL="true"
  #22 0.074     INSTALLOHMYZSH="true"
  #22 0.074     UPGRADEPACKAGES="false"
  
  
  [2023-08-10T13:03:09.443Z] #22 0.074     USERNAME="vscode"
  #22 0.074     USERUID="1000"
  #22 0.074     USERGID="1000"
  #22 0.074     NONFREEPACKAGES="false"
  #22 0.074 ===========================================================================
  #22 0.086 Marker file found:
  #22 0.088     PACKAGES_ALREADY_INSTALLED=true
  #22 0.088     LOCALE_ALREADY_SET=true
  #22 0.088     EXISTING_NON_ROOT_USER=vscode
  #22 0.088     RC_SNIPPET_ALREADY_ADDED=true
  #22 0.088     ZSH_ALREADY_INSTALLED=
  #22 0.114 chsh: Warning: /bin/zsh does not exist
  
  
  [2023-08-10T13:03:09.593Z] #22 0.138 Cloning into '/home/vscode/.oh-my-zsh'...

I don't see any attempt to run following code in the logs:

# Install zsh (and recommended packages) if needed
if [ "${INSTALL_ZSH}" = "true" ] && ! type zsh > /dev/null 2>&1; then
apt-get install -y zsh
fi

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions