vscode-remote-release
vscode-remote-release copied to clipboard
Openwrt Linux support
Can we have mips and ash shell support added? I was able to work around ash not working but I can't attempt to compile the remote server on mips as the source isn't open.
how did you work around with bash not available ?
my box doesn't have bash.. it has ash and i am getting an error
@subni9 Sorry, so work around the issue I just installed bash on the device to see if it would work. @egamma Do you want a new request for ash/non bash terminal support instead?
Aw.. yeah I am not allowed to install bash on my box. I do need a new request for ash support..
any updates on this ?
Hi! Trying to install the remote Sever for VS Code on GL.iNet GL-AR750 with Openwrt, receiving "Unsupported architecture error" - whole log see below. Is there a work around or a feature coming for mips architecture? I fulfilled the requirements: | OpenSSH server, bash, and curl or wget but is still missing or not up to date: kernel >= 3.10, glibc >=2.17, libstdc++ >= 3.4.18, Python 2.6 or 2.7, tar
[email protected] darwin x64 SSH Resolver called for "ssh-remote+gli_router", attempt 1 SSH Resolver called for host: gli_router Setting up SSH remote "gli_router" Using commit id "2213894ea0415ee8c85c5eea0d0ff81ecc191529" and quality "stable" for server Testing ssh with ssh -V ssh exited with code: 0 Got stderr from ssh: OpenSSH_7.9p1, LibreSSL 2.7.3 Running script with connection command: "ssh" -o ClearAllForwardings=true -o ConnectTimeout=15 "gli_router" bash Install and start server if needed
Running remote connection script Unsupported architecture: mips 0986b272-d53a-4363-9b1e-592defca0012##27## "install" terminal command done Received install output: 0986b272-d53a-4363-9b1e-592defca0012##27## Unsupported architecture The remote server architecture is not supported
Ok my workaround is sshfs to mount my drive locally
@TobSeCretR one of the devices I'm wanting support is a GL.iNet GL-AR750 as well. How did you find using sshfs?
Hello everyone!
I suggest a solution for remoting through visual studio code insider (vs code-insider can remote device using Openwrt). For instance, in Openwrt-SDK folder, I choose "bash", "curl" (for dowload file) package when building the firmware. In this case, I use the Raspberry Pi model 3B hardware and use OpenSDK-18.06. But, it have still failed.
[10:41:08.959] > BusyBox v1.31.0 () multi-call binary. [10:41:08.959] >
[10:41:08.960] > Usage: ps [10:41:08.960] >
[10:41:08.960] > Show list of processes [10:41:08.961] >
[10:41:08.961] > w Wide output [10:41:08.962] > bash: line 224: printenv: command not found [10:41:08.963] > Starting server... [10:41:08.964] >
[10:41:08.977] > Waiting for server log... [10:41:08.978] >
[10:41:08.979] > sleep: invalid number '.5' [10:41:08.981] > Waiting for server log... [10:41:08.994] > sleep: invalid number '.5' [10:41:08.995] >
[10:41:08.996] > Waiting for server log... [10:41:08.997] > Waiting for server log... [10:41:08.998] > sleep: invalid number '.5' [10:41:09.009] > sleep: invalid number '.5' [10:41:09.010] > Waiting for server log... [10:41:09.010] >
[10:41:09.011] > sleep: invalid number '.5' [10:41:09.012] > Waiting for server log... [10:41:09.013] > sleep: invalid number '.5' [10:41:09.015] > Waiting for server log... [10:41:09.026] > sleep: invalid number '.5' [10:41:09.026] >
/root/.vscode-server-insiders/bin/313ede61cbad8f9dc748907b3384e059ddddb79a/server.sh: line 12: /root/.vscode-server-insiders/bin/313e [10:41:12.927] > de61cbad8f9dc748907b3384e059ddddb79a/node: not found [10:41:12.927] > [10:41:12.927] > <<< End of server log
nhanlee97
Hello everyone,
I posted my solution for remoting a device using OpenWRT firmware. Link here (https://forum.openwrt.org/t/which-editor-for-develop-application/45815/4)
nhanlee97
Is there any progress?
My solution is to use RMate extension with Python Rmate server on the OpenWRT device. Similar Rmate server with in C can also be used.
I've managed to make remote server work on my x86_64 Openwrt 19.07.6 device with the help of sgerrand/alpine-pkg-glibc.
Here's my step: First go to the release package of alpine-pkg-glibc and download glibc-2.32-r0.apk and glibc-bin-2.32-r0.apk (for test) to the internal storage of your openwrt device.
Then, manually extract two packages onto rootfs ( do at your own risk ):
tar -zxvf glibc-2.32-r0.apk -C /
tar -zxvf glibc-2.32-bin.apk -C /
Test this to confirm if the glibc is working:
root@Openwrt:~# /usr/glibc-compat/bin/localedef
Try `localedef --help' or `localedef --usage' for more information.
Now we have basic glibc support on our Openwrt device, but to make remote-server eventually work, A few more steps need to be done.
First, tar
command from Openwrt busybox is incompatiable with remote server installation script, we need to copy a seperate tar binary and its depends from somewhere else. Here I choose to copy from wsl ubuntu 20.04 container on my laptop.
Make sure you have rsync
package installed previously on your Openwrt device.
check the libraries .so file which tar
depends:
$ ldd $(which tar)
linux-vdso.so.1 (0x00007fffd7411000)
libacl.so.1 => /lib/x86_64-linux-gnu/libacl.so.1 (0x00007fd6870c0000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fd687090000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd686e90000)
libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007fd686e00000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd686df0000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd687153000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd686dcd000)
Upload the tar
binary to /usr/sbin/ of storage of openwrt device, override the busybox one:
$rsync -Pav $(which tar) root@Openwrt:/usr/sbin/
Upload the share libraries to /usr/glibc-compat/lib/ :
rsync -Pav $(find /usr/lib | grep libacl) root@Openwrt:/usr/glibc-compat/lib/
rsync -Pav $(find /usr/lib | grep libselinux) root@Openwrt:/usr/glibc-compat/lib/
rsync -Pav $(find /usr/lib | grep libpcre) root@Openwrt:/usr/glibc-compat/lib/
rsync -Pav $(find /usr/lib | grep libdl) root@Openwrt:/usr/glibc-compat/lib/
Now on Openwrt device type tar
you can see the same output as you see on ubuntu/debian/arch.
At last, deal with node.js depends for remote-server.
ldd ~/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/node
linux-vdso.so.1 (0x00007ffff6ce8000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f62058f0000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6205700000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f62055b1000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6205590000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f620556d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6205370000)
/lib64/ld-linux-x86-64.so.2 (0x00007f620591b000)
Upload the share libraries again:
rsync -Pav $(find /usr/lib | grep libdl) root@Openwrt:/usr/glibc-compat/lib/
rsync -Pav $(find /usr/lib | grep libstdc++) root@Openwrt:/usr/glibc-compat/lib/
rsync -Pav $(find /usr/lib | grep libm) root@Openwrt:/usr/glibc-compat/lib/
rsync -Pav $(find /usr/lib | grep libgcc_s) root@Openwrt:/usr/glibc-compat/lib/
Now you should able to connect to the x86_64 openwrt device with ssh-remote plugin. the plugin will show some warning about glibc, but it's harmless. Be noticed: this is x86_64 devices only so far.
Thanks to @hathlife for the steps to install vscode-server on openwrt.
Here is what I'd like to share:
I installed this OpenWrt (arch x86_64, UEFI): https://drive.google.com/drive/folders/1seZiQR_HdXdo02n6MKjzg9VR96Ll6E27
I installed this glibc-compat: https://github.com/sgerrand/alpine-pkg-glibc/releases/tag/2.34-r0
I believe you can do opkg install tar
to replace the one provided by busybox, then tar should be OK. I can see that the folder at ~/.vscode-server/bin/
is populated with the .tar.gz
file downloaded. My vscode-server is at: /root/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3
I followed the instructions to rsync-copy stuff from my WSL 2 ubuntu 20.20 system. But this seems to cause problems:
# /root/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/node
/root/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/node: error while loading shared libraries: libdl.so.2: object file has no dynamic section
# ldd node
/lib64/ld-linux-x86-64.so.2 (0x7f7a641a8000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f7a641a8000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f7a640c2000)
libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f7a641a8000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x7f7a640ae000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f7a641a8000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f7a641a8000)
ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7f7a6407a000)
Error relocating /lib/ld-linux-x86-64.so.2: unsupported relocation type 37
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
# /usr/glibc-compat/bin/ldd /root/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/node
/root/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/node: error while loading shared libraries: libdl.so.2: object file has no dynamic section
Then I decided to overwrite those files from WSL Ubuntu by extracting the glibc-compat lib files again:
# tar xvf /root/glibc-bin-2.34-r0.apk
# tar xzf glibc-2.34-r0.apk -C /
Then the node
binary can be run, and VS Code successfully connected to remote-ssh of my OpenWrt system.
I also install git as follows:
opkg install git-http
opkg install ca-bundle
Now the issue I have is extension won't install, e.g., I clicked install for the Python plugin, it is just stuck, with button showing "installing".
Here is my solution:
` opkg install node
cd .vscode-server/bin/long_hash/ rm node which node cp /usr/bin/node node `
It is to replace the built-in node.
With Openwrt 21.02 and glibc-2.35, I can connect to my router but won't be able to open any folder with this error message "channel 3: open failed: connect failed: connection refused vscode" I solved it by following @hathlife 's instructions with glibc-2.32 then override all the files with glibc-2.35. Hope that helps.
Here is my solution:
` opkg install node
cd .vscode-server/bin/long_hash/ rm node which node cp /usr/bin/node node `
It is to replace the built-in node.
Here is my solution:
` opkg install node
cd .vscode-server/bin/long_hash/ rm node which node cp /usr/bin/node node `
It is to replace the built-in node.
this works for me
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.
If you wonder what we are up to, please see our roadmap and issue reporting guidelines.
Thanks for your understanding and happy coding!
I found we don't need to install all files from glibc-2.32-r0.apk.
Here are my steps:
-
Install bash
opkg install bash
-
Install tar
opkg install tar
-
Use vscode-remote to connect to openwrt, the zip file should be unzipped under /root/.vscode-server/bin/{long-hash} it also outputs errors like the following
> Waiting for server log...
> sleep: invalid number '.03'
> Waiting for server log...
> sleep: invalid number '.03'
-
Install file
opkg install file
-
Check which program interpreter node depends on.
cd .vscode-server/bin/long_hash/
file node
For me, it outputs below, the interpreter is /lib/ld-linux-aarch64.so.1
ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=a8fad5e4f3f62678296d00632cf12c317efc7e15, with debug_info, not stripped
For x86/64 system it would be /lib64/ld-linux-x86-64.so.2
- Locate this file on your other Linux system if available, or alternatively, download it from the official online glibc package site. In my situation, I can obtain it from the following source: https://archlinuxarm.org/packages/aarch64/glibc. You will only need to extract the /usr/lib/ld-linux-aarch64.so.1 file from this package
- Copy /lib/ld-linux-aarch64.so.1 to openwrt's same path
- Replace node
opkg install node
cd .vscode-server/bin/long_hash/
rm node
which node
cp /usr/bin/node node
-
Connect from vscode again.
-
I found an error that says
line 40: getconf: not found
, to solve this, just go to /root/.vscode-server/bin/long_has/bin/helpers/check-requirements.sh and change the following
BITNESS=$(getconf LONG_BIT)
To
BITNESS=64
64 is my arch
11 Connect again, working now.