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

Cannot create WinFsp-FUSE file system: mount point in use

Open davidoroian opened this issue 10 months ago • 2 comments

I am using nvim on Windows in Powershell 7.5.0. I am using Pckr as my extension manager and I have installed the remote-sshfs extension.

This is my packer.lua file:

local function bootstrap_pckr()
    local pckr_path = vim.fn.stdpath("data") .. "/pckr/pckr.nvim"

    if not (vim.uv or vim.loop).fs_stat(pckr_path) then
        vim.fn.system({
            'git',
            'clone',
            "--filter=blob:none",
            'https://github.com/lewis6991/pckr.nvim',
            pckr_path
        })
    end

    vim.opt.rtp:prepend(pckr_path)
end

bootstrap_pckr()


require('pckr').add{
    {
        'nvim-telescope/telescope.nvim', tag = '0.1.8',
        -- or                            , branch = '0.1.x',
        requires = {'nvim-lua/plenary.nvim'}
    };

    {
        'rose-pine/neovim',
        as = 'rose-pine',
        config = function()
            vim.cmd('colorscheme rose-pine')
        end
    };

    {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'};
    {'ThePrimeagen/harpoon'};
    {'mbbill/undotree'};
    {'tpope/vim-fugitive'};
    
    {
        'nosduco/remote-sshfs.nvim',
        requires = { 'nvim-telescope/telescope.nvim' },
    };
    
}

And this is m remote-sshfs.lua one:

--config setup
require('telescope').load_extension 'remote-sshfs'
require('remote-sshfs').setup{
    connections = {
        ssh_configs = { -- which ssh configs to parse for hosts list
            vim.env.HOME .. "/.ssh/config",
            "C:/Windows/System32/drivers/etc/ssh_config",
            -- "/path/to/custom/ssh_config"
        },
        -- NOTE: Can define ssh_configs similarly to include all configs in a folder
        -- ssh_configs = vim.split(vim.fn.globpath(vim.fn.expand "$HOME" .. "/.ssh/configs", "*"), "\n")
        sshfs_args = { -- arguments to pass to the sshfs command
            "-o reconnect",
            "-o ConnectTimeout=5",
        },
    },
    mounts  = {
        base_dir = vim.env.HOME .. "/.sshfs/", -- base directory for mount points
        unmount_on_exit = true, -- run sshfs as foreground, will unmount on vim exit
    },
    handlers = {
        on_connect = {
            change_dir = true, -- when connected change vim working directory to mount point
        },
        on_disconnect = {
            clean_mount_folders = false, -- remove mount point folder on disconnect/unmount
        },
        on_edit = {}, -- not yet implemented
    },
    ui = {
        select_prompts = false, -- not yet implemented
        confirm = {
            connect = true, -- prompt y/n when host is selected to connect to
            change_dir = false, -- prompt y/n to change working directory on connection (only applicable if handlers.on_connect.change_dir is enabled)
        },
    },
    log = {
        enable = false, -- enable logging
        truncate = false, -- truncate logs
        types = { -- enabled log types
            all = false,
            util = false,
            handler = false,
            sshfs = false,
        },
    },
}

--keybinds
local api = require('remote-sshfs.api')
vim.keymap.set('n', '<leader>rc', api.connect, {})
vim.keymap.set('n', '<leader>rd', api.disconnect, {})
vim.keymap.set('n', '<leader>re', api.edit, {})

--override telescope commands
local builtin = require("telescope.builtin")
local connections = require("remote-sshfs.connections")
vim.keymap.set('n', '<leader>pf', function()
    if connections.is_connected() then
        api.find_files()
    else
        builtin.find_files()
    end
end, {})
vim.keymap.set('n', '<C-p>', function()
    if connections.is_connected() then
        api.git_files()
    else
        builtin.git_files()
    end
end, {})
vim.keymap.set('n', '<leader>ps', function()
    if connections.is_connected() then
        api.grep_string({ search = vim.fn.input("Grep > ") });
    else
        builtin.grep_string({ search = vim.fn.input("Grep > ") });
    end
end, {})

My issue is that when I am trying to start a remote connection, I get:

Connection failed: Cannot create WinFsp-FUSE file system: mount point in use.

I do not know how can the mount point be in use since the .sshfs directory was created only after creating this file, and each remote correctly gets its own directory with the name of the remote.

Am I doing something wrong?

davidoroian avatar Apr 03 '25 07:04 davidoroian

From what I have seen, for Windows we should use net use instead of sshfs or sshfs-win, I could not manage to make the latter two work. But I have succesfully mounted on remote connections using net use. Can we somehow implement that into the remote-sshfs config?

davidoroian avatar Apr 03 '25 11:04 davidoroian

Issue seems to be related to https://github.com/nosduco/remote-sshfs.nvim/issues/18

davidoroian avatar Apr 03 '25 13:04 davidoroian