I was connecting to a remote machine using SSH-Remote. I got a pop-up window showing Could not establish connection to "xxxx.yyyy.zzz".
The error message in the output panel is
[email protected]
SSH Resolver called for "ssh-remote+xxxx.yyyy.zzz"
SSH Resolver called for host: xxxx.yyyy.zzz
Setting up SSH remote "xxxx.yyyy.zzz"
Using commit id "b7ca272b6e041e42f9edfe48f4d559c2044cdaae" and quality "insider" for server
Install and start server if needed
>
> ]0;C:\WINDOWS\SYSTEM32\cmd.exe
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> flock:
> flock: 99: Input/output error
> Installation already in progress...
> 39db3155-22cc-4505-b432-8698d5e68ff9##24##
> flock: 99: Input/output error
>
"install" terminal command done
Received install output: flock: 99: Input/output error
Failed to parse remote port from server output: flock: 99: Input/output error
The same problem
The same problem here
Are you all using the NFS file system?
Hi @roblourens , yes I'm using the NFS file system.
Could @dawnmy and @saeedizadi also provide the information please?
Yes, I'm using NFS file system as well.
Any update on. this? I'm suffering this issue so much. Any workaround?
Sorry, I have to find time to set up an NFS drive and do some experimentation. Not clear if I have to find another locking solution entirely or what. I think I read that flock should be supported on NFSv4. Do you know which NFS you are using?
Our file locking is based on https://gist.github.com/przemoc/571091 if you care to do any experimentation yourself.
Hi @roblourens
I'm happy to help out. Can you provide more information about
/var/lock/ path with a path that is inside your user directory on the NFS driveBut maybe the lockfiles should just be stored in /var/lock. I assume that /var/lock is not an NFS drive for you correct?
@roblourens
bash lockable_script_boilerplate.sh but got nothing in the output.Well you should not get this input/output error.
You could set up a situatiion where one instance of the script acquires a lock and sleeps for a bit then a second instance of the script tries to acquire the lock and fails nicely with no weird error messages.
So I set up an NFS drive for testing and I am able to use vscode remote on that drive with no issues 馃し鈥嶁檪
Can you run mount and share the line for the NFS drive? Mine looks like
127.0.0.1:/datadrive/shared on /mnt/shared type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=127.0.0.1,local_lock=none,addr=127.0.0.1)
Also the output of uname -a?
And if you know the name of the command to mount the nfs drive, that would be helpful as well.
@roblourens
~$ mount
hamms-0.xxxx.yyy:/data01/xxxxxx/xxxxx/users/yyyyy on /cellar/xxxx/yyyyy type nfs4 (rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=169.228.36.70,local_lock=none,addr=169.228.36.103)
~$ uname -a
Linux ortugo 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Can add that I am seeing this error on an Ubuntu 14.04.5 LTS server, which is mounting the home directory using nfs version 4.0. It works with a Centos 7.6 server using nfs version 4.1 with the same home directory.
I was able to mount with version 4.0 and it still works.
127.0.0.1:/datadrive/shared on /mnt/shared type nfs4 (rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=127.0.0.1,local_lock=none,addr=127.0.0.1)
I wonder whether it works because I am technically sharing to the same machine, maybe it takes some shortcut when it knows the drive is really local.
Can someone tell me the output of dpkg -l | grep nfs-common so I can use exactly the same version of the client code?
And maybe dpkg -l | grep nfs-kernel-server if you have access to the server
@roblourens
~$ dpkg -l | grep nfs-common
ii nfs-common 1:1.2.8-9ubuntu12.1 amd64 NFS support files common to client and server
There is no output for dpkg -l | grep nfs-kernel-server.
Now I am trying on 14.04 with 1:1.2.8-6ubuntu1.2 and it still seems fine. However it takes an extremely long time to untar the downloaded package...
For dpkg -l | grep nfs-kernel-server I meant run that on the server, if you have access to it.
And here is a test script is you can try running against your NFS $HOME. You will probably get the same error, I just want to verify that the simplest possible case produces the same result.
LOCKFILE=$HOME/test.lock
LOCKFD=99
# PRIVATE
_lock() { flock -$1 $LOCKFD; }
_no_more_locking() { _lock u; _lock xn && rm -f $LOCKFILE; }
_prepare_locking() { eval "exec $LOCKFD>\"$LOCKFILE\""; trap _no_more_locking EXIT; }
# ON START
echo 0
_prepare_locking
# PUBLIC
exlock_now() { _lock xn; } # obtain an exclusive lock immediately or fail
exlock() { _lock x; } # obtain an exclusive lock
shlock() { _lock s; } # obtain a shared lock
unlock() { _lock u; } # drop a lock
### BEGIN OF SCRIPT ###
# Simplest example is avoiding running multiple instances of script.
echo 1
exlock_now || exit 1
echo "exlock_now exited with $?"
sleep 10
echo 2
unlock
echo 3
Can confirm that above script causes the original error on the 'exlock_now || exit 1' line (and severs my ssh connection).
I get the following from dpkg -l | grep nfs-common
ii nfs-common 1:1.2.8-6ubuntu1.2 amd64 NFS support files common to client and server
In my case, I don't believe its the nfs host, because I can use the extension to go to a different computer that mounts the same home directory.
The mount command shows me the following about the mount
(rw,sec=sys,addr=x.x.x.x,clientaddr=0.0.0.0)
Same OS, same nfs-common version, same mount details.
Well I can add a setting to put the lock in /tmp. Originally locks were in /var/lock but on some systems users do not have write access to /var/lock. Would that work? You could change the path in the script to somewhere in /tmp to test.
One downside is that this would not be safe when the home folder is mapped to two different machines, and vscode connects to those two machines simultaneously. We can probably live with that.
@roblourens
Yes. I was running dpkg -l | grep nfs-kernel-server on the remote machine, not on my local laptop. But there is no output.
For the test script, here is the output
0
1
exlock_now exited with 0
2
3
I mean, the "server" in this case is the file server that hosts your NFS directory. This probably is not the "remote" machine that you are connecting to, that is the NFS client.
Did you run the test script on the remote machine? Or your local laptop. It should be run on the remote where the NFS drive is.
Oh, I see. I don't have the access to the server hosting the NFS directory.
Yes, I ran the test script on the remote machine.
Well then 馃し鈥嶁檪
Could you try another thing for me?
That seems to work.
It was hard to test though because it kept updating itself before I could test it and I kept forgetting that there were hanging processes on the remote from previous attempts.
@roblourens
It works for the first time. I was able to connect to the remote server. However, after the connection, it failed to open a folder on the server, showing the same error (flock: 99 Input/output error). If I disconnect from the server and re-connect again, I got the same error. Only after uninstalling and re-installing the extension can I successfully connect to the server again.
@pmgurman Were you able to open folders on the remote machine and successfully re-connect to the remote for multiple times?
@pmgurman How did you prevent the extension keeping updating itself? I found it updates to 0.44.2 after I connecting to the server. Maybe this is the reason that I was not able to open a folder after the connection was established.
@arglog I was just about to say the same. I guess it is updating itself on restart of VSCode, and updating from the internet and not the modified package version
Sorry I should have bumped the version number to prevent that. You can disable extensions.autoUpdate temporarily to prevent it from overwriting the vsix.
@roblourens Thanks. This works for me. Using this VSIX extension I successfully connected to the remote machine and opened project folders. I also reproduced the connection several times and there was no error.
Tomorrow's nightly build of the ssh extension will have the setting remote.SSH.lockfilesInTmp that you can set to do the same thing.
@roblourens Forgive my ignorance, but where would I find the nightly?
https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh-nightly
Make sure you uninstall the stable version before using the nightly version
@roblourens nightly version for me also working, thanks.
@roblourens One side effect I am seeing of remote.SSH.lockfilesInTmp is that when I start a terminal on the remote machine it does not load my bash settings from my home folder, i.e. I have a .bash_profile file that is normally read. Do you have any ideas what is happening? I didn't know if I should post this here or in a new issue, so apologies if it is in the wrong spot?
That shouldn't be related to this. You can open a new issue with some details.
It worked after installing nightly version of remote SSH extension and checking "Lockfiles In Tmp". Thanks!
Most helpful comment
Tomorrow's nightly build of the ssh extension will have the setting
remote.SSH.lockfilesInTmpthat you can set to do the same thing.