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

Error connecting to containers on remote host: mkdir: cannot create directory '/.vscode-remote-containers': Permission denied #8663

Closed
smartweka opened this issue Jun 29, 2023 · 3 comments
Assignees
Labels
containers Issue in vscode-remote containers info-needed Issue requires more information from poster

Comments

@smartweka
Copy link

Hi,

I'm using dev containers extension in the following way:

  1. My local machine is windows

  2. I use vscode and SSH remote extension to connect to a Linux machine

  3. On linux machine I have docker running several containers and I'm trying to connect to them with Dev Containers extension

This flow works well with the 0.266 version of Dev Containers extension, but fails with newer versions with this log:


[39 ms] Dev Containers 0.295.0 in VS Code 1.79.2 (695af097c7bd098fbf017ce3ac85e09bbc5dda06).

[38 ms] Start: Resolving Remote

[41 ms] Setting up container: /qa-testing

[41 ms] Host: ssh://*******

[70 ms] Start: Run: ssh ******** /bin/sh

[91 ms] Start: Run in host: id -un

[6595 ms] smartweka

[6595 ms]

[6595 ms] Start: Run in host: cat /etc/passwd

[6699 ms] Start: Run in host: echo ~

[6801 ms] /home/smartweka

[6802 ms]

[6802 ms] Start: Run in host: test -x '/home/smartweka/.vscode-remote-containers/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/node'

[6906 ms]

[6906 ms]

[6906 ms] Exit code 1

[6907 ms] Start: Run in host: test -x '/home/smartweka/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/node'

[7010 ms]

[7010 ms]

[7010 ms] Start: Run in host: test -f '/home/smartweka/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/node_modules/node-pty/package.json'

[7112 ms]

[7113 ms]

[7113 ms] Start: Run in host: test -f '/home/smartweka/.vscode-remote-containers/dist/vscode-remote-containers-server-0.295.0.js'

[7215 ms]

[7215 ms]

[7318 ms] userEnvProbe: loginInteractiveShell (default)

[7318 ms] userEnvProbe: not found in cache

[7318 ms] userEnvProbe shell: /bin/sh

[9329 ms] Start: Run in Host: /bin/sh

[9437 ms] Start: Run in container: for pid in `cd /proc && ls -d [0-9]*`; do { echo $pid ; readlink /proc/$pid/cwd || echo ; readlink /proc/$pid/ns/mnt || echo ; cat /proc/$pid/stat | tr "

[11769 ms] userEnvProbe is taking longer than 2 seconds. Process not found.

[17331 ms] userEnvProbe is taking longer than 10 seconds. Avoid waiting for user input in your shell's startup scripts. Continuing.

[17434 ms] Start: Run in Host: docker inspect --type container /qa-testing

[18064 ms] Start: Run: wsl -l -v

[18179 ms] Could not connect to WSL.

[18179 ms] Command failed: wsl -l -v

[18179 ms]

Copyright (c) Microsoft Corporation. All rights reserved.

 

Usage: wsl.exe [Argument]

 

Arguments:

 

    --install <Options>

        Install Windows Subsystem for Linux features. If no options are specified,

        the recommended features will be installed along with the default distribution.

 

        To view the default distribution as well as a list of other valid distributions,

        use 'wsl --list --online'.

 

        Options:

            --distribution, -d [Argument]

                Specifies the distribution to be downloaded and installed by name.

 

                Arguments:

                    A valid distribution name (not case sensitive).

 

                Examples:

                    wsl --install -d Ubuntu

                    wsl --install --distribution Debian

 

            --inbox

                Install the optional Windows feature instead of the version available via the Microsoft Store.

 

            --no-distribution

                Do not install a distribution (cannot be used with --distribution).

 

            --no-launch, -n

                Do not launch the distribution after install.

 

            --web-download

                Download the most recent version of WSL from the internet instead of the Microsoft Store.

 

    --list, -l [Options]

        Lists distributions.

 

        Options:

            --online, -o

                Displays a list of available distributions for install with 'wsl --install'.

 

    --status

        Show the status of Windows Subsystem for Linux.

 

    --help

        Display usage information.

 

[18180 ms]

[18180 ms] Start: Check Docker is running

[18180 ms] Start: Run in Host: docker version --format {{.Server.APIVersion}}

[18390 ms] Server API version: 1.43

[19022 ms] Command failed: mkdir -p /.vscode-remote-containers/dist/dev-containers-cli-0.295.0-90b7b251-47cc-4f95-b088-1cc1d90a42f8/dist/spec-node

[19022 ms] mkdir: cannot create directory '/.vscode-remote-containers': Permission denied

[19022 ms] Exit code 1

I understand that the it tries to create the directory in the in / folder instead of /home/smartweka (it exists in the container, as does the smartweka user; the user and the group is the same on remote linux machine and in the container).

I have tried to use devcontainer.json configuration for running images, and using remoteContainer and remoteUser options, as well as setting userEnvProbe to none. None of these configuration is used, it seems.

Any ideas how to solve this issue? How can I pass the user to the extension? Also, why is it trying to start wsl when I'm ssh'ed onto windows machine, and why the userEnvProbe is failing?

thank you

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Jun 29, 2023
@chrmarti
Copy link
Contributor

The userEnvProbe on the ssh server fails (the config is for the probe in the container). Does running /bin/sh -lic 'echo test' run without user input on the ssh server?

Regarding the mkdir error: What's the user's home folder in /etc/passwd?

@chrmarti chrmarti self-assigned this Jun 30, 2023
@chrmarti chrmarti added the info-needed Issue requires more information from poster label Jun 30, 2023
@smartweka
Copy link
Author

Hi, @chrmarti
Thanks for looking into this issue!

/bin/sh -lic 'echo test' does not work on the Linux box (the one I'm ssh-ing onto) - it does not print anything. It works when I do it from the container. I'm running zsh as my default shell.

For the second question - it's a bit more complicated. The Linux machine (the one I'm ssh-ing onto) is managed by AD (I think, at least), so my user is not in the /etc/passwd; it is there when I do getent passwd smartweka. The userid and group id is carried over to the container because I'm doing groupadd and useradd in the dockerfile passing ids from the host.

@chrmarti
Copy link
Contributor

Tracking as #2957. Continuing there, thanks.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants