dls-controls / dev-c7

A container for running the DLS Controls RHEL7 developer environment on a RHEL8 workstation
Apache License 2.0
0 stars 2 forks source link

VSCode fails on re-opening of a devcontainer #17

Closed gilesknap closed 2 years ago

gilesknap commented 2 years ago

To reproduce:

See this error

[4528 ms] Start: Run in container: mkdir -p '/root/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f' '/root/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f'
[4530 ms] 
[4530 ms] mkdir: cannot create directory ‘/root’: Permission denied
[4530 ms] Exit code 1
[4533 ms] Command in container failed: mkdir -p '/root/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f' '/root/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f'
[4533 ms] mkdir: cannot create directory ‘/root’: Permission denied
[4533 ms] Exit code 1
gilesknap commented 2 years ago

@MJGaughran do you see this issue? Thanks

MJGaughran commented 2 years ago

I don't use the following in my dev container:

    "workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind,consistency=cached", 
    "workspaceFolder": "${localWorkspaceFolder}",

Also, nothing is on my path. That means something else is broken, too.

gilesknap commented 2 years ago

UPDATE: for me with the latest .devcontainer in main this issue ONLY occurs when starting vscode in an ssh session.

gilesknap commented 2 years ago

It looks to me like the issue is that $HOME is not getting passed in and is defaulting to /root. Because we are using keep-id the user does not have permission to set up /root/.vscode/ ...

gilesknap commented 2 years ago

For ref: This is the log of a successful first startup

[47 ms] Remote-Containers 0.238.3 in VS Code 1.68.0 (4af164ea3a06f701fe3e89a2bcbb421d2026b68f).
[47 ms] Start: Resolving Remote
[66 ms] Setting up container for folder or workspace: /scratch/hgv27681/work/epics-containers/dev-c7
[69 ms] Start: Check Docker is running
[69 ms] Start: Run: podman version --format {{.Server.APIVersion}}
[248 ms] Server API version: 4.0.2
[249 ms] Start: Run: podman volume ls -q
[417 ms] Start: Run: podman volume create vscode
[591 ms] Start: Run: podman ps -q -a --filter label=vsch.local.folder=/scratch/hgv27681/work/epics-containers/dev-c7 --filter label=vsch.quality=stable
[761 ms] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/scratch/hgv27681/work/epics-containers/dev-c7
[927 ms] Start: Run: /usr/share/code/code /home/hgv27681/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/hgv27681/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --docker-path podman --workspace-folder /scratch/hgv27681/work/epics-containers/dev-c7 --workspace-mount-consistency cached --id-label devcontainer.local_folder=/scratch/hgv27681/work/epics-containers/dev-c7 --log-level debug --log-format json --config /scratch/hgv27681/work/epics-containers/dev-c7/.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
[1054 ms] remote-containers 0.238.3.
[1054 ms] Start: Run: podman buildx version
[1095 ms] Start: Resolving Remote
[1096 ms] Start: Run: git rev-parse --show-cdup
[1104 ms] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/scratch/hgv27681/work/epics-containers/dev-c7
[1272 ms] Start: Run: podman inspect --type image ghcr.io/dls-controls/dev-c7:latest
[1440 ms] Start: Run: podman build -f /tmp/vsch/updateUID.Dockerfile-0.238.3 -t vsc-dev-c7-914745539fc385a5fe9188693f0fa257-uid --build-arg BASE_IMAGE=ghcr.io/dls-controls/dev-c7:latest --build-arg REMOTE_USER=hgv27681 --build-arg NEW_UID=1200288 --build-arg NEW_GID=1200288 --build-arg IMAGE_USER=root /tmp/vsch
STEP 1/9: FROM ghcr.io/dls-controls/dev-c7:latest
STEP 2/9: USER root
--> 8cb55537abf
STEP 3/9: ARG REMOTE_USER
--> 53dccf8094e
STEP 4/9: ARG NEW_UID
--> e4dcaeaf2ab
STEP 5/9: ARG NEW_GID
--> 64557c45d36
STEP 6/9: SHELL ["/bin/sh", "-c"]
WARN[0002] SHELL is not supported for OCI image format, [/bin/sh -c] will be ignored. Must use `docker` format 
--> 62c0ff2475a
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;
Remote user not found in /etc/passwd (hgv27681).
WARN[0003] SHELL is not supported for OCI image format, [/bin/sh -c] will be ignored. Must use `docker` format 
--> 3f2c1d644dd
STEP 8/9: ARG IMAGE_USER
WARN[0013] SHELL is not supported for OCI image format, [/bin/sh -c] will be ignored. Must use `docker` format 
--> 15a4a44c1f5
STEP 9/9: USER $IMAGE_USER
COMMIT vsc-dev-c7-914745539fc385a5fe9188693f0fa257-uid
WARN[0014] SHELL is not supported for OCI image format, [/bin/sh -c] will be ignored. Must use `docker` format 
--> b5df9604d15
Successfully tagged localhost/vsc-dev-c7-914745539fc385a5fe9188693f0fa257-uid:latest
b5df9604d153a0e164b7a9697f3f041f9f3d52fbae82dad16f3781297f20773d
[16478 ms] Start: Run: podman -v
[16536 ms] Start: Run: podman events --format json --filter event=start
[16538 ms] Start: Starting container
[16539 ms] Start: Run: podman run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/scratch/hgv27681/work/epics-containers/dev-c7,target=/workspaces/dev-c7 --mount source=/dls/detectors,target=/dls/detectors,type=bind,consistency=cached --mount source=/dls_sw/prod,target=/dls_sw/prod,type=bind,consistency=cached --mount source=/dls_sw/work,target=/dls_sw/work,type=bind,consistency=cached --mount source=/dls_sw/epics,target=/dls_sw/epics,type=bind,consistency=cached --mount source=/dls_sw/targetOS/vxWorks/Tornado-2.2,target=//dls_sw/targetOS/vxWorks/Tornado-2.2,type=bind,consistency=cached --mount source=/dls_sw/apps,target=/dls_sw/apps,type=bind,consistency=cached --mount source=/dls_sw/etc,target=/dls_sw/etc,type=bind,consistency=cached --mount source=/home,target=/home,type=bind,consistency=cached --mount source=/scratch/,target=/scratch/,type=bind,consistency=cached --mount source=/dls/science/users,target=/dls/science/users,type=bind,consistency=cached --mount source=/tmp,target=/tmp,type=bind,consistency=cached --mount type=volume,src=vscode,dst=/vscode -l devcontainer.local_folder=/scratch/hgv27681/work/epics-containers/dev-c7 -v/dev/ttyS0:/dev/ttyS0 --privileged --net=host --security-opt=label=type:container_runtime_t --userns=keep-id --annotation=run.oci.keep_original_groups=1 --storage-opt=ignore_chown_errors=true --runtime=/usr/bin/crun --entrypoint /bin/sh vsc-dev-c7-914745539fc385a5fe9188693f0fa257-uid -c echo Container started
[62486 ms] Start: Run: podman inspect --type container c9e3f2563dde83aa7d12dc098edf055f484c669a7bac78eb00277548e53db154
Container started
[62778 ms] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/scratch/hgv27681/work/epics-containers/dev-c7
[62987 ms] Start: Run: podman inspect --type container c9e3f2563dde
[63174 ms] Start: Inspecting container
[63174 ms] Start: Run: podman inspect --type container c9e3f2563dde83aa7d12dc098edf055f484c669a7bac78eb00277548e53db154
[63361 ms] Start: Run in container: /bin/sh
[63371 ms] Start: Run in container: uname -m
[63486 ms] x86_64
[63486 ms] 
[63486 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[63491 ms] NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[63491 ms] 
[63492 ms] Start: Run in container: cat /etc/passwd
[63498 ms] Start: Run in container: test -f '/var/devcontainer/.patchEtcEnvironmentMarker'
[63503 ms] 
[63503 ms] 
[63503 ms] Exit code 1
[63503 ms] Start: Run in container: /bin/sh
[63512 ms] Start: Run in container: test ! -f '/var/devcontainer/.patchEtcEnvironmentMarker' && set -o noclobber && mkdir -p '/var/devcontainer' && { > '/var/devcontainer/.patchEtcEnvironmentMarker' ; } 2> /dev/null
[63648 ms] 
[63649 ms] 
[63649 ms] Start: Run in container: cat >> /etc/environment <<'etcEnvrionmentEOF'
[63651 ms] 
[63651 ms] 
[63651 ms] Start: Run in container: test -f '/var/devcontainer/.patchEtcProfileMarker'
[63652 ms] 
[63652 ms] 
[63652 ms] Exit code 1
[63652 ms] Start: Run in container: test ! -f '/var/devcontainer/.patchEtcProfileMarker' && set -o noclobber && mkdir -p '/var/devcontainer' && { > '/var/devcontainer/.patchEtcProfileMarker' ; } 2> /dev/null
[63661 ms] 
[63661 ms] 
[63661 ms] Start: Run in container: sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1${PATH:-\3}/g' /etc/profile || true
[63671 ms] 
[63671 ms] 
[63679 ms] Start: Run: podman inspect --type container c9e3f2563dde83aa7d12dc098edf055f484c669a7bac78eb00277548e53db154
[63986 ms] Start: Run: /usr/share/code/code /home/hgv27681/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.3/dist/spec-node/devContainersSpecCLI.js read-configuration --workspace-folder /scratch/hgv27681/work/epics-containers/dev-c7 --log-level debug --log-format json --config /scratch/hgv27681/work/epics-containers/dev-c7/.devcontainer.json --mount-workspace-git-root true
[64126 ms] remote-containers 0.238.3.
[64126 ms] Start: Run: git rev-parse --show-cdup
[64150 ms] Start: Inspecting container
[64150 ms] Start: Run: podman inspect --type container c9e3f2563dde83aa7d12dc098edf055f484c669a7bac78eb00277548e53db154
[64338 ms] Start: Run in container: /bin/sh
[64342 ms] Start: Run in container: uname -m
[64446 ms] x86_64
[64446 ms] 
[64446 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[64448 ms] NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[64448 ms] 
[64449 ms] Start: Run in container: cat /etc/passwd
[64450 ms] Start: Updating configuration state
[64484 ms] Start: Setup shutdown monitor
[64484 ms] Forking shutdown monitor: /home/hgv27681/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.3/dist/shutdown/shutdownMonitorProcess /run/user/1200288/vscode-remote-containers-f370b97c5a70ce1230af88eaa655b75d4722ae3d.sock singleContainer Debug /home/hgv27681/.config/Code/logs/20220701T141829/exthost1/ms-vscode-remote.remote-containers 1656681519187
[64488 ms] Start: Run in container: test -d /home/hgv27681/.vscode-server
[64493 ms] 
[64493 ms] 
[64493 ms] Start: Run in container: test ! -f '/home/hgv27681/.vscode-server/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/home/hgv27681/.vscode-server/data/Machine' && { > '/home/hgv27681/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null
[64495 ms] 
[64495 ms] 
[64495 ms] Exit code 1
[64496 ms] Start: Run in container: cat /home/hgv27681/.vscode-server/data/Machine/settings.json
[64497 ms] 
[64498 ms] cat: /home/hgv27681/.vscode-server/data/Machine/settings.json: No such file or directory
[64498 ms] Exit code 1
[64498 ms] Start: Run in container: test -d /home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f
[64510 ms] 
[64510 ms] 
[64510 ms] Exit code 1
[64510 ms] Start: Run in container: test -d /vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f
[64511 ms] 
[64511 ms] 
[64511 ms] Exit code 1
[64512 ms] Installing VS Code Server for commit 4af164ea3a06f701fe3e89a2bcbb421d2026b68f
[64512 ms] Start: Run in container: /bin/sh
[64533 ms] Start: Downloading VS Code Server
[64533 ms] 4af164ea3a06f701fe3e89a2bcbb421d2026b68f linux-x64 stable 
[71044 ms] Start: Installing VS Code Server
[71044 ms] Start: Run in container: mkdir -p /vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f_1656681590231
[71047 ms] 
[71047 ms] 
[71074 ms] Start: Run in container: (dd iflag=fullblock bs=8192 count=6851 2>/dev/null; dd iflag=fullblock bs=5426 count=1 2>/dev/null) | tar --no-same-owner -xz -C /vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f_1656681590231
[72130 ms] 
[72130 ms] 
[72130 ms] Start: Run in container: mv -n /vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f_1656681590231/* /vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f && rmdir /vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f_1656681590231
[72134 ms] 
[72134 ms] 
[72134 ms] Start: Run in container: mkdir -p '/home/hgv27681/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f' '/home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f'
[72159 ms] 
[72159 ms] 
[72159 ms] Start: Run in container: cd '/vscode/vscode-server/bin/linux-x64' && ls -t | tail -n +10 | xargs rm -rf
[72159 ms] Start: Launching Remote-Containers helper.
[72160 ms] ssh-agent: SSH_AUTH_SOCK in container (/tmp/vscode-ssh-auth-e10582eb4ffd555146707c3f7e03a6cdd1a72a85.sock) forwarded to local host (/run/user/1200288/keyring/ssh).
[72160 ms] Start: Run: gpgconf --list-dir agent-extra-socket
[72166 ms] /run/user/1200288/gnupg/S.gpg-agent.extra
[72166 ms] 
[72166 ms] Start: Run in container: gpgconf --list-dir agent-socket
[72168 ms] 
[72168 ms] 
[72174 ms] sysconfdir:/etc/gnupg
bindir:/usr/bin
libexecdir:/usr/libexec
libdir:/usr/lib64/gnupg
datadir:/usr/share/gnupg
localedir:/usr/share/locale
dirmngr-socket:/var/run/dirmngr/socket
agent-socket:/home/hgv27681/.gnupg/S.gpg-agent
homedir:/home/hgv27681/.gnupg
[72174 ms] 
[72174 ms] Start: Run in container: gpgconf --list-dir homedir
[72177 ms] sysconfdir:/etc/gnupg
bindir:/usr/bin
libexecdir:/usr/libexec
libdir:/usr/lib64/gnupg
datadir:/usr/share/gnupg
localedir:/usr/share/locale
dirmngr-socket:/var/run/dirmngr/socket
agent-socket:/home/hgv27681/.gnupg/S.gpg-agent
homedir:/home/hgv27681/.gnupg
[72177 ms] 
[72177 ms] Start: Run in container: ls '/home/hgv27681/.gnupg/private-keys-v1.d' 2>/dev/null
[72187 ms] 
[72187 ms] 
[72188 ms] Start: Run in container: mkdir -p -m 700 '/home/hgv27681/.gnupg'
[72188 ms] Start: Run in container: /bin/sh
[72193 ms] userEnvProbe: loginInteractiveShell (default)
[72193 ms] Start: Run in container: echo ~
[72194 ms] 
[72194 ms] 
[72194 ms] Start: Run: gpgconf --list-dir homedir
[72203 ms] userEnvProbe shell: /bin/sh
[72203 ms] /home/hgv27681/.gnupg
[72204 ms] 
[72204 ms] Start: Run in container: gpgconf --list-dir homedir
[72210 ms] sysconfdir:/etc/gnupg
bindir:/usr/bin
libexecdir:/usr/libexec
libdir:/usr/lib64/gnupg
datadir:/usr/share/gnupg
localedir:/usr/share/locale
dirmngr-socket:/var/run/dirmngr/socket
agent-socket:/home/hgv27681/.gnupg/S.gpg-agent
homedir:/home/hgv27681/.gnupg
[72210 ms] 
[72210 ms] Start: Run in container: # Test for /home/hgv27681/.ssh/known_hosts and ssh
[72211 ms] /home/hgv27681/.ssh/known_hosts exists
[72211 ms] 
[72211 ms] Exit code 1
[72211 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --system --replace-all credential.helper '!f() { /home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f/node /tmp/vscode-remote-containers-e10582eb4ffd555146707c3f7e03a6cdd1a72a85.js $*; }; f' || true
[72220 ms] Start: Run in container: # Test for /home/hgv27681/.gnupg/pubring.gpg and gpg
[72221 ms] /home/hgv27681/.gnupg/pubring.gpg exists
[72221 ms] 
[72222 ms] Exit code 1
[72231 ms] Start: Run in container: # Test for /home/hgv27681/.gnupg/trustdb.gpg and gpg
[72235 ms] 
[72236 ms] 
[72236 ms] /home/hgv27681/.gnupg/trustdb.gpg exists
[72236 ms] 
[72236 ms] Exit code 1
[72236 ms] Start: Run in container: for pid in `cd /proc && ls -d [0-9]*`; do { echo $pid ; readlink /proc/$pid/cwd ; readlink /proc/$pid/ns/mnt ; cat /proc/$pid/stat | tr "
[72237 ms] Start: Run: gpg-connect-agent updatestartuptty /bye
[72353 ms] Start: Run in container: cat '/home/hgv27681/.vscode-server/data/Machine/.connection-token-4af164ea3a06f701fe3e89a2bcbb421d2026b68f' 2>/dev/null || (umask 377 && echo '9409239c-d7b2-4fb0-9ae9-7908ba783971' >'/home/hgv27681/.vscode-server/data/Machine/.connection-token-4af164ea3a06f701fe3e89a2bcbb421d2026b68f-dfaf4e9c-dab5-412c-88a7-306ccf6f731b' && mv -n '/home/hgv27681/.vscode-server/data/Machine/.connection-token-4af164ea3a06f701fe3e89a2bcbb421d2026b68f-dfaf4e9c-dab5-412c-88a7-306ccf6f731b' '/home/hgv27681/.vscode-server/data/Machine/.connection-token-4af164ea3a06f701fe3e89a2bcbb421d2026b68f' && rm -f '/home/hgv27681/.vscode-server/data/Machine/.connection-token-4af164ea3a06f701fe3e89a2bcbb421d2026b68f-dfaf4e9c-dab5-412c-88a7-306ccf6f731b' && cat '/home/hgv27681/.vscode-server/data/Machine/.connection-token-4af164ea3a06f701fe3e89a2bcbb421d2026b68f')
[72354 ms] /home/hgv27681
[72354 ms] 
[72354 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-e10582eb4ffd555146707c3f7e03a6cdd1a72a85.js' >/tmp/vscode-remote-containers-e10582eb4ffd555146707c3f7e03a6cdd1a72a85.js
[72364 ms] 94c905f5-e7c6-4621-a21f-076cafa6cd6b
[72364 ms] 
[72364 ms] Start: Starting VS Code Server
[72365 ms] Start: Preparing Extensions
[72365 ms] Start: Run in container: test ! -f '/home/hgv27681/.vscode-server/data/Machine/.installExtensionsMarker' && set -o noclobber && mkdir -p '/home/hgv27681/.vscode-server/data/Machine' && { > '/home/hgv27681/.vscode-server/data/Machine/.installExtensionsMarker' ; } 2> /dev/null
[72367 ms] 
[72367 ms] 
[72367 ms] Exit code 1
[72368 ms] Extensions cache, install extensions: None
[72368 ms] Start: Run in container: test -d /home/hgv27681/.vscode-server/extensionsCache && ls /home/hgv27681/.vscode-server/extensionsCache || true
[72368 ms] 
[72368 ms] 
[72369 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-e10582eb4ffd555146707c3f7e03a6cdd1a72a85.js' >/tmp/vscode-remote-containers-server-e10582eb4ffd555146707c3f7e03a6cdd1a72a85.js_1656681591555
[72389 ms] eamodio.gitlens-11.7.0
github.vscode-pull-request-github-0.44.0
gruntfuggly.todo-tree-0.0.215
jeff-hykin.better-cpp-syntax-1.15.11
mhutchie.git-graph-1.30.0
ms-python.python-2022.8.1
ms-python.vscode-pylance-2022.6.30
ms-toolsai.jupyter-2021.11.1001550889
ms-vscode.cmake-tools-1.9.2
ms-vscode.cpptools-1.7.1
ms-vscode.cpptools-extension-pack-1.1.0
ms-vscode.cpptools-themes-1.0.0
ms-vscode-remote.remote-containers-0.238.3
ms-vscode-remote.remote-ssh-0.70.0
ms-vscode-remote.remote-wsl-0.63.13
nsd.vscode-epics-1.1.0
redhat.vscode-yaml-1.3.0
ryanluker.vscode-coverage-gutters-2.9.1
streetsidesoftware.code-spell-checker-2.2.5
twxs.cmake-0.0.17
[72389 ms] 
[72389 ms] Start: Run in container: test -d /vscode/vscode-server/extensionsCache && ls /vscode/vscode-server/extensionsCache || true
[72390 ms] 
[72391 ms] 
[72391 ms] Extensions cache, link in container: None
[72391 ms] Start: Run in container: /home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f/bin/code-server --log debug --force-disable-user-env --server-data-dir /home/hgv27681/.vscode-server --use-host-proxy --telemetry-level all --accept-server-license-terms --host 127.0.0.1 --port 0 --connection-token-file /home/hgv27681/.vscode-server/data/Machine/.connection-token-4af164ea3a06f701fe3e89a2bcbb421d2026b68f --extensions-download-dir /home/hgv27681/.vscode-server/extensionsCache --start-server --disable-websocket-compression
[72401 ms] 
[72401 ms] 
[72566 ms] userEnvProbe PATHs:
Probe:     '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
Container: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
[72616 ms] *
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
Server bound to 127.0.0.1:34909 (IPv4)
Extension host agent listening on 34909

[72616 ms] Start: Run in container: echo 34909 >'/home/hgv27681/.vscode-server/data/Machine/.devport-4af164ea3a06f701fe3e89a2bcbb421d2026b68f'
[72626 ms] 
[72626 ms] 
[72626 ms] Port forwarding for container port 34909 starts listening on local port.
[72627 ms] Port forwarding local port 40825 to container port 34909
[72631 ms] Start: Run in container: # Test for /home/hgv27681/.gitconfig and git
[72636 ms] /home/hgv27681/.gitconfig exists
[72636 ms] 
[72636 ms] Exit code 1
[72642 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global --replace-all credential.helper '!f() { /home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f/node /tmp/vscode-remote-containers-e10582eb4ffd555146707c3f7e03a6cdd1a72a85.js $*; }; f' || true
[72655 ms] Port forwarding connection from 34498 > 40825 > 34909 in the container.
[72655 ms] Start: Run in container: /home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f/node -e 
[72726 ms] 
[72726 ms] 
[72743 ms] [13:19:51] Extension host agent started.
[72946 ms] Port forwarding 34498 > 40825 > 34909 stderr: Connection established
[72982 ms] Port forwarding connection from 34510 > 40825 > 34909 in the container.
[72983 ms] Start: Run in container: /home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f/node -e 
[73027 ms] [13:19:52] ComputeTargetPlatform: linux-x64
[73125 ms] [13:19:52] [127.0.0.1][f19a59ac][ManagementConnection] New connection established.
[73211 ms] Port forwarding 34510 > 40825 > 34909 stderr: Connection established
[73345 ms] [13:19:52] [127.0.0.1][b69dfad9][ExtensionHostConnection] New connection established.
[73418 ms] [13:19:52] [127.0.0.1][b69dfad9][ExtensionHostConnection] <262> Launched Extension Host Process.
[74199 ms] Port forwarding connection from 34516 > 40825 > 34909 in the container.
[74200 ms] Start: Run in container: /home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f/node -e 
[74211 ms] Port forwarding connection from 34518 > 40825 > 34909 in the container.
[74211 ms] Start: Run in container: /home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f/node -e 
[74223 ms] Port forwarding connection from 34520 > 40825 > 34909 in the container.
[74223 ms] Start: Run in container: /home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f/node -e 
[74254 ms] Port forwarding connection from 34522 > 40825 > 34909 in the container.
[74255 ms] Start: Run in container: /home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f/node -e 
[74502 ms] Port forwarding 34520 > 40825 > 34909 stderr: Connection established
[74691 ms] Port forwarding 34516 > 40825 > 34909 stderr: Connection established
[74784 ms] Port forwarding 34518 > 40825 > 34909 stderr: Connection established
[74834 ms] Port forwarding 34522 > 40825 > 34909 stderr: Connection established
gilesknap commented 2 years ago

For ref: this is the log of a 2nd unsuccessful launch:

[74 ms] Remote-Containers 0.238.3 in VS Code 1.68.0 (4af164ea3a06f701fe3e89a2bcbb421d2026b68f).
[73 ms] Start: Resolving Remote
[103 ms] Setting up container for folder or workspace: /scratch/hgv27681/work/epics-containers/dev-c7
[106 ms] Start: Check Docker is running
[106 ms] Start: Run: podman version --format {{.Server.APIVersion}}
[375 ms] Server API version: 4.0.2
[375 ms] Start: Run: podman volume ls -q
[548 ms] Start: Run: podman ps -q -a --filter label=vsch.local.folder=/scratch/hgv27681/work/epics-containers/dev-c7 --filter label=vsch.quality=stable
[714 ms] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/scratch/hgv27681/work/epics-containers/dev-c7
[876 ms] Start: Run: podman inspect --type container c9e3f2563dde
[1034 ms] Start: Run: /usr/share/code/code /home/hgv27681/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/hgv27681/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --docker-path podman --workspace-folder /scratch/hgv27681/work/epics-containers/dev-c7 --workspace-mount-consistency cached --id-label devcontainer.local_folder=/scratch/hgv27681/work/epics-containers/dev-c7 --log-level debug --log-format json --config /scratch/hgv27681/work/epics-containers/dev-c7/.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
[1163 ms] remote-containers 0.238.3.
[1163 ms] Start: Run: podman buildx version
[1214 ms] Start: Resolving Remote
[1216 ms] Start: Run: git rev-parse --show-cdup
[1224 ms] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/scratch/hgv27681/work/epics-containers/dev-c7
[1390 ms] Start: Run: podman inspect --type container c9e3f2563dde
[1559 ms] Start: Starting container
[1559 ms] Start: Run: podman start c9e3f2563dde83aa7d12dc098edf055f484c669a7bac78eb00277548e53db154
[3242 ms] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/scratch/hgv27681/work/epics-containers/dev-c7
[3416 ms] Start: Run: podman inspect --type container c9e3f2563dde
[3589 ms] Start: Inspecting container
[3589 ms] Start: Run: podman inspect --type container c9e3f2563dde83aa7d12dc098edf055f484c669a7bac78eb00277548e53db154
[3783 ms] Start: Run in container: /bin/sh
[3786 ms] Start: Run in container: uname -m
[3876 ms] x86_64
[3876 ms] 
[3876 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[3878 ms] NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[3878 ms] 
[3878 ms] Start: Run in container: cat /etc/passwd
[3880 ms] Start: Run in container: test -f '/var/devcontainer/.patchEtcEnvironmentMarker'
[3880 ms] 
[3880 ms] 
[3880 ms] Start: Run in container: test -f '/var/devcontainer/.patchEtcProfileMarker'
[3881 ms] 
[3881 ms] 
[3885 ms] Start: Run: podman inspect --type container c9e3f2563dde83aa7d12dc098edf055f484c669a7bac78eb00277548e53db154
[4063 ms] Start: Run: /usr/share/code/code /home/hgv27681/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.3/dist/spec-node/devContainersSpecCLI.js read-configuration --workspace-folder /scratch/hgv27681/work/epics-containers/dev-c7 --log-level debug --log-format json --config /scratch/hgv27681/work/epics-containers/dev-c7/.devcontainer.json --mount-workspace-git-root true
[4189 ms] remote-containers 0.238.3.
[4189 ms] Start: Run: git rev-parse --show-cdup
[4204 ms] Start: Inspecting container
[4204 ms] Start: Run: podman inspect --type container c9e3f2563dde83aa7d12dc098edf055f484c669a7bac78eb00277548e53db154
[4378 ms] Start: Run in container: /bin/sh
[4382 ms] Start: Run in container: uname -m
[4507 ms] x86_64
[4507 ms] 
[4507 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[4509 ms] NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[4509 ms] 
[4509 ms] Start: Run in container: cat /etc/passwd
[4510 ms] Start: Setup shutdown monitor
[4511 ms] Forking shutdown monitor: /home/hgv27681/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.3/dist/shutdown/shutdownMonitorProcess /run/user/1200288/vscode-remote-containers-fc5cac5994b302bf671375e9e8ee5ad9b2337ff6.sock singleContainer Debug /home/hgv27681/.config/Code/logs/20220701T141829/exthost1/ms-vscode-remote.remote-containers 1656681661404
[4515 ms] Start: Run in container: test -d /root/.vscode-server
[4517 ms] 
[4517 ms] 
[4517 ms] Exit code 1
[4517 ms] Start: Run in container: test -d /root/.vscode-remote
[4518 ms] 
[4518 ms] 
[4518 ms] Exit code 1
[4518 ms] Start: Run in container: test ! -f '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null
[4530 ms] 
[4531 ms] mkdir: cannot create directory ‘/root’: Permission denied
[4531 ms] Exit code 1
[4531 ms] Start: Run in container: cat /root/.vscode-server/data/Machine/settings.json
[4533 ms] 
[4533 ms] cat: /root/.vscode-server/data/Machine/settings.json: Permission denied
[4533 ms] Exit code 1
[4533 ms] Start: Run in container: test -d /root/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f
[4534 ms] 
[4534 ms] 
[4534 ms] Exit code 1
[4534 ms] Start: Run in container: test -d /vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f
[4535 ms] 
[4535 ms] 
[4535 ms] Start: Run in container: mkdir -p '/root/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f' '/root/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f'
[4537 ms] 
[4537 ms] mkdir: cannot create directory ‘/root’: Permission denied
[4537 ms] Exit code 1
[4540 ms] Command in container failed: mkdir -p '/root/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f' '/root/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f'
[4540 ms] mkdir: cannot create directory ‘/root’: Permission denied
[4540 ms] Exit code 1
gilesknap commented 2 years ago

I'm sometimes getting this issue without being in an SSH session. It definitely looks like environment not being passed into the container.

The successful start has

Start: Run in container: mkdir -p '/home/hgv27681/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f' '/home/hgv27681/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f'

The unsuccessful has

Start: Run in container: mkdir -p '/root/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/4af164ea3a06f701fe3e89a2bcbb421d2026b68f' '/root/.vscode-server/bin/4af164ea3a06f701fe3e89a2bcbb421d2026b68f'
[4537 ms] 
[4537 ms] mkdir: cannot create directory ‘/root’: Permission denied

The default $HOME inside the container is /root and that is what is seen in the failed log

gilesknap commented 2 years ago

I might have fixed this with


    "runArgs": [
        "-e HOME",
gilesknap commented 2 years ago

looks to be fixed