coder / code-server

VS Code in the browser
https://coder.com
MIT License
68.13k stars 5.6k forks source link

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

Open benz0li opened 2 hours ago

benz0li commented 2 hours ago

Is there an existing issue for this?

OS/Web Information

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?

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 commented 2 hours ago

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