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

Remote-SSH fails on non-glibc Linux instances. #423

Open
alyx opened this issue May 22, 2019 · 13 comments
Open

Remote-SSH fails on non-glibc Linux instances. #423

alyx opened this issue May 22, 2019 · 13 comments
Assignees
Labels
feature-request Request for new features or functionality ssh Issue in vscode-remote SSH

Comments

@alyx
Copy link

alyx commented May 22, 2019

  • VSCode Version: 1.35.0-insiders
  • OS Version: Windows 10 / Linux

Step 1. Using Remote-SSH, attempt to connect to a Linux server using musl instead of glibc (e.g. Alpine, select Gentoo instances, etc.).

alyx on baptiste ~/.vscode-remote/bin/4ca38ce5584d7cd67b435b3c32ef1240c6a29628 $ ldd node
        /lib64/ld-linux-x86-64.so.2 (0x7f436f63e000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f436f63e000)
        librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7f436f63e000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f436f29b000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f436f63e000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f436f084000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f436f63e000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f436f63e000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by node)
Error relocating node: gnu_get_libc_version: symbol not found
Error relocating node: __register_atfork: symbol not found
Error relocating node: __strdup: symbol not found
Error relocating node: setcontext: symbol not found
Error relocating node: makecontext: symbol not found
Error relocating node: backtrace: symbol not found
Error relocating node: getcontext: symbol not found

(Would affect any prebuilt binary, not just node; however this was the first binary found in the .vscode-remote folder)

Does this issue occur when all extensions are disabled?: No -- this issue is specifically in regards to the Remote-SSH extension.

Best resolution while still using prebuilt binaries would be to check for /lib64/ld-linux-x86-64.so or /lib/ld-musl-x86_64.so.1 and download an alternate binary based on results. Would require compiling on more than one platform but would allow for support on a wider range of Linux products.

@roblourens roblourens transferred this issue from microsoft/vscode May 22, 2019
@roblourens roblourens added the feature-request Request for new features or functionality label May 22, 2019
@roblourens
Copy link
Member

Related to #103 also

@Chuxel
Copy link
Member

Chuxel commented May 22, 2019

And #54

@awilfox
Copy link

awilfox commented May 23, 2019

Can you test this on an Adélie Linux machine with the latest gcompat package installed?

@alyx
Copy link
Author

alyx commented May 23, 2019

@awilfox

alyx on junkrat ~/.vscode-remote/bin/4ca38ce5584d7cd67b435b3c32ef1240c6a29628 $ apk list gcompat
gcompat-0.4.0-r0 x86_64 {gcompat} (UoI-NCSA) [installed]

image

alyx on junkrat ~/.vscode-remote/bin/4ca38ce5584d7cd67b435b3c32ef1240c6a29628 $ ./node
-bash: ./node: No such file or directory
alyx on junkrat ~/.vscode-remote/bin/4ca38ce5584d7cd67b435b3c32ef1240c6a29628 $ file node
node: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=42c88d3401728b722d7ea3e700cb81f90ec1cfb6, with debug_info, not stripped
alyx on junkrat ~/.vscode-remote/bin/4ca38ce5584d7cd67b435b3c32ef1240c6a29628 $ ldd node
        /lib64/ld-linux-x86-64.so.2 (0x7f1cc5d19000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f1cc5d19000)
        librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7f1cc5d19000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f1cc5976000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f1cc5d19000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f1cc575f000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f1cc5d19000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f1cc5d19000)
        ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7f1cc555a000)
Error relocating node: gnu_get_libc_version: symbol not found
Error relocating node: __register_atfork: symbol not found
Error relocating node: __strdup: symbol not found
Error relocating node: setcontext: symbol not found
Error relocating node: makecontext: symbol not found
Error relocating node: backtrace: symbol not found
Error relocating node: getcontext: symbol not found

@awilfox
Copy link

awilfox commented May 23, 2019

"No such file or directory" -> try ln -s /lib /lib64. You may also need to do the same with /usr/lib.

@alyx
Copy link
Author

alyx commented May 23, 2019

Well that fixed the first problem!
New one:
image

@awilfox
Copy link

awilfox commented May 23, 2019

That looks like libuv/libuv@afc05a3.

Is there any way to convince VSCode to use a system-provided Node.js? That would probably make things significantly easier, assuming it works with the LTS version.

@Chuxel Chuxel mentioned this issue May 30, 2019
@Nowaker
Copy link

Nowaker commented Oct 30, 2020

Same problem on armv7l architecture - device is Turris Omnia.

root@nwkr-omnia ..e414d9e4239a252d1ab117bd7067f125afd80a # file node
node: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 4.4.174, with debug_info, not stripped
root@nwkr-omnia ..e414d9e4239a252d1ab117bd7067f125afd80a # ldd node
	/lib/ld-linux-armhf.so.3 (0xb6ec8000)
	libdl.so.2 => /lib/ld-linux-armhf.so.3 (0xb6ec8000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6db4000)
	libm.so.6 => /lib/ld-linux-armhf.so.3 (0xb6ec8000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6d99000)
	libpthread.so.0 => /lib/ld-linux-armhf.so.3 (0xb6ec8000)
	libc.so.6 => /lib/ld-linux-armhf.so.3 (0xb6ec8000)
Error relocating node: __register_atfork: symbol not found
Error relocating node: __strdup: symbol not found
Error relocating node: gnu_get_libc_version: symbol not found
Error relocating node: setcontext: symbol not found
Error relocating node: backtrace: symbol not found
Error relocating node: makecontext: symbol not found
Error relocating node: getcontext: symbol not found

Given musl is supported on Alpine, would it be possible to get arm64 on musl working any soon?

@Nowaker
Copy link

Nowaker commented Oct 30, 2020

Hmm... This was enough to get it working:

ln -sf `which node` /root/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node

@ryderjgillen
Copy link

ryderjgillen commented Dec 7, 2020

works with libstdc++(10.2.1_pre1-r1)

I had to get it from Alpine Edge... 3.12 does not seem to contain the right package versions to get this working

VsCode Insiders (commit: ac165d7f974d70212be80cb15eaecfc1fd20b21a)

@ryderjgillen
Copy link

ryderjgillen commented Dec 10, 2020

That looks like libuv/libuv@afc05a3.

Is there any way to convince VSCode to use a system-provided Node.js? That would probably make things significantly easier, assuming it works with the LTS version.

Alpine libuv package has this patch: https://git.alpinelinux.org/aports/commit/?id=c94bbcd862946e8a4c7d1db89d9822b494f60c34

Interestingly VsCode Server Insiders worked with the below commit (no hacks)

VsCode Server Insiders (ac165d7f974d70212be80cb15eaecfc1fd20b21a) -- ~ 12-6-2020

  • contains NodeJS v12.18.3
  • need to use v10 libc packages on Alpine Edge to avoid symbol not found errors

However subsequent builds are failing

VsCode Server Insiders (bc13785d3dd99b4b0e9da9aed17bb79809a50804) -- ~ 12-10-2020

  • contains NodeJS v12.14.1 (note the lower NodeJS version number)
  • errors with Assertion failed: process_title.len + 1 == size (../deps/uv/src/unix/proctitle.c: uv_setup_args: 69)

Comparing the NodeJS source code of deps/uv/src/unix/proctitle.c between v12.14.1 & 12.18.3... you can see a few changes have been made including removing much of the aforementioned patch.... not sure why MS downgraded the NodeJS version but this seems to be the issue

v12.14.1

int uv_set_process_title(const char* title) {
  uv_once(&process_title_mutex_once, init_process_title_mutex_once);
  uv_mutex_lock(&process_title_mutex);

  if (process_title.len != 0) {
    /* No need to terminate, byte after is always '\0'. */
    strncpy(process_title.str, title, process_title.len);
    uv__set_process_title(title);
  }

  uv_mutex_unlock(&process_title_mutex);

  return 0;
}

v12.18.3

int uv_set_process_title(const char* title) {
  struct uv__process_title* pt;
  size_t len;

  pt = &process_title;
  len = strlen(title);

  uv_once(&process_title_mutex_once, init_process_title_mutex_once);
  uv_mutex_lock(&process_title_mutex);

  if (len >= pt->cap) {
    len = 0;
    if (pt->cap > 0)
      len = pt->cap - 1;
  }

  memcpy(pt->str, title, len);
  memset(pt->str + len, '\0', pt->cap - len);
  pt->len = len;

  uv_mutex_unlock(&process_title_mutex);

  return 0;
}

@Niek
Copy link

Niek commented Jun 18, 2021

I tried to get this working, no luck so far (even after apk add libstdc++ tar):

> tar --version:
[10:18:27.561] stderr> main: line 313: millis: command not found
[10:18:27.563] > tar (GNU tar) 1.34
> Copyright (C) 2021 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Written by John Gilmore and Jay Fenlason.
[10:18:27.563] stderr> tar: This does not look like a tar archive
[10:18:27.563] stderr> gzip: invalid magic
[10:18:27.563] stderr> tar: Child returned status 1
[10:18:27.563] stderr> tar: Error is not recoverable: exiting now
[10:18:27.563] stderr> main: line 319: elapsed: command not found
[10:18:27.565] > ERROR: tar exited with non-0 exit code: 0

Edit: seems like it tries to download the wrong package:

$ cat vscode-server.tar.gz
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /commit:/server-darwin/stable</pre>
</body>
</html>

Edit: setting remote.SSH.useLocalServer to false, doing a ln -sf /usr/bin/node /root/.vscode-server/bin/b4c1bd0a9b03c749ea011b06c6d2676c8091a70c/node and setting AllowTcpForwarding in sshd_config to test allowed me to connect. VSCode shows a correctly connected remote, but it still fails to open any file.

@tanhakabir tanhakabir added the ssh Issue in vscode-remote SSH label Oct 29, 2021
@panekj
Copy link

panekj commented Nov 16, 2021

You can use gcompat package if you want it to work but this is just a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

9 participants