remote-nvim.nvim icon indicating copy to clipboard operation
remote-nvim.nvim copied to clipboard

SCP'ing Config To Remote Fails

Open inhesrom opened this issue 1 year ago • 15 comments

It appears that I am unable to copy my nvim config to the remote host, and I cannot figure out why this is happening. I have tried completely deleting my whole setup including cache and reinstalling.

image

inhesrom avatar Jun 19 '24 04:06 inhesrom

Sorry about this. This might have been caused by the latest release. Can you downgrade to ~v0.2.9~ v0.3.9 and let me know. I think that should make it work. For me to handle this edge case, could you provide the output your SSH version info (ssh -V).

Edit: Version -> v0.3.9 not v0.2.9

amitds1997 avatar Jun 19 '24 05:06 amitds1997

I am having the same problem here. I tried manually change the configuration path my plugin config.lua file as shown in the documentation (see code below), but did not work.

return {
    "amitds1997/remote-nvim.nvim",
    version = "*",                 -- Pin to GitHub releases
    dependencies = {
        "nvim-lua/plenary.nvim",   -- For standard functions
        "MunifTanjim/nui.nvim",    -- To build the plugin UI
        "nvim-telescope/telescope.nvim", -- For picking b/w different remote methods
    },
    config = function()
        require("remote-nvim").setup({
            -- Remote configuration
            remote = {
                app_name = "nvim", -- This directly maps to the value NVIM_APPNAME. If you use any other paths for configuration, also make sure to set this.
                -- List of directories that should be copied over
                copy_dirs = {
                    -- What to copy to remote's Neovim config directory
                    config = {
                        base = "~/.dotfiles/.config/nvim/",
                        dirs = "*", -- Directories that should be copied over. "*" means all directories. To specify a subset, use a list like {"lazy", "mason"} where "lazy", "mason" are subdirectories}
                    }
                }
            }
        })
    end
}

Downgrading to v0.2.7 has worked, since v0.2.9 is not available in the release tags. Any idea of the cause of the issue?

Diogo364 avatar Jun 19 '24 13:06 Diogo364

Yeah, I do know the cause. Basically, when copying all dirs we use the syntax <base-path>/. to indicate the directory path <base-path> (in the latest release). This seems to not work on some systems. So, we see the error: no such filename . It somehow interprets . as a filename and not the denotion for current directory.

So, having the SSH client and system information would help me debug this.

amitds1997 avatar Jun 19 '24 14:06 amitds1997

Downgrading to v0.2.7 has worked, since v0.2.9 is not available in the release tags. Any idea of the cause of the issue?

Sorry, the version would be v0.3.9 (previous to the latest release)

amitds1997 avatar Jun 19 '24 14:06 amitds1997

Here are a few informations regarding the SSH and my system:

  • OpenSSH_8.9p1 Ubuntu-3ubuntu0.7, OpenSSL 3.0.2 15 Mar 2022
  • Ubuntu 22.04.4 LTS
  • zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

Diogo364 avatar Jun 19 '24 15:06 Diogo364

Here is my ssh version:

OpenSSH_8.0p1, OpenSSL 1.1.1k FIPS 25 Mar 2021

NAME="Rocky Linux" VERSION="8.10 (Green Obsidian)"

inhesrom avatar Jun 19 '24 19:06 inhesrom

Hey all, got busy so never got around to this. Just for some context, this is the solution that I tried to implement (in the latest release) and it worked on some systems but not all. I'm digging more into it and would let you both know once a fix/solution is released.

One other thing I noticed is that, you both have OpenSSH 8.x versions, mine is OpenSSH 9.x. So, maybe it might have been patched back in the 9.x releases.

amitds1997 avatar Jul 06 '24 05:07 amitds1997

I can confirm that I have the same problem when communicating between two docker containers using OpenSSH_8.2

@amitds1997 Is there any way to log the raw ssh/scp commands that are being run at each step? setting log.level = "debug" only adds a little more information.

TakodaS avatar Jul 10 '24 15:07 TakodaS

I can confirm that I have the same problem when communicating between two docker containers using OpenSSH_8.2

@amitds1997 Is there any way to log the raw ssh/scp commands that are being run at each step? setting log.level = "debug" only adds a little more information.

Thanks for your feedback. I will make sure to add more verbose logging for the ssh/scp command.

Meanwhile, I do have a fix that I'm testing out. Hope the workaround mentioned above works for you right now.

amitds1997 avatar Jul 10 '24 15:07 amitds1997

I can confirm that upgrading to OpenSSH_9.8 solves this issue! Just as a sanity check, it is expected that a RemoteStart from within a nvim -u repro.lua client will have an empty vimrc/lua configuration correct?

I came across the above problem while trying to debug my main machine which fails on the echo 'Hello' check with the following output:

DEBUG Wed 10 Jul 2024 13:19:24 BST /nix/store/8qvna5qxr8yil5l53lchi9db9r7frfb7-vim-pack-dir/pack/myNeovimPackages/start/remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:866: [ssh][ubuntu-container] Starting remote neovim launch
DEBUG Wed 10 Jul 2024 13:19:24 BST /nix/store/8qvna5qxr8yil5l53lchi9db9r7frfb7-vim-pack-dir/pack/myNeovimPackages/start/remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:141: Did not find any existing configuration. Creating one now..
DEBUG Wed 10 Jul 2024 13:19:24 BST /nix/store/8qvna5qxr8yil5l53lchi9db9r7frfb7-vim-pack-dir/pack/myNeovimPackages/start/remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:995: ["ssh"]["ubuntu-container"] Running "echo 'Hello'"
DEBUG Wed 10 Jul 2024 13:19:25 BST /nix/store/8qvna5qxr8yil5l53lchi9db9r7frfb7-vim-pack-dir/pack/myNeovimPackages/start/remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:1015: ["ssh"]["ubuntu-container"] Running "echo 'Hello'" completed
ERROR Wed 10 Jul 2024 13:19:25 BST /nix/store/8qvna5qxr8yil5l53lchi9db9r7frfb7-vim-pack-dir/pack/myNeovimPackages/start/remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:973: 'Testing remote connection' failed.
stack traceback:
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:974: in function '_handle_job_completion'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:1017: in function 'run_command'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:142: in function '_setup_workspace_variables'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:872: in function '_launch_neovim'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:883: in function <.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:882>
	[C]: in function 'xpcall'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:759: in function <.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:758> 

FAILED JOB OUTPUT (SO FAR)
bash: -c: line 1: unexpected EOF while looking for matching `''
bash: -c: line 2: syntax error: unexpected end of file

Which uses OpenSSH_9.8, but since I am going from a NixOS machine to a docker container, there are more than a few moving parts to investigate along the lines of #150 before I feel comfortable opening a new issue. If you have any ideas what might be causing this please let me know!

Thank you for this amazing plugin, I think it has great potential :)

TakodaS avatar Jul 10 '24 16:07 TakodaS

I can confirm that upgrading to OpenSSH_9.8 solves this issue!

Thanks for doing this 👍 This helps!

Just as a sanity check, it is expected that a RemoteStart from within a nvim -u repro.lua client will have an empty vimrc/lua configuration correct?

Yup, the hope is this will help isolate issues that are caused by the plugin and not by the user configuration. And give me an easy way to reproduce most issues. You can add your plugins and configuration specific to your setup in it and add it to the issue so that I can reproduce it too.

I came across the above problem while trying to debug my main machine which fails on the echo 'Hello' check with the following output:

DEBUG Wed 10 Jul 2024 13:19:24 BST /nix/store/8qvna5qxr8yil5l53lchi9db9r7frfb7-vim-pack-dir/pack/myNeovimPackages/start/remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:866: [ssh][ubuntu-container] Starting remote neovim launch
DEBUG Wed 10 Jul 2024 13:19:24 BST /nix/store/8qvna5qxr8yil5l53lchi9db9r7frfb7-vim-pack-dir/pack/myNeovimPackages/start/remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:141: Did not find any existing configuration. Creating one now..
DEBUG Wed 10 Jul 2024 13:19:24 BST /nix/store/8qvna5qxr8yil5l53lchi9db9r7frfb7-vim-pack-dir/pack/myNeovimPackages/start/remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:995: ["ssh"]["ubuntu-container"] Running "echo 'Hello'"
DEBUG Wed 10 Jul 2024 13:19:25 BST /nix/store/8qvna5qxr8yil5l53lchi9db9r7frfb7-vim-pack-dir/pack/myNeovimPackages/start/remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:1015: ["ssh"]["ubuntu-container"] Running "echo 'Hello'" completed
ERROR Wed 10 Jul 2024 13:19:25 BST /nix/store/8qvna5qxr8yil5l53lchi9db9r7frfb7-vim-pack-dir/pack/myNeovimPackages/start/remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:973: 'Testing remote connection' failed.
stack traceback:
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:974: in function '_handle_job_completion'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:1017: in function 'run_command'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:142: in function '_setup_workspace_variables'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:872: in function '_launch_neovim'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:883: in function <.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:882>
	[C]: in function 'xpcall'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:759: in function <.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:758> 

FAILED JOB OUTPUT (SO FAR)
bash: -c: line 1: unexpected EOF while looking for matching `''
bash: -c: line 2: syntax error: unexpected end of file

Which uses OpenSSH_9.8, but since I am going from a NixOS machine to a docker container, there are more than a few moving parts to investigate along the lines of #150 before I feel comfortable opening a new issue. If you have any ideas what might be causing this please let me know!

I have created a new issue to track this: https://github.com/amitds1997/remote-nvim.nvim/issues/157. Let's tackle it there!

Thank you for this amazing plugin, I think it has great potential :)

Thanks, I appreciate it! ❤️

amitds1997 avatar Jul 12 '24 06:07 amitds1997

Hi there, are there still plans to get this working with OpenSSH 8.X?

brianhorn avatar Oct 10 '24 08:10 brianhorn

I'm using openssh-client v8.9p1, and I have this issue too

bassemkaroui avatar Aug 23 '25 06:08 bassemkaroui

Replacing scp with rsync seems to do the trick:

  'amitds1997/remote-nvim.nvim',
  version = '*', -- Pin to GitHub releases
  dependencies = {
    'nvim-lua/plenary.nvim', -- For standard functions
    'MunifTanjim/nui.nvim', -- To build the plugin UI
    'nvim-telescope/telescope.nvim', -- For picking b/w different remote methods
  },
  config = function()
    require('remote-nvim').setup {
      ssh_config = {
        scp_binary = 'rsync', -- Binary to use for running SSH copy commands
      },
    }
  end,
}

caplett avatar Sep 11 '25 08:09 caplett

@caplett man you're the best 🥇

bassemkaroui avatar Sep 11 '25 11:09 bassemkaroui