amitds1997 / remote-nvim.nvim

Remote development in Neovim 🔥
MIT License
613 stars 13 forks source link

Can't attach to existing devpod workspace to neovim `nvim-v0.10.0-linux.appimage: No such file or directory` #131

Open PyDataBlog opened 4 months ago

PyDataBlog commented 4 months ago

Describe the bug

The plugin is struggling to find the linux appimage when following the same process shown in the project demo for attaching to an existing devpod workspace.

To reproduce

Steps to reproduce the behavior:

  1. Start the demo workspace with devpod: devpod up github.com/microsoft/vscode-remote-try-node --ide None
  2. Select the existing devpod workspace vscode-remote-try-node with RemoteStart command
  3. Everything works as expected until it gets to Extracting Neovim binary...
  4. See error

    
     Launch Neovim (Run no. 1) (no longer active)
     Setting up devcontainer workspace
    Command: devpod up --open-ide=false --configure-ssh=true --ide=none --ssh-config=/home/bebr/.local/share/nvim/remote-nvim.nvim/ssh_config --log-output=raw vscode-remote-try-node --id vscode-remote-try-node
    
    Workspace vscode-remote-try-node already exists
    Creating devcontainer...
    Setup container...
    Run 'ssh vscode-remote-try-node.devpod' to ssh into the devcontainer
     Testing remote connection
    Command: echo 'Hello'
    
    Hello
     Determining OS on remote machine
    Command: uname -s -m
    
    Linux x86_64
     Checking if Neovim is installed system-wide on remote
    Command: nvim --version || true
    
    bash: line 1: nvim: command not found
     Choice: Choose Neovim version to install
    Choice selected: v0.10.0
     Determining remote user's home directory
    Command: echo $HOME
    
    /home/node
     Creating custom neovim directories on remote
    Command: mkdir -p /home/node/.remote-nvim/scripts && mkdir -p /home/node/.remote-nvim/workspaces/jeB0nKDQSw/.config/nvim && mkdir -p /home/node/.remote-nvim/workspaces/jeB0nKDQSw/.cache/nvim && mkdir -p /home/node/.remote-nvim/workspaces/jeB0nKDQSw/.local/state/nvim && mkdir -p /home/node/.remote-nvim/workspaces/jeB0nKDQSw/.local/share/nvim && mkdir -p /home/node/.remote-nvim/nvim-downloads/v0.10.0
    
     Copying plugin scripts onto remote
    Command: COPY /home/bebr/.local/share/nvim/lazy/remote-nvim.nvim/scripts -> /home/node/.remote-nvim
    
    free_port_finder.lua                            0%    0     0.0KB/s   --:-- ETA
    free_port_finder.lua                          100%  216   995.4KB/s   00:00    
    neovim_download.sh                              0%    0     0.0KB/s   --:-- ETA
    neovim_download.sh                            100% 4175    13.7MB/s   00:00    
    neovim_install.sh                               0%    0     0.0KB/s   --:-- ETA
    neovim_install.sh                             100% 7088    25.9MB/s   00:00    
     Installing Neovim (if required)
    Command: chmod +x /home/node/.remote-nvim/scripts/neovim_download.sh && chmod +x /home/node/.remote-nvim/scripts/neovim_install.sh && /home/node/.remote-nvim/scripts/neovim_install.sh -v v0.10.0 -d /home/node/.remote-nvim -m binary -a x86_64
    
    Downloading Neovim...
    Download completed.
    Extracting Neovim binary...
    /home/node/.remote-nvim/scripts/neovim_install.sh: line 97: /tmp/tmp.Hu3vgUFWDo/nvim-v0.10.0-linux.appimage: No such file or directory

## Expected behavior

Just like the demos show, the plugin should successfully attach to 

## Screenshots

If applicable, add screenshots to help explain your problem.

## System info

- Your local OS: `EndeavourOS - Arch distro`
- Local Neovim version: `0.10.0`
- Remote host OS (if applicable): `vscode-remote-try-node.devpod`
- Remote Neovim version (if applicable): `0.10.0`

## Additional context

Add any other context about the problem here.

Healthcheck passes for the plugin:

```sh
==============================================================================
remote-nvim: require("remote-nvim.health").check()

remote-nvim.nvim ~
- OK curl: `curl 8.7.1 (x86_64-pc-linux-gnu) libcurl/8.7.1 OpenSSL/3.3.0 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.62.1 nghttp3/1.3.0`
- OK tar: `tar (GNU tar) 1.35`
- OK ssh: `OpenSSH_9.7p1, OpenSSL 3.3.0 9 Apr 2024`
- OK devpod: `v0.5.7`
- OK docker: `Docker version 26.1.3, build b72abbb6f0`

and I can successfully vs code to the same instance if I run with vscode ide.

Neovim installed from arch extra sources:

❯ nvim -V1 -v
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

1 extra/neovim 0.10.0-2 (6.9 MiB 28.5 MiB) (Installed)
    Fork of Vim aiming to improve user experience, plugins, and GUIs
amitds1997 commented 4 months ago

Thanks for reporting this! Let me have a look. I tried it once at my end and it worked fine. Maybe I might have missed an edge case. I'll update you once I find something.

PyDataBlog commented 4 months ago

Thanks for reporting this! Let me have a look. I tried it once at my end and it worked fine. Maybe I might have missed an edge case. I'll update you once I find something.

Looking forward

PyDataBlog commented 4 months ago

I can confirm that this issue exists on MacOS as well.

amitds1997 commented 4 months ago

Hey 👋 , I'm already working on the issue with macOS. The reason for the failure is that with the latest stable release, the release naming convention has changed for macOS at Neovim end. So, the install script needs to adapt to it. This would be fixed in the next couple of hours.

amitds1997 commented 4 months ago

I was unable to reproduce the original issue on my machine (both macOS and arch) :/ I also tried reproducing it with a minimal init.lua file but was unable to reproduce it. Could you try it once with this minimal init.lua?

Here's the reproduction video:

https://github.com/amitds1997/remote-nvim.nvim/assets/29333147/419dc266-4e90-455a-a4b1-1fef5ecae0b1

Let me know if the issue still persists.

amitds1997 commented 4 months ago

P.S. The issue with macOS releases has been fixed in the latest release.

PyDataBlog commented 4 months ago

P.S. The issue with macOS releases has been fixed in the latest release.

Didn't work on Mac even after updating:

  Config

   Log path         : /Users/bebr/.local/state/nvim/remote-nvim.nvim.log
   Host ID          : vscode-remote-try-node
   Version (Commit) : 0.3.7 (44a24e2fe5337b09b4a9ed44bdd001e672d99ec9)

  Local config

   OS             : macOS
   Neovim version : 0.10.0-dev

  Remote config

   OS              : Linux
   Neovim version  : v0.10.0
   Connection type : devpod
   Host URI        : vscode-remote-try-node.devpod
   Connection opts : <no-extra-options>
   Workspace path  : /home/node/.remote-nvim/workspaces/watKG9g2gK
   Working dir.    : <not-provided>

with this error:

  Launch Neovim (Run no. 1) (no longer active)
   Setting up devcontainer workspace
    Command: devpod up --open-ide=false --configure-ssh=true --ide=none --log-output=raw vscode-remote-try-node --id vscode-remote-try-node

    Workspace vscode-remote-try-node already exists
    Creating devcontainer...
    Setup container...
    Run 'ssh vscode-remote-try-node.devpod' to ssh into the devcontainer
   Testing remote connection
    Command: echo 'Hello'

    Hello
   Determining OS on remote machine
    Command: uname -s -m

    Linux aarch64
   Checking if Neovim is installed system-wide on remote
    Command: nvim --version || true

    bash: line 1: nvim: command not found
   Choice: Choose Neovim version to install
    Choice selected: v0.10.0
   Determining remote user's home directory
    Command: echo $HOME

    /home/node
   Creating custom neovim directories on remote
    Command: mkdir -p /home/node/.remote-nvim/scripts && mkdir -p /home/node/.remote-nvim/workspaces/watKG9g2gK/.config/nvim && mkdir -p /home/node/.remote-nvim/workspaces/watKG9g2gK/.cache/nvim && mkdir -p /home/node/.remote-nvim/workspaces/watKG9g2gK/.local/state/nvim && mkdir -p /home/node/.remote-nvim/workspaces/watKG9g2gK/.local/share/nvim && mkdir -p /home/node/.remote-nvim/nvim-downloads/v0.10.0

   Copying plugin scripts onto remote
    Command: COPY /Users/bebr/.local/share/nvim/lazy/remote-nvim.nvim/scripts -> /home/node/.remote-nvim

    neovim_download.sh                              0%    0     0.0KB/s   --:-- ETA
    neovim_download.sh                            100% 4925     4.2MB/s   00:00    
    neovim_utils.sh                                 0%    0     0.0KB/s   --:-- ETA
    neovim_utils.sh                               100%  774   866.8KB/s   00:00    
    neovim_install.sh                               0%    0     0.0KB/s   --:-- ETA
    neovim_install.sh                             100% 7433     7.1MB/s   00:00    
    free_port_finder.lua                            0%    0     0.0KB/s   --:-- ETA
    free_port_finder.lua                          100%  216   368.8KB/s   00:00    
   Installing Neovim (if required)
    Command: chmod +x /home/node/.remote-nvim/scripts/neovim_download.sh && chmod +x /home/node/.remote-nvim/scripts/neovim_utils.sh && chmod +x /home/node/.remote-nvim/scripts/neovim_install.sh && /home/node/.remote-nvim/scripts/neovim_install.sh -v v0.10.0 -d /home/node/.remote-nvim -m binary -a aarch64

    Downloading Neovim...
    Download completed.
    Extracting Neovim binary...
    /home/node/.remote-nvim/scripts/neovim_install.sh: line 97: /tmp/tmp.URr9lbjRpJ/nvim-v0.10.0-linux.appimage: cannot execute binary file: Exec format error
amitds1997 commented 4 months ago
  Launch Neovim (Run no. 1) (no longer active)
   Setting up devcontainer workspace
  ....
   Determining OS on remote machine
    Command: uname -s -m

    Linux aarch64
  ....
    /home/node/.remote-nvim/scripts/neovim_install.sh: line 97: /tmp/tmp.URr9lbjRpJ/nvim-v0.10.0-linux.appimage: cannot execute binary file: Exec format error

Neovim does not publish arm64 images for Linux yet. See this issue. :/ So, for now, you would have to build it from source or install it on the remote. Ideally, the plugin should have prompted you that there is no binary available. I have pushed another fix to handle this. It now catches aarch and will tell you correctly that it is missing. Updating the plugin should allow you to build it from source. Do note that, this would require the build dependencies to be installed on remote.

The original issue was with x86_64 machine. Let me know if you are able to see this there.

PyDataBlog commented 4 months ago

  Launch Neovim (Run no. 1) (no longer active)

   Setting up devcontainer workspace

  ....

   Determining OS on remote machine

    Command: uname -s -m

    Linux aarch64

  ....

    /home/node/.remote-nvim/scripts/neovim_install.sh: line 97: /tmp/tmp.URr9lbjRpJ/nvim-v0.10.0-linux.appimage: cannot execute binary file: Exec format error

Neovim does not publish arm64 images for Linux yet. See this issue. :/

So, for now, you would have to build it from source or install it on the remote. Ideally, the plugin should have prompted you that there is no binary available. I have pushed another fix to handle this. It now catches aarch and will tell you correctly that it is missing. Updating the plugin should allow you to build it from source. Do note that, this would require the build dependencies to be installed on remote.

The original issue was with x86_64 machine. Let me know if you are able to see this there.

what's the config for building from source?

amitds1997 commented 4 months ago

Just having the dependencies for the remote OS mentioned in https://github.com/neovim/neovim/blob/master/BUILD.md should be enough. After the latest release, it should automatically build it for you as long as the dependencies on remote are installed.

PyDataBlog commented 4 months ago

Just having the dependencies for the remote OS mentioned in https://github.com/neovim/neovim/blob/master/BUILD.md should be enough. After the latest release, it should automatically build it for you as long as the dependencies on remote are installed.

Mac works now as it build from source ❤️

but arch still failing:

  Launch Neovim (Run no. 1) (no longer active)
   Setting up devcontainer workspace
    Command: devpod up --open-ide=false --configure-ssh=true --ide=none --log-output=raw vscode-remote-try-node --id vscode-remote-try-node

    Workspace vscode-remote-try-node already exists
    Creating devcontainer...
    Setup container...
    Run 'ssh vscode-remote-try-node.devpod' to ssh into the devcontainer
   Testing remote connection
    Command: echo 'Hello'

    Hello
   Determining OS on remote machine
    Command: uname -s -m

    Linux x86_64
   Checking if Neovim is installed system-wide on remote
    Command: nvim --version || true

    bash: line 1: nvim: command not found
   Choice: Choose Neovim version to install
    Choice selected: v0.10.0
   Determining remote user's home directory
    Command: echo $HOME

    /home/node
   Creating custom neovim directories on remote
    Command: mkdir -p /home/node/.remote-nvim/scripts && mkdir -p /home/node/.remote-nvim/workspaces/JSo2Fn8vSF/.config/nvim && mkdir -p /home/node/.remote-nvim/workspaces/JSo2Fn8vSF/.cache/nvim && mkdir -p /home/node/.remote-nvim/workspaces/JSo2Fn8vSF/.local/state/nvim && mkdir -p /home/node/.remote-nvim/workspaces/JSo2Fn8vSF/.local/share/nvim && mkdir -p /home/node/.remote-nvim/nvim-downloads/v0.10.0

   Copying plugin scripts onto remote
    Command: COPY /home/bebr/.local/share/nvim/lazy/remote-nvim.nvim/scripts -> /home/node/.remote-nvim

    free_port_finder.lua                            0%    0     0.0KB/s   --:-- ETA
    free_port_finder.lua                          100%  216   813.0KB/s   00:00    
    neovim_download.sh                              0%    0     0.0KB/s   --:-- ETA
    neovim_download.sh                            100% 4925    12.0MB/s   00:00    
    neovim_install.sh                               0%    0     0.0KB/s   --:-- ETA
    neovim_install.sh                             100% 7433    21.8MB/s   00:00    
    neovim_utils.sh                                 0%    0     0.0KB/s   --:-- ETA
    neovim_utils.sh                               100%  774     2.8MB/s   00:00    
   Installing Neovim (if required)
    Command: chmod +x /home/node/.remote-nvim/scripts/neovim_download.sh && chmod +x /home/node/.remote-nvim/scripts/neovim_utils.sh && chmod +x /home/node/.remote-nvim/scripts/neovim_install.sh && /home/node/.remote-nvim/scripts/neovim_install.sh -v v0.10.0 -d /home/node/.remote-nvim -m binary -a x86_64

    Downloading Neovim...
    Download completed.
    Extracting Neovim binary...
    /home/node/.remote-nvim/scripts/neovim_install.sh: line 97: /tmp/tmp.T04mxxk7Lk/nvim-v0.10.0-linux.appimage: No such file or directory

why doesn't the download script also offer chance to build from source for linux as well?

amitds1997 commented 4 months ago

why doesn't the download script also offer chance to build from source for linux as well?

This is because we prefer binaries (since they require no effort from the user end). If we know that a binary exists for the system, we use that instead of building from source.

I'll look into the error further when I get some time but I'm not sure why this error is popping up when it should not 😓