microsoft / microsoft/vscode-remote-release
Backslash in username causes chown to fail during image build
Open
@chrmarti is already working on this.
Since Apr 25, 2023.
bug
containers
- Dominant language
- Dockerfile
- Stars
- 4.2k
- Forks
- 470
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
- VSCode Version:
Version: 1.77.3 (user setup) Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710 Date: 2023-04-12T09:16:02.548Z Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Windows_NT x64 10.0.22621 Sandboxed: No - Local OS Version: Windows 11
- Remote OS Version: AlmaLinux 8
- Remote Extension/Connection Type: Containers
- Logs:
[2023-04-21T20:01:25.015Z] Dev Containers 0.288.1 in VS Code 1.77.3 (704ed70d4fd1c6bd6342c436f1ede30d1cff4710). [2023-04-21T20:01:25.015Z] Start: Resolving Remote [2023-04-21T20:01:25.033Z] Start: Run: ssh sandbox.pstat.ucsb.edu /bin/sh [2023-04-21T20:01:25.042Z] Start: Run in host: id -un [2023-04-21T20:01:25.489Z] NETID\syoh [2023-04-21T20:01:25.490Z] [2023-04-21T20:01:25.490Z] Stop (448 ms): Run in host: id -un [2023-04-21T20:01:25.491Z] Start: Run in host: cat /etc/passwd [2023-04-21T20:01:25.496Z] Stop (5 ms): Run in host: cat /etc/passwd [2023-04-21T20:01:25.497Z] Start: Run in host: echo ~ [2023-04-21T20:01:25.502Z] /home/NETID/syoh [2023-04-21T20:01:25.502Z] [2023-04-21T20:01:25.502Z] Stop (5 ms): Run in host: echo ~ [2023-04-21T20:01:25.502Z] Start: Run in host: test -x '/home/NETID/syoh/.vscode-remote-containers/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node' [2023-04-21T20:01:25.505Z] [2023-04-21T20:01:25.506Z] [2023-04-21T20:01:25.506Z] Exit code 1 [2023-04-21T20:01:25.506Z] Stop (4 ms): Run in host: test -x '/home/NETID/syoh/.vscode-remote-containers/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node' [2023-04-21T20:01:25.506Z] Start: Run in host: test -x '/home/NETID/syoh/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node' [2023-04-21T20:01:25.510Z] [2023-04-21T20:01:25.510Z] [2023-04-21T20:01:25.510Z] Stop (4 ms): Run in host: test -x '/home/NETID/syoh/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node' [2023-04-21T20:01:25.511Z] Start: Run in host: test -f '/home/NETID/syoh/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node_modules/node-pty/package.json' [2023-04-21T20:01:25.514Z] [2023-04-21T20:01:25.514Z] [2023-04-21T20:01:25.514Z] Stop (3 ms): Run in host: test -f '/home/NETID/syoh/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node_modules/node-pty/package.json' [2023-04-21T20:01:25.515Z] Start: Run in host: test -f '/home/NETID/syoh/.vscode-remote-containers/dist/vscode-remote-containers-server-0.288.1.js' [2023-04-21T20:01:25.518Z] [2023-04-21T20:01:25.518Z] [2023-04-21T20:01:25.518Z] Stop (3 ms): Run in host: test -f '/home/NETID/syoh/.vscode-remote-containers/dist/vscode-remote-containers-server-0.288.1.js' [2023-04-21T20:01:25.521Z] userEnvProbe: loginInteractiveShell (default) [2023-04-21T20:01:25.521Z] userEnvProbe: not found in cache [2023-04-21T20:01:25.522Z] userEnvProbe shell: /bin/sh [2023-04-21T20:01:25.812Z] userEnvProbe PATHs: Probe: '/home/NETID/syoh/.local/bin:/home/NETID/syoh/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin' Container: None [2023-04-21T20:01:25.815Z] Setting up container for folder or workspace: /home/NETID/syoh/id-bug [2023-04-21T20:01:25.815Z] Host: ssh://sandbox.pstat.ucsb.edu [2023-04-21T20:01:25.816Z] Start: Run: wsl -d podman-machine-default -e /bin/sh -c echo ~ [2023-04-21T20:01:25.963Z] Stop (147 ms): Run: wsl -d podman-machine-default -e /bin/sh -c echo ~ [2023-04-21T20:01:25.965Z] Start: Run: wsl -d podman-machine-default -e /bin/sh -c cd '/home/user' && /bin/sh [2023-04-21T20:01:25.969Z] Start: Run in host: id -un [2023-04-21T20:01:26.087Z] user [2023-04-21T20:01:26.087Z] [2023-04-21T20:01:26.087Z] Stop (118 ms): Run in host: id -un [2023-04-21T20:01:26.087Z] Start: Run in host: cat /etc/passwd [2023-04-21T20:01:26.089Z] Stop (2 ms): Run in host: cat /etc/passwd [2023-04-21T20:01:26.089Z] Start: Run in host: echo ~ [2023-04-21T20:01:26.090Z] /home/user [2023-04-21T20:01:26.090Z] [2023-04-21T20:01:26.090Z] Stop (1 ms): Run in host: echo ~ [2023-04-21T20:01:26.090Z] Start: Run in host: test -x '/home/user/.vscode-remote-containers/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node' [2023-04-21T20:01:26.090Z] [2023-04-21T20:01:26.091Z] [2023-04-21T20:01:26.091Z] Exit code 1 [2023-04-21T20:01:26.091Z] Stop (1 ms): Run in host: test -x '/home/user/.vscode-remote-containers/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node' [2023-04-21T20:01:26.091Z] Start: Run in host: test -x '/home/user/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node' [2023-04-21T20:01:26.092Z] [2023-04-21T20:01:26.092Z] [2023-04-21T20:01:26.092Z] Stop (1 ms): Run in host: test -x '/home/user/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node' [2023-04-21T20:01:26.092Z] Start: Run in host: test -f '/home/user/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node_modules/node-pty/package.json' [2023-04-21T20:01:26.093Z] [2023-04-21T20:01:26.093Z] [2023-04-21T20:01:26.093Z] Stop (1 ms): Run in host: test -f '/home/user/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node_modules/node-pty/package.json' [2023-04-21T20:01:26.093Z] Start: Run in host: test -f '/home/user/.vscode-remote-containers/dist/vscode-remote-containers-server-0.288.1.js' [2023-04-21T20:01:26.094Z] [2023-04-21T20:01:26.095Z] [2023-04-21T20:01:26.095Z] Stop (2 ms): Run in host: test -f '/home/user/.vscode-remote-containers/dist/vscode-remote-containers-server-0.288.1.js' [2023-04-21T20:01:26.095Z] userEnvProbe: loginInteractiveShell (default) [2023-04-21T20:01:26.095Z] userEnvProbe: not found in cache [2023-04-21T20:01:26.095Z] userEnvProbe shell: /bin/bash [2023-04-21T20:01:26.216Z] userEnvProbe PATHs: Probe: '/home/user/.local/bin:/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files (x86)/Pulse Secure/VC142.CRT/X64/:/mnt/c/Program Files (x86)/Pulse Secure/VC142.CRT/X86/:/mnt/c/Program Files (x86)/Common Files/Pulse Secure/TNC Client Plugin/:/mnt/c/Users/syoh/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/syoh/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/syoh/AppData/Local/Google/Cloud SDK/google-cloud-sdk/bin:/mnt/c/Program Files/RedHat/Podman' Container: None [2023-04-21T20:01:26.218Z] Start: Check Docker is running [2023-04-21T20:01:26.218Z] Start: Run in Host: podman version --format {{.Server.APIVersion}} [2023-04-21T20:01:26.331Z] Stop (113 ms): Run in Host: podman version --format {{.Server.APIVersion}} [2023-04-21T20:01:26.332Z] Server API version: 4.2.0 [2023-04-21T20:01:26.332Z] Stop (114 ms): Check Docker is running [2023-04-21T20:01:26.333Z] Start: Run in Host: podman volume ls -q [2023-04-21T20:01:26.430Z] Stop (97 ms): Run in Host: podman volume ls -q [2023-04-21T20:01:26.431Z] Start: Run in Host: podman ps -q -a --filter label=vsch.local.folder=/home/NETID/syoh/id-bug --filter label=vsch.quality=stable [2023-04-21T20:01:26.528Z] Stop (97 ms): Run in Host: podman ps -q -a --filter label=vsch.local.folder=/home/NETID/syoh/id-bug --filter label=vsch.quality=stable [2023-04-21T20:01:26.529Z] Start: Run in Host: podman ps -q -a --filter label=devcontainer.local_folder=/home/NETID/syoh/id-bug --filter label=devcontainer.config_file=/home/NETID/syoh/id-bug/.devcontainer/devcontainer.json [2023-04-21T20:01:26.623Z] Stop (94 ms): Run in Host: podman ps -q -a --filter label=devcontainer.local_folder=/home/NETID/syoh/id-bug --filter label=devcontainer.config_file=/home/NETID/syoh/id-bug/.devcontainer/devcontainer.json [2023-04-21T20:01:26.624Z] Start: Run in Host: podman ps -q -a --filter label=devcontainer.local_folder=/home/NETID/syoh/id-bug [2023-04-21T20:01:26.721Z] Stop (97 ms): Run in Host: podman ps -q -a --filter label=devcontainer.local_folder=/home/NETID/syoh/id-bug [2023-04-21T20:01:26.721Z] Start: Run in Host: podman ps -q -a --filter label=devcontainer.local_folder=/home/NETID/syoh/id-bug [2023-04-21T20:01:26.802Z] Stop (81 ms): Run in Host: podman ps -q -a --filter label=devcontainer.local_folder=/home/NETID/syoh/id-bug [2023-04-21T20:01:26.816Z] Start: Run in Host: /home/NETID/syoh/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/node /home/NETID/syoh/.vscode-remote-containers/dist/dev-containers-cli-0.288.1/dist/spec-node/devContainersSpecCLI.js up --docker-path podman --container-session-data-folder /tmp/devcontainers-ad430f5c-bf1d-4548-9091-202f698cc1371682107284564 --workspace-folder /home/NETID/syoh/id-bug --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/NETID/syoh/id-bug --id-label devcontainer.config_file=/home/NETID/syoh/id-bug/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/NETID/syoh/id-bug/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true [2023-04-21T20:01:27.185Z] @devcontainers/cli 0.35.0. Node.js v16.14.2. linux 4.18.0-425.13.1.el8_7.x86_64 x64. [2023-04-21T20:01:27.185Z] Start: Run: podman buildx version [2023-04-21T20:01:27.243Z] Stop (58 ms): Run: podman buildx version [2023-04-21T20:01:27.244Z] [2023-04-21T20:01:27.244Z] Error: unrecognized command `podman buildx version` Try 'podman buildx --help' for more information [2023-04-21T20:01:27.244Z] Exit code 125 [2023-04-21T20:01:27.244Z] Start: Resolving Remote [2023-04-21T20:01:27.249Z] Start: Run: git rev-parse --show-cdup [2023-04-21T20:01:27.256Z] Stop (7 ms): Run: git rev-parse --show-cdup [2023-04-21T20:01:27.258Z] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/home/NETID/syoh/id-bug --filter label=devcontainer.config_file=/home/NETID/syoh/id-bug/.devcontainer/devcontainer.json [2023-04-21T20:01:27.360Z] Stop (102 ms): Run: podman ps -q -a --filter label=devcontainer.local_folder=/home/NETID/syoh/id-bug --filter label=devcontainer.config_file=/home/NETID/syoh/id-bug/.devcontainer/devcontainer.json [2023-04-21T20:01:27.361Z] Start: Run: podman inspect --type image mcr.microsoft.com/devcontainers/base:jammy [2023-04-21T20:01:27.479Z] Stop (118 ms): Run: podman inspect --type image mcr.microsoft.com/devcontainers/base:jammy [2023-04-21T20:01:27.482Z] local container features stored at: /home/NETID/syoh/.vscode-remote-containers/dist/dev-containers-cli-0.288.1/dist/node_modules/vscode-dev-containers/container-features [2023-04-21T20:01:27.485Z] Start: Run: tar --no-same-owner -x -f - [2023-04-21T20:01:27.511Z] tar: Ignoring unknown extended header keyword 'SCHILY.dev' tar: Ignoring unknown extended header keyword 'SCHILY.ino' tar: Ignoring unknown extended header keyword 'SCHILY.nlink' tar: Ignoring unknown extended header keyword 'SCHILY.dev' tar: Ignoring unknown extended header keyword 'SCHILY.ino' tar: Ignoring unknown extended header keyword 'SCHILY.nlink' tar: Ignoring unknown extended header keyword 'SCHILY.dev' tar: Ignoring unknown extended header keyword 'SCHILY.ino' tar: Ignoring unknown extended header keyword 'SCHILY.nlink' tar: Ignoring unknown extended header keyword 'SCHILY.dev' tar: Ignoring unknown extended header keyword 'SCHILY.ino' tar: Ignoring unknown extended header keyword 'SCHILY.nlink' [2023-04-21T20:01:27.512Z] tar: Ignoring unknown extended header keyword 'SCHILY.dev' tar: Ignoring unknown extended header keyword 'SCHILY.ino' tar: Ignoring unknown extended header keyword 'SCHILY.nlink' [2023-04-21T20:01:27.513Z] Stop (28 ms): Run: tar --no-same-owner -x -f - [2023-04-21T20:01:27.521Z] Start: Run: podman build -f /tmp/devcontainercli-NETID\syoh/updateUID.Dockerfile-0.35.0 -t vsc-id-bug-873ed8b1ec065df4084d23b54b7a9a3b585fdd7226b8d8f0ba96e70685405ab5-uid --build-arg BASE_IMAGE=mcr.microsoft.com/devcontainers/base:jammy --build-arg REMOTE_USER=vscode --build-arg NEW_UID=3060167 --build-arg NEW_GID=200513 --build-arg IMAGE_USER=root /tmp/devcontainercli-NETID\syoh/empty-folder [2023-04-21T20:01:27.589Z] STEP 1/9: FROM mcr.microsoft.com/devcontainers/base:jammy [2023-04-21T20:01:27.718Z] STEP 2/9: USER root [2023-04-21T20:01:27.725Z] --> Using cache 09a2b9b11ff6636602e4855845c28387d6e6fad2761b4281433c070a32de4500 --> 09a2b9b11ff [2023-04-21T20:01:27.816Z] STEP 3/9: ARG REMOTE_USER [2023-04-21T20:01:27.820Z] --> Using cache b0e3ee9d7dee34b26f1bfe3a73628ea5ed3a4cf8662d25a5f0f3093d81e24c1c --> b0e3ee9d7de [2023-04-21T20:01:27.901Z] STEP 4/9: ARG NEW_UID [2023-04-21T20:01:27.905Z] --> Using cache 32e98482734092a3c93eb6c9b837d40d287d554e9c696945c3dbd41d9fa66936 --> 32e98482734 [2023-04-21T20:01:28.040Z] STEP 5/9: ARG NEW_GID [2023-04-21T20:01:28.044Z] --> Using cache ad75a7e5bc90477c20220c01de1a792849f6159068fc1b596036d3b36bdef466 --> ad75a7e5bc9 [2023-04-21T20:01:28.116Z] STEP 6/9: SHELL ["/bin/sh", "-c"] [2023-04-21T20:01:28.121Z] --> Using cache 3f317ca846d6d8f35c404d279b78412095f5a4a0baa1a9c63f04daf3c6f15096 --> 3f317ca846d [2023-04-21T20:01:28.199Z] STEP 7/9: RUN eval $(sed -n "s/${REMOTE_USER}:[^:]*:\([^:]*\):\([^:]*\):[^:]*:\([^:]*\).*/OLD_UID=\1;OLD_GID=\2;HOME_FOLDER=\3/p" /etc/passwd); eval $(sed -n "s/\([^:]*\):[^:]*:${NEW_UID}:.*/EXISTING_USER=\1/p" /etc/passwd); eval $(sed -n "s/\([^:]*\):[^:]*:${NEW_GID}:.*/EXISTING_GROUP=\1/p" /etc/group); if [ -z "$OLD_UID" ]; then echo "Remote user not found in /etc/passwd ($REMOTE_USER)."; elif [ "$OLD_UID" = "$NEW_UID" -a "$OLD_GID" = "$NEW_GID" ]; then echo "UIDs and GIDs are the same ($NEW_UID:$NEW_GID)."; elif [ "$OLD_UID" != "$NEW_UID" -a -n "$EXISTING_USER" ]; then echo "User with UID exists ($EXISTING_USER=$NEW_UID)."; elif [ "$OLD_GID" != "$NEW_GID" -a -n "$EXISTING_GROUP" ]; then echo "Group with GID exists ($EXISTING_GROUP=$NEW_GID)."; else echo "Updating UID:GID from $OLD_UID:$OLD_GID to $NEW_UID:$NEW_GID."; sed -i -e "s/\(${REMOTE_USER}:[^:]*:\)[^:]*:[^:]*/\1${NEW_UID}:${NEW_GID}/" /etc/passwd; if [ "$OLD_GID" != "$NEW_GID" ]; then sed -i -e "s/\([^:]*:[^:]*:\)${OLD_GID}:/\1${NEW_GID}:/" /etc/group; fi; chown -R $NEW_UID:$NEW_GID $HOME_FOLDER; fi; [2023-04-21T20:01:28.740Z] Updating UID:GID from 1000:1000 to 3060167:200513. [2023-04-21T20:01:28.747Z] chown: changing ownership of '/home/vscode/.bash_logout': Invalid argument chown: changing ownership of '/home/vscode/.bashrc': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.editorconfig': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/HEAD': Invalid argument [2023-04-21T20:01:28.747Z] chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/branches': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/config': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/description': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/applypatch-msg.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/commit-msg.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/fsmonitor-watchman.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/post-update.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/pre-applypatch.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/pre-commit.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/pre-merge-commit.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/pre-push.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/pre-rebase.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/pre-receive.sample': Invalid argument [2023-04-21T20:01:28.747Z] chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/prepare-commit-msg.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/push-to-checkout.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks/update.sample': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/hooks': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/index': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/info/exclude': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/info/refs': Invalid argument chown: changing ownership of '/home/vscode/.oh-my-zsh/.git/info' ... truncated ...
Steps to Reproduce:
- Username on the remote host has a backslash in it due to active directory naming conventions: e.g.
DOMAIN\someuser - Use the following
devcontainer.jsonto start a devcontainer:
{
"name": "Ubuntu",
"image": "mcr.microsoft.com/devcontainers/base:jammy"
}
Does this issue occur when you try this locally?: Yes, same happens in bash terminal on the remote SSH host (AlmaLinux 8)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.