Open Bit-Chaos opened 2 years ago
I was looking for this for a long time. However I found a way to use remote-ssh to a alpine vm recently. Following is what I did on the alpine(remote) box:
# This is what make vscode remote-ssh work
apk add gcompat libstdc++ curl git
# As alpine by default use busybox and some common utilities behave differently, like grep
apk add grep dropbear-scp dropbear-ssh
# Add zsh if using zsh shell
apk add zsh
The warning still show up, but work normally so far. I can verify docker extension works in this setup.
gcompat libstdc++ curl
THANK YOU! For ages, this just wouldn't work. Note that I made a couple of changes: I use openssh, and it works just fine. bash works too. Otherwise, everything is flawless with a properly set up .ssh/config file. I can now log into my LXD containers through a proxy tunnel flawlessly.
Using the packages mentioned above, I'm able to make a remote SSH connection and almost everything works.
The only outstanding issues I encounter are :
[2022-05-22T21:58:33.014Z] Validating found git in: git
[2022-05-22T21:58:33.019Z] Git installation not found.
I don't mind if this is ever officially supported, but fixing git and allowing me to disable the warning would make this a great solution for me.
I don't mind if this is ever officially supported, but fixing git and allowing me to disable the warning would make this a great solution for me.
Alpine always do minimal installation, so we have to install git ourselves. In the alpine box, as root:
apk add git
Alpine always do minimal installation, so we have to install git ourselves. In the alpine box, as root:
apk add git
Yes, I have git installed. vscode cannot find or use it for some reason.
Alpine always do minimal installation, so we have to install git ourselves. In the alpine box, as root:
apk add git
Yes, I have git installed. vscode cannot find or use it for some reason.
In vscode setting, try:
"git.ignoreMissingGitWarning": true,
In vscode setting, try:
"git.ignoreMissingGitWarning": true,
I already had this setting enabled. Ignoring the warning hides the popup but I want vscode to find the installed git so that the version control integrations work.
Is there any way to enable better debugging or troubleshoot the git not found failure?
In vscode setting, try:
"git.ignoreMissingGitWarning": true,
I already had this setting enabled. Ignoring the warning hides the popup but I want vscode to find the installed git so that the version control integrations work.
Is there any way to enable better debugging or troubleshoot the git not found failure?
I remember spending hours hunting that down after posting here. Solved it but forgot to drop down notes. The cause is VS Code remote server(or the SCM extension) cannot get default environment on Alpine Linux, which include $PATH.
I dig through my alpine setup and updated my blog here: https://johnsiu.com/blog/alpine-vscode/#vs-code-and-alpine-git
PS: Regarding debugging, as long as ssh tunnel is working, log is located on the remote box: $HOME/.vscode-server/data/logs/<timestamp>/remoteagent.log
. If ssh tunnel is not working, there maybe none or minimum.
Ok, so hardcoding the git path as @J-Siu shows in their blog works. Adding to the remote settings JSON and reloading the window gives SCM functionality:
"git.path": "/usr/bin/git"
It would still be better if VSCode could correctly read the path of the git binary from the environment. It's not as if /usr/bin
is a non-standard location.
I was looking for this for a long time. However I found a way to use remote-ssh to a alpine vm recently. Following is what I did on the alpine(remote) box:
# This is what make vscode remote-ssh work apk add gcompat libstdc++ curl git # As alpine by default use busybox and some common utilities behave differently, like grep apk add grep dropbear-scp dropbear-ssh # Add zsh if using zsh shell apk add zsh
The warning still show up, but work normally so far. I can verify docker extension works in this setup.
Thanks you so much. But after install above package you need to config /etc/ssh/sshd_config and modifed from "#AllowTcpForwarding no" to AllowTcpForwarding yes
Has anyone got remote containers working through an Alpine SSH host? I seem to have hit #6739 while trying.
[9103 ms] Host server: Error: spawn git ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
[9104 ms] Host server: (node:3273) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
(Use `node --trace-warnings ...` to show where the warning was created)
[9106 ms] Host server: Error: spawn test ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
[9107 ms] Host server: (node:3273) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)
I was looking for this for a long time. However I found a way to use remote-ssh to a alpine vm recently. Following is what I did on the alpine(remote) box:
# This is what make vscode remote-ssh work apk add gcompat libstdc++ curl git # As alpine by default use busybox and some common utilities behave differently, like grep apk add grep dropbear-scp dropbear-ssh # Add zsh if using zsh shell apk add zsh
The warning still show up, but work normally so far. I can verify docker extension works in this setup.
Physical machine(on amd64) with Alpine Linux still does not work yet.
@santicalcagno Have you try all steps on my blog yet?: https://johnsiu.com/blog/alpine-vscode/#vs-code-and-alpine-git
One quick test is try to ssh to the alpine vm with ssh tunnel, if that doesn't work, then you need to update sshd config in alpine vm.
@J-Siu yeah, unfortunately I still have those ENOENT errors after following your guide (thanks!). I tried tunneling via ssh -L
and I see output on both sides of the connection while testing with nc
, so that looks good. Maybe something else from the default config needs to be changed to make it work, but I dunno. At this point I went back to a non-Alpine VM, maybe I'll try again in a couple months.
FWIW, this is all on aarch64 (M1 mac running VSCode in macOS, SSH'ing to an aarch64 Alpine VM). The issue I linked made me suspicious of the VM arch playing a part in this, but I created an x64 Alpine VM and as far as I could test the issue still happens in my machine.
1.74.0 introduced a new Remote Tunnels feature. I'm hoping this is something that can simplify connecting to a running container.
I had the same issue and I can't use VSCode with alpine linux VM. But I realized that I can use another VSCode extension for a remote ssh connection. And It works. The extension's called SSH FS.
localhost:~$ code-cli --version
code-cli 1.75.0 (commit e2816fe719a4026ffa1ee0189dc89bdfdbafb164)
localhost:~$ uname -a
Linux localhost 5.15.89-0-lts #1-Alpine SMP Thu, 19 Jan 2023 08:07:26 +0000 x86_64 Linux
VSCode now can use Remote Tunnels to connect Alpine Linux installed on Physical machines.
But latency is a serious problem, and it would be nice to have a native SSH Remote method support.
I was looking for this for a long time. However I found a way to use remote-ssh to a alpine vm recently. Following is what I did on the alpine(remote) box:
# This is what make vscode remote-ssh work apk add gcompat libstdc++ curl git # As alpine by default use busybox and some common utilities behave differently, like grep apk add grep dropbear-scp dropbear-ssh # Add zsh if using zsh shell apk add zsh
The warning still show up, but work normally so far. I can verify docker extension works in this setup.
This wasn'tenough for me. I also has to install bash
to get the connection working.
Unfortunately with the latest remote requirements (glibc >=2.28, libstdc++ >= 3.4.25) it seems these packages aren't enough to run the remote server.
Unfortunately with the latest remote requirements (glibc >=2.28, libstdc++ >= 3.4.25) it seems these packages aren't enough to run the remote server.
use 1.85.2 and disable auto update
They've backed down on the lastest GLIBC and LIBCXX requirements for another 12 months. I haven't tested yet, but updating to 1.86.1 would probably allow SSH remote to Alpine with the above mentioned packages.
@mill1000 Yes, I confirm on Alpine 3.19 and on latest code 1.86.1 you can connect to an Alpine server with the gcompat, libstdc++ and bash packages installed as a minimum. You do get an ugly non-dismissable unspported OS banner though.
I hope that before the year is up that we get some sort of official support on the server side for musl-based distros. I have Alpine running on most of my servers and cloud instances. VS Code already supports alpine inside of dev containers, so it would appear most of what needs to be working already does. (Perhaps there's a way to fool the code server into thinking it's in a dev container or something?)
After the recent update I had to install the GNU ps tool, too. So here's my setup:
apk add bash procps gcompat libstdc++ curl git
Then configure the VSCode Server to find the git tool:
mkdir -p /root/.vscode-server/data/Machine
cat > /root/.vscode-server/data/Machine/settings.json <<EOF
{
"git.path": "/usr/bin/git"
}
EOF
Currently Alpine Linux is supported for WSL-Remoting only. It would be great seeing support for Alpine using SSH on remote machines so that development can be done on cloud-instances running MUSL-based distributions.