Skip to content

Installing extensions at system level (user: root, built-in location) throws an error #7042

Closed

Description

@benz0li

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Safari v18.0.1 (20619.1.26.31.7)
  • Local OS: macOS 15.0.1 (24A348)
  • Remote OS: Debian 12 (bookworm)
  • Remote Architecture: x86_64
  • code-server --version: 4.94.2-rc.1 dd2e9fc with Code 1.94.2

Steps to Reproduce

  1. Start container:

    docker run --rm -ti \
      -u root \
      -e NB_USER=root \
      -e NB_UID=0 \
      -e NB_GID=0 \
      glcr.b-data.ch/jupyterlab/python/base:3.12.7-code-server-4.94.2-rc.1-linux-amd64 \
      bash
  2. Install extension:

    code-server \
      --extensions-dir /opt/code-server/lib/vscode/extensions \
      --install-extension ms-python.python

Expected

Installing extensions...
Installing extension 'ms-python.python'...
Extension 'ms-python.debugpy' v2024.12.0 was successfully installed.
Extension 'ms-python.python' v2024.16.1 was successfully installed.

Actual

Installing extensions...
Installing extensions...
Installing extension 'ms-python.python'...
Installing extension 'ms-python.python'...
[2024-10-19T05:53:53.402Z] error parent:77 Uncaught exception: ENOTEMPTY: directory not empty, rename '/opt/code-server/lib/vscode/extensions/.4361a9d7-c95f-49fb-a7cf-6f4ae4201a3c' -> '/opt/code-server/lib/vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64'
[2024-10-19T05:53:53.403Z] error parent:77 Error: ENOTEMPTY: directory not empty, rename '/opt/code-server/lib/vscode/extensions/.4361a9d7-c95f-49fb-a7cf-6f4ae4201a3c' -> '/opt/code-server/lib/vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64'
    at async Object.rename (node:internal/fs/promises:782:10)
    at async Object.nE (file:///opt/code-server/lib/vscode/out/vs/server/node/server.main.js:45:5381)
    at async yf.G (file:///opt/code-server/lib/vscode/out/vs/server/node/server.main.js:54:24201)
    at async yf.extractUserExtension (file:///opt/code-server/lib/vscode/out/vs/server/node/server.main.js:54:21240)
    at async zc.rb (file:///opt/code-server/lib/vscode/out/vs/server/node/server.main.js:54:14468)
[2024-10-19T05:53:53.962Z] error parent:77 Uncaught exception: ENOTEMPTY: directory not empty, rename '/opt/code-server/lib/vscode/extensions/.0c81ab66-e49a-4744-af2d-3a7ca1755d35' -> '/opt/code-server/lib/vscode/extensions/ms-python.python-2024.16.1-universal'
[2024-10-19T05:53:53.962Z] error parent:77 Error: ENOTEMPTY: directory not empty, rename '/opt/code-server/lib/vscode/extensions/.0c81ab66-e49a-4744-af2d-3a7ca1755d35' -> '/opt/code-server/lib/vscode/extensions/ms-python.python-2024.16.1-universal'
    at async Object.rename (node:internal/fs/promises:782:10)
    at async Object.nE (file:///opt/code-server/lib/vscode/out/vs/server/node/server.main.js:45:5381)
    at async yf.G (file:///opt/code-server/lib/vscode/out/vs/server/node/server.main.js:54:24201)
    at async yf.extractUserExtension (file:///opt/code-server/lib/vscode/out/vs/server/node/server.main.js:54:21240)
    at async zc.rb (file:///opt/code-server/lib/vscode/out/vs/server/node/server.main.js:54:14468)
Error while installing extensions: ENOTEMPTY: directory not empty, rename '/opt/code-server/lib/vscode/extensions/.0c81ab66-e49a-4744-af2d-3a7ca1755d35' -> '/opt/code-server/lib/vscode/extensions/ms-python.python-2024.16.1-universal'
ENOTEMPTY: directory not empty, rename '/opt/code-server/lib/vscode/extensions/.0c81ab66-e49a-4744-af2d-3a7ca1755d35' -> '/opt/code-server/lib/vscode/extensions/ms-python.python-2024.16.1-universal'

Logs

See above.

Screenshot/Video

-

Does this bug reproduce in native VS Code?

This cannot be tested in native VS Code

Does this bug reproduce in GitHub Codespaces?

This cannot be tested in GitHub Codespaces

Are you accessing code-server over a secure context?

  • I am using a secure context.

Notes

It seems to work at user level (user: root) by executing code-server --install-extension ms-python.python, but ls -al ~/.local/share/code-server/extensions reveals

drwx------ 4 root root 4096 Oct 19 06:00 .
drwxr-xr-x 9 root root 4096 Oct 19 06:00 ..
drwxr-xr-x 7 root root 4096 Oct 19 06:00 .b88d8567-9056-4934-883b-6ae404444689
-rw-r--r-- 1 root root  804 Oct 19 06:00 extensions.json
drwxr-xr-x 5 root root 4096 Oct 19 06:00 ms-python.debugpy-2024.12.0-linux-x64

which does not look fine.

FYI @code-asher

Activity

  1. added
    bugSomething isn't working
    triageThis issue needs to be triaged by a maintainer
    on Oct 19, 2024
  2. changed the title [-]Installing extensions at system level (built-in location) throws an error[/-] [+]Installing extensions at *system level* (built-in location) throws an error[/+] on Oct 19, 2024
  3. changed the title [-]Installing extensions at *system level* (built-in location) throws an error[/-] [+]Installing extensions at system level (built-in location) throws an error[/+] on Oct 19, 2024
  4. changed the title [-]Installing extensions at system level (built-in location) throws an error[/-] [+]Installing extensions at system level (user: `root`, built-in location) throws an error[/+] on Oct 19, 2024
  5. benz0li commented on Oct 19, 2024

    @benz0li
    ContributorAuthor

    Installing extensions using the GUI seem to work fine at user level (user: jovyan):

    1. Start container:

      docker run --rm -ti \
        -p 8888:8888 \
        -e GEN_CERT=yes \
        -ti glcr.b-data.ch/jupyterlab/python/base:3.12.7-code-server-4.94.2-rc.1-linux-amd64
    2. Open https://127.0.0.1:8888/lab?token=... in a browser

    3. Click code-server to start the application

    4. Install Python extension using the GUI

    [06:09:30] Getting Manifest... ms-python.python
    [06:09:31] Installing extension: ms-python.python {
      isMachineScoped: false,
      installPreReleaseVersion: false,
      pinned: false,
      installOnlyNewlyAddedFromExtensionPack: true,
      isApplicationScoped: false,
      profileLocation: un {
        scheme: 'file',
        authority: '',
        path: '/home/jovyan/.local/share/code-server/extensions/extensions.json',
        query: '',
        fragment: '',
        _formatted: 'file:///home/jovyan/.local/share/code-server/extensions/extensions.json',
        _fsPath: '/home/jovyan/.local/share/code-server/extensions/extensions.json'
      },
      productVersion: { version: '1.94.2', date: '2024-10-18T04:36:19.894Z' }
    }
    [06:09:31] Getting Manifest... ms-python.debugpy
    [06:09:31] Installing extension: ms-python.debugpy {
      isMachineScoped: false,
      installPreReleaseVersion: false,
      pinned: false,
      installOnlyNewlyAddedFromExtensionPack: true,
      isApplicationScoped: false,
      profileLocation: un {
        scheme: 'file',
        authority: '',
        path: '/home/jovyan/.local/share/code-server/extensions/extensions.json',
        query: '',
        fragment: '',
        _formatted: 'file:///home/jovyan/.local/share/code-server/extensions/extensions.json',
        _fsPath: '/home/jovyan/.local/share/code-server/extensions/extensions.json'
      },
      productVersion: { version: '1.94.2', date: '2024-10-18T04:36:19.894Z' },
      context: { dependecyOrPackExtensionInstall: true }
    }
    [06:09:33] Could not load vsce-sign module Cannot find package '@vscode/vsce-sign' imported from /opt/code-server/lib/vscode/out/vs/server/node/server.main.js
    [06:09:33] Extension signature verification is not done: ms-python.debugpy
    [06:09:33] Could not load vsce-sign module Cannot find package '@vscode/vsce-sign' imported from /opt/code-server/lib/vscode/out/vs/server/node/server.main.js
    [06:09:33] Extension signature verification is not done: ms-python.python
    [06:09:33] Extracted extension to file:///home/jovyan/.local/share/code-server/extensions/ms-python.debugpy-2024.12.0-linux-x64: ms-python.debugpy
    [06:09:33] Renamed to /home/jovyan/.local/share/code-server/extensions/ms-python.debugpy-2024.12.0-linux-x64
    [06:09:34] Extracted extension to file:///home/jovyan/.local/share/code-server/extensions/ms-python.python-2024.16.1-universal: ms-python.python
    [06:09:34] Renamed to /home/jovyan/.local/share/code-server/extensions/ms-python.python-2024.16.1-universal
    [06:09:34] Extension installed successfully: ms-python.debugpy file:///home/jovyan/.local/share/code-server/extensions/extensions.json
    [06:09:34] Extension installed successfully: ms-python.python file:///home/jovyan/.local/share/code-server/extensions/extensions.json
    
  6. antoinemorcos-bpi commented on Oct 24, 2024

    @antoinemorcos-bpi

    I'm seeing the same error with other extensions too, (examples include eamodio.gitlens-15.6.1 and mhutchie.git-graph-1.30.0)
    Both were ok on version 4.93.1

    The repeated lines Installing extensions... and Installing extension 'ms-python.python'... seem like a good hint that it's running twice for some reason, in which case the failure to rename (the second time) makes sense.

    My stacktrace is the same when i "download and install", and is slightly different when I install from a vsix file

    the common part

    lib/vscode/out/vs/server/node/server.main.js:45:5381 -> https://github.com/microsoft/vscode/blob/ffe710dc78580f03d042e404f807a71083f55305/src/vs/base/node/pfs.ts#L499
    lib/vscode/out/vs/server/node/server.main.js:54:24201 ->
    https://github.com/microsoft/vscode/blob/ffe710dc78580f03d042e404f807a71083f55305/src/vs/platform/extensionManagement/node/extensionManagementService.ts#L822
    lib/vscode/out/vs/server/node/server.main.js:54:21240 -> https://github.com/microsoft/vscode/blob/ffe710dc78580f03d042e404f807a71083f55305/src/vs/platform/extensionManagement/node/extensionManagementService.ts#L666

    install from vsix file:

    lib/vscode/out/vs/server/node/server.main.js:54:16041 -> https://github.com/microsoft/vscode/blob/ffe710dc78580f03d042e404f807a71083f55305/src/vs/platform/extensionManagement/node/extensionManagementService.ts#L383
    lib/vscode/out/vs/server/node/server.main.js:54:29045 -> https://github.com/microsoft/vscode/blob/ffe710dc78580f03d042e404f807a71083f55305/src/vs/platform/extensionManagement/node/extensionManagementService.ts#L1050

    Download and install

    lib/vscode/out/vs/server/node/server.main.js:54:14468 -> https://github.com/microsoft/vscode/blob/ffe710dc78580f03d042e404f807a71083f55305/src/vs/platform/extensionManagement/node/extensionManagementService.ts#L312

    EDIT:
    Fixed the urls in the stacktrace

  7. antoinemorcos-bpi commented on Oct 24, 2024

    @antoinemorcos-bpi

    @benz0li in case you're looking at the urls I posted, one or two of them were wrong, now fixed

  8. benz0li commented on Oct 26, 2024

    @benz0li
    ContributorAuthor

    @antoinemorcos-bpi I will wait for the next release and then check again.

    Cross reference:

  9. benz0li commented on Nov 4, 2024

    @benz0li
    ContributorAuthor

    @code-asher This issue is still present with code-server v4.95.1-rc.1.

  10. benz0li commented on Nov 4, 2024

    @benz0li
    ContributorAuthor

    The repeated lines Installing extensions... and Installing extension 'ms-python.python'... seem like a good hint that it's running twice for some reason, in which case the failure to rename (the second time) makes sense.

    Yes, it seems to run twice for some reason.

  11. code-asher commented on Nov 5, 2024

    @code-asher
    Member

    I pushed a fix for the cli running twice; leaving the issue open until we confirm it works for y'all (should have an RC out shortly). Thanks for all the debugging and for finding the issue!

  12. added a commit that references this issue on Nov 5, 2024
  13. code-asher commented on Nov 5, 2024

    @code-asher
    Member

    I tested this and it seems to be working now:

    https://github.com/coder/code-server/releases/tag/v4.95.1-rc.2

  14. benz0li commented on Nov 5, 2024

    @benz0li
    ContributorAuthor

    I tested this and it seems to be working now:

    https://github.com/coder/code-server/releases/tag/v4.95.1-rc.2

    Confirmed. It works now.

  15. added a commit that references this issue on Jan 23, 2025
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

    bugSomething isn't workingtriageThis issue needs to be triaged by a maintainer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions