code-server icon indicating copy to clipboard operation
code-server copied to clipboard

Cannot install extentions via cli when apache2 is installed

Open danielraab opened this issue 3 months ago • 20 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

OS/Web Information

  • Web Browser: does not matter -> cli problem
  • Local OS: does not matter -> cli problem
  • Remote OS: docker image codercom/enterprise-base:ubuntu
  • Remote Architecture: x86
  • code-server --version: 4.103.1 fbaadbcfbc16401327e28bd5df3040261977a540 with Code 1.103.1

Steps to Reproduce

  1. create template from docker template (without changes)
  2. create workspace with created template
  3. start workspace
  4. start terminal of workspace
  5. install and start apache2 sudo apt update && sudo apt install apache2 && sudo apache2ctl start
  6. try to install a code-server extensions via cli: /tmp/code-server/bin/code-server --force --install-extension dracula-theme.theme-dracula

Expected

the extension installation should work. It works with stopped apache2

Actual

the extension can not be installed. The extention is not found:

Extension 'dracula-theme.theme-dracula' not found. Make sure you use the full extension ID, including the publisher, e.g.: ms-dotnettools.csharp Failed Installing Extensions: dracula-theme.theme-dracula

Logs

apache access log shows:
127.0.0.1 - - [19/Aug/2025:19:22:51 +0000] "GET /error HTTP/1.1" 404 488 "-" "VSCode 1.103.1 (code-server)"

Screenshot/Video

No response

Does this bug reproduce in native VS Code?

I did not test native VS Code

Does this bug reproduce in GitHub Codespaces?

I did not test GitHub Codespaces

Are you accessing code-server over a secure context?

  • [ ] I am using a secure context.

Notes

No response

danielraab avatar Aug 19 '25 19:08 danielraab

Hi, same problem for me ! No matter with apache2 in my case, but can't install extension with cli...

root@code:~# code-server --install-extension tyriar.sort-lines --force --verbose
[2025-08-20T08:01:35.881Z] debug Found VS Code arguments; spawning VS Code CLI
[2025-08-20T08:01:35.883Z] debug Running Code CLI
Installing extensions...
Extension 'tyriar.sort-lines' not found.
Make sure you use the full extension ID, including the publisher, e.g.: ms-dotnettools.csharp
Failed Installing Extensions: tyriar.sort-lines

This was working few days ago...

root@code:~# code-server --version
4.103.1 fbaadbcfbc16401327e28bd5df3040261977a540 with Code 1.103.1

lokomass avatar Aug 20 '25 08:08 lokomass

any update for this please ?

lokomass avatar Aug 26 '25 14:08 lokomass

Interesting that Apache is somehow interfering with outbound requests.

I was not able to reproduce with cURL or with test JavaScript using fetch and https.request, but I was able to reproduce with both code-server and with native VS Code (after changing the marketplace to https://open-vsx.org which is what code-server uses; Microsoft's own marketplace works fine).

Really not sure why the combination of VS Code + Apache + open-vsx.org specifically causes this issue. 😕

code-asher avatar Aug 26 '25 18:08 code-asher

I don’t think this has anything to do with Apache2. It hasn’t worked for me since the upgrade to Debian 13. What should I do to make it work from the command line? I was able to install extensions from the graphical interface.

lokomass avatar Aug 26 '25 18:08 lokomass

I have just tested on fresh debian 12 (with latest code-server) and same problem here :

root@debian:~# curl -sL https://code-server.dev/install.sh | sh
Debian GNU/Linux 12 (bookworm)
Installing v4.103.2 of the amd64 deb package from GitHub.

+ mkdir -p ~/.cache/code-server
+ curl -#fL -o ~/.cache/code-server/code-server_4.103.2_amd64.deb.incomplete -C - https://github.com/coder/code-server/releases/download/v4.103.2/code-server_4.103.2_amd64.deb
######################################################################## 100.0%
+ mv ~/.cache/code-server/code-server_4.103.2_amd64.deb.incomplete ~/.cache/code-server/code-server_4.103.2_amd64.deb
+ dpkg -i ~/.cache/code-server/code-server_4.103.2_amd64.deb
Sélection du paquet code-server précédemment désélectionné.
(Lecture de la base de données... 44130 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../code-server_4.103.2_amd64.deb ...
Dépaquetage de code-server (4.103.2) ...
Paramétrage de code-server (4.103.2) ...

deb package has been installed.

To have systemd start code-server now and restart on boot:
  sudo systemctl enable --now code-server@$USER
Or, if you don't want/need a background service you can run:
  code-server

Deploy code-server for your team with Coder: https://github.com/coder/coder
root@debian:~# code-server --install-extension tyriar.sort-lines
[2025-08-27T07:48:54.557Z] info  Wrote default config file to /root/.config/code-server/config.yaml
Installing extensions...
Extension 'tyriar.sort-lines' not found.
Make sure you use the full extension ID, including the publisher, e.g.: ms-dotnettools.csharp
Failed Installing Extensions: tyriar.sort-lines

If I try with 4.101.2 version, it's work :

root@debian:~# wget https://github.com/coder/code-server/releases/download/v4.101.2/code-server_4.101.2_amd64.deb
--2025-08-27 09:52:10--  https://github.com/coder/code-server/releases/download/v4.101.2/code-server_4.101.2_amd64.deb
Résolution de github.com (github.com)… 140.82.121.3
Connexion à github.com (github.com)|140.82.121.3|:443… connecté.
requête HTTP transmise, en attente de la réponse… 302 Found
Emplacement : https://release-assets.githubusercontent.com/github-production-release-asset/172953845/26682101-6c13-4bd9-9e93-83d66fde7fca?sp=r&sv=2018-11-09&sr=b&spr=https&se=2025-08-27T08%3A52%3A29Z&rscd=attachment%3B+filename%3Dcode-server_4.101.2_amd64.deb&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2025-08-27T07%3A51%3A32Z&ske=2025-08-27T08%3A52%3A29Z&sks=b&skv=2018-11-09&sig=I56JxE2Nqd%2FwND%2BAfV19Or71eDmtmcxh0xse0WHPtek%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc1NjI4MTQzMSwibmJmIjoxNzU2MjgxMTMxLCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.E8HASmXpy46SY6q_q6tcyUaaUSvl1rQTLt2aNHDmZkU&response-content-disposition=attachment%3B%20filename%3Dcode-server_4.101.2_amd64.deb&response-content-type=application%2Foctet-stream [suivant]
--2025-08-27 09:52:11--  https://release-assets.githubusercontent.com/github-production-release-asset/172953845/26682101-6c13-4bd9-9e93-83d66fde7fca?sp=r&sv=2018-11-09&sr=b&spr=https&se=2025-08-27T08%3A52%3A29Z&rscd=attachment%3B+filename%3Dcode-server_4.101.2_amd64.deb&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2025-08-27T07%3A51%3A32Z&ske=2025-08-27T08%3A52%3A29Z&sks=b&skv=2018-11-09&sig=I56JxE2Nqd%2FwND%2BAfV19Or71eDmtmcxh0xse0WHPtek%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc1NjI4MTQzMSwibmJmIjoxNzU2MjgxMTMxLCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.E8HASmXpy46SY6q_q6tcyUaaUSvl1rQTLt2aNHDmZkU&response-content-disposition=attachment%3B%20filename%3Dcode-server_4.101.2_amd64.deb&response-content-type=application%2Foctet-stream
Résolution de release-assets.githubusercontent.com (release-assets.githubusercontent.com)… 185.199.109.133, 185.199.108.133, 185.199.110.133, ...
Connexion à release-assets.githubusercontent.com (release-assets.githubusercontent.com)|185.199.109.133|:443… connecté.
requête HTTP transmise, en attente de la réponse… 200 OK
Taille : 112938114 (108M) [application/octet-stream]
Sauvegarde en : « code-server_4.101.2_amd64.deb »

code-server_4.101.2_amd64.deb                              100%[=======================================================================================================================================>] 107,71M  39,6MB/s    ds 2,7s    

2025-08-27 09:52:14 (39,6 MB/s) — « code-server_4.101.2_amd64.deb » sauvegardé [112938114/112938114]

root@debian:~# dpkg -i code-server_4.101.2_amd64.deb 
Sélection du paquet code-server précédemment désélectionné.
(Lecture de la base de données... 42003 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de code-server_4.101.2_amd64.deb ...
Dépaquetage de code-server (4.101.2) ...
Paramétrage de code-server (4.101.2) ...
root@debian:~# code-server --install-extension tyriar.sort-lines
[2025-08-27T07:52:35.233Z] info  Wrote default config file to /root/.config/code-server/config.yaml
Installing extensions...
Installing extension 'tyriar.sort-lines'...
Extension 'tyriar.sort-lines' v1.9.1 was successfully installed.

So, no debian problem, it's code-server or code problem ?

lokomass avatar Aug 27 '25 07:08 lokomass

I don’t think this has anything to do with Apache2

It might trigger in other scenarios as well, all I can say is that in my test at least running Apache causes the issue, and stopping it fixes the issue. My test was in the codercom/enterprise-base:ubuntu image mentioned in the description.

I was not able to reproduce with Debian 12 though (without Apache). It does break if I run Apache.

root@fd29783a4b11:/# curl -sL https://code-server.dev/install.sh | sh
Debian GNU/Linux 12 (bookworm)
Installing v4.103.2 of the amd64 deb package from GitHub.

+ mkdir -p ~/.cache/code-server
+ curl -#fL -o ~/.cache/code-server/code-server_4.103.2_amd64.deb.incomplete -C - https://github.com/coder/code-server/releases/download/v4.103.2/code-server_4.103.2_amd64.deb
######################################################################## 100.0%
+ mv ~/.cache/code-server/code-server_4.103.2_amd64.deb.incomplete ~/.cache/code-server/code-server_4.103.2_amd64.deb
+ dpkg -i ~/.cache/code-server/code-server_4.103.2_amd64.deb
Selecting previously unselected package code-server.
(Reading database ... 6745 files and directories currently installed.)
Preparing to unpack .../code-server_4.103.2_amd64.deb ...
Unpacking code-server (4.103.2) ...
Setting up code-server (4.103.2) ...

deb package has been installed.

To have systemd start code-server now and restart on boot:
  sudo systemctl enable --now code-server@$USER
Or, if you don't want/need a background service you can run:
  code-server

Deploy code-server for your team with Coder: https://github.com/coder/coder
root@fd29783a4b11:/# code-server --version
[2025-08-27T22:57:31.678Z] info  Wrote default config file to /root/.config/code-server/config.yaml
4.103.2 54b33a75e0b4593b77f9a217323c4b27a42f4073 with Code 1.103.2
root@fd29783a4b11:/# code-server --install-extension tyriar.sort-lines
Installing extensions...
Installing extension 'tyriar.sort-lines'...
Extension 'tyriar.sort-lines' v1.9.1 was successfully installed.
root@fd29783a4b11:/# apt install apache2 && apache2ctl start
root@fd29783a4b11:/# apache2ctl start
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
root@fd29783a4b11:/# code-server --install-extension tyriar.sort-lines --force
Installing extensions...
Extension 'tyriar.sort-lines' not found.
Make sure you use the full extension ID, including the publisher, e.g.: ms-dotnettools.csharp
Failed Installing Extensions: tyriar.sort-lines

Very confusing.

code-asher avatar Aug 27 '25 23:08 code-asher

So what is solution ?

lokomass avatar Aug 31 '25 00:08 lokomass

No idea, someone will have to step through and figure out what is wrong.

code-asher avatar Sep 03 '25 20:09 code-asher

Hi, as a workaround, downloading the extension's VSIX file and installing from it worked for me.

https://coder.com/docs/code-server/FAQ#how-do-i-install-an-extension-manually

xoanpardo avatar Sep 05 '25 09:09 xoanpardo

@lokomass could you try 4.104.0? There was an issue with the default Open VSX marketplace that was fixed.

For me, 4.104.0 is still broken with Apache, but maybe for you it will be fixed since it looked like you had a different issue.

code-asher avatar Sep 15 '25 22:09 code-asher

when fixing the version to v4.102.3 everything works fine (my current workaround). 4.104.0 still does not work for me.

danielraab avatar Sep 16 '25 13:09 danielraab

I have same error again in 4.104.0, with php package installed on server (which includes apache2). If I remove apache2, it works

lokomass avatar Sep 16 '25 18:09 lokomass

Thanks y'all for testing the latest version. We will have to investigate the Apache issue further 😕

code-asher avatar Sep 16 '25 23:09 code-asher

Hello, same issue here.. code-server v4.104.0 code 1.104, ubuntu 22.04 I have installed code server with the install.sh script under JupyterHub, with pip-installed jupyter-server-proxy and jupyter-vscode-proxy (with Jupyterhub itself behind an Apache reverse proxy)

Old (how much old??) versions were working fine, but now if I run the command line code-server to download/install the extension I have the reported issue, but if I stop apache2 service it works (and yes, if I start Apache again, it stops). Selecting the extension in the Code GUI always works, independently of Apache.

Using the open-vsx registry, is there a url that always points to the latest version of a given extension, so I can download it and install from file ?

EDIT: a simple bash script to download/install the latest version of a given extension (initially made with ChatGPT, revised). In Ubuntu it needs the jq package to parse JSON files:


#!/bin/bash
# Usage: ./fetch-install-latest-vsix.sh FooPublisher FooExtension

set -e

PUBLISHER="$1"
EXTENSION="$2"

if [ -z "$PUBLISHER" ] || [ -z "$EXTENSION" ]; then
  echo "Usage: $0 <PUBLISHER> <EXTENSION>"
  exit 1
fi

API_URL="https://open-vsx.org/api/${PUBLISHER}/${EXTENSION}/latest"

echo "Fetching metadata from ${API_URL}..."
DOWNLOAD_URL=$(curl -s "$API_URL" | jq -r '.files.download')

if [ "$DOWNLOAD_URL" = "null" ] || [ -z "$DOWNLOAD_URL" ]; then
  echo "Error: Could not find a valid download URL in the metadata."
  exit 1
fi

OUTPUT_FILE="/tmp/${PUBLISHER}.${EXTENSION}.vsix"
echo "Downloading latest version to ${OUTPUT_FILE}..."
curl -L "$DOWNLOAD_URL" -o "$OUTPUT_FILE"

echo "✅ Download complete: $OUTPUT_FILE"

code-server --install-extension "$OUTPUT_FILE"

rm -rf "$OUTPUT_FILE"

echo "Extension ${PUBLISHER}.${EXTENSION} installed."

sylvaticus avatar Oct 08 '25 11:10 sylvaticus

Watch out for extensions that have multiple platforms, you could pull off the wrong one:

$ curl https://open-vsx.org/api/rust-lang/rust-analyzer/latest | jq -r '.files.download'
https://open-vsx.org/api/rust-lang/rust-analyzer/alpine-x64/0.4.2638/file/[email protected]

You might want something like:

curl "$url" | jq -r '.downloads | if has ("linux-x64") then ."linux-x64" else .universal end'

code-asher avatar Oct 08 '25 23:10 code-asher

Hello, Are there any updates on this? What you’re suggesting is a workaround, but not a real fix for the problem. Will it be corrected? Is anyone currently working on it? Or should we consider this workaround as the only viable long-term solution?

lokomass avatar Oct 26 '25 06:10 lokomass

I have not had a chance to look at this again unfortunately.

code-asher avatar Oct 29 '25 00:10 code-asher

Another workaround is : install extensions with cli, and then after install apache package

lokomass avatar Nov 07 '25 06:11 lokomass

Another workaround is : install extensions with cli, and then after install apache package

You don't need to install apache later, you can simply stop it, install extension, restarts apache.

sylvaticus avatar Nov 07 '25 09:11 sylvaticus

Yes. But why apache Now destroy cli extension install, then was working before ?

lokomass avatar Nov 07 '25 10:11 lokomass