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

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

Open
2 tasks done
benz0li opened this issue Oct 19, 2024 · 4 comments
Open
2 tasks done
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer

Comments

@benz0li
Copy link
Contributor

benz0li commented Oct 19, 2024

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

@benz0li benz0li added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Oct 19, 2024
@benz0li benz0li 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 Oct 19, 2024
@benz0li benz0li 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 Oct 19, 2024
@benz0li benz0li 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 Oct 19, 2024
@benz0li
Copy link
Contributor Author

benz0li commented Oct 19, 2024

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

@antoinemorcos-bpi
Copy link

antoinemorcos-bpi commented Oct 24, 2024

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

@antoinemorcos-bpi
Copy link

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

@benz0li
Copy link
Contributor Author

benz0li commented Oct 26, 2024

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

Cross reference:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants