Skip to content
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

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

Closed
ankudinov opened this issue Aug 10, 2023 · 3 comments · Fixed by #649
Closed
Assignees

Comments

@ankudinov
Copy link

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

ankudinov added a commit to ankudinov/avd-devcontainer that referenced this issue Aug 10, 2023
@samruddhikhandale
Copy link
Member

Hi 👋

Thanks for opening the issue, I wasn't able to reproduce the issue.
I tested the common-utils Feature on top of a simple python image ; the Feature seems to have installed zsh and oh-my-zsh fine, see 👇

image

When base is pre-build with "installZsh": false and "installOhMyZsh": false,

However, the only difference is that I am not using a base image with ^ config. @ankudinov Would it be possible for you to provide a sample repro (ie dev container) for testing? Thanks!

@ankudinov
Copy link
Author

Thank you for looking into this issue!
I've created a repo that is dedicated for this: https://github.com/ankudinov/base-for-647
The base image is pulled from: docker pull ghcr.io/ankudinov/base-for-647/base:rev1.0
If you clone the repo and start the local devcontainer: https://github.com/ankudinov/base-for-647/blob/master/.devcontainer/devcontainer.json
The devcontainer will finish the build successfully, but an attempt to open the VSCode terminal will fail with "no /bin/zsh" error.

@samruddhikhandale
Copy link
Member

Thanks for the update, I was able to repro the issue. Opened #649 with the fix ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants