Skip to content

"Permission Denied Error when Running Non-Root Podman Development Container: mkdir: cannot create directory ‘/root’" #268

Description

@mimowen

I find an issue with the VSCode Dev Container template image trying to create files in the /root directory within the container using the vscode username. Here's the error I received:

[16535 ms] Exit code 1
[16535 ms] Start: Run in container: test -d '/vscode/vscode-server/bin/linux-x64/ea1445cc7016315d0f5728f8e8b12a45dc0a7286'
[16579 ms]
[16579 ms]
[16579 ms] Start: Run in container: mkdir -p '/root/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/ea1445cc7016315d0f5728f8e8b12a45dc0a7286' '/root/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286'
[16623 ms]
[16623 ms] mkdir: cannot create directory ‘/root’: Permission denied
[16623 ms] Exit code 1
[16624 ms] Start: Run: podman rm -f 16650b67a2fdcc48a91885454e657b9caecf1c6511e7c774d8d0526108239cb9
[16627 ms] Command in container failed: mkdir -p '/root/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/ea1445cc7016315d0f5728f8e8b12a45dc0a7286' '/root/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286'
[16628 ms] mkdir: cannot create directory ‘/root’: Permission denied
[16628 ms] Exit code 1

The /root directory has default permissions set to 700 in Ubuntu 22.04.4 LTS, which caused this error.

After modifying the /root directory permissions, I found that the Dev Container extension is able to create the /root/.vscode-server directory within the container. Everything works fine now, and I can happily use the Dev Container extension.

image

So I want to know why this happened ?what caused this?

Environment Information

VSCode Version:

  • Version: 1.91.0 (system setup)
  • Commit: ea1445cc7016315d0f5728f8e8b12a45dc0a7286
  • Date: 2024-07-01T18:52:22.949Z
  • Electron: 29.4.0
  • Chromium: 122.0.6261.156
  • Node.js: 20.9.0
  • OS: Windows_NT x64 10.0.22631

Host:

  • Ubuntu 22.04.4 LTS

Podman Version:

  • Version: 3.4.4
  • API Version: 3.4.4
  • Go Version: go1.18.1
  • Built: Thu Jan 1 00:00:00 1970
  • OS/Arch: linux/amd64

Test Docker Templates Image Mirror Address:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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