microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.69k stars 296 forks source link

Support hosts that don't have flock available #1188

Closed richardk2016 closed 2 years ago

richardk2016 commented 5 years ago

When trying to connect to my ssh host, I get the error message

bash: line 48: flock: command not found

after I entered my password. Logging in from the same machine with the built-in ssh client (Windows 10 Ver. 1903, fully patched) with 'ssh user@domain.tld' works without any problem. So password and connection are not the cause.

Unfortunately I can't find a logfile where the connection attempt is stored after the connection attempt. The message didn't stop in the console either. I had to shoot a video! to read the error output. Not nice! The screenshot flock-error is extracted from the video.

My shh host is located at a shared hosting provider. I don't have root rights there and the tool 'flock' is not available there for security reasons. Furthermore, it is impossible for me to install anything there. I can only perform file operations (create, copy, move and delete) and a handful of safe linux commands. I need ssh access mainly to edit files directly. The shared hoster uses Linux, the exact version is not known. How can I use the extension without flock?

roblourens commented 5 years ago

The log file is in the Remote-SSH output channel. But yeah, flock is required right now, we will have to find another file locking solution for this sort of case.

alexela8882 commented 5 years ago

Having the same problem. I'm using ubuntu 18.04 LTS. Passphrase always prompting and remote-ssh channel error "flock: command not found". I can successfully login using putty so ssh configuration is not the cause. BTW, I'm trying to remote my project uploaded in a cloud hosting site.

flock command not found vscode

roblourens commented 5 years ago

So this is just normal ubuntu 18.04? What happens if you run flock in a terminal on that machine? For me it is installed at /usr/bin/flock

wmertens commented 5 years ago

I just encountered this with a cPanel host. No idea what the os is, but flock is not installed anywhere.

I think the install script should just continue without locking if flock is not available.

roblourens commented 5 years ago

That would work most of the time but I'm afraid of ending up with even harder to understand issues and logfiles. :/

wmertens commented 5 years ago

What is the flock used for? Won't an atomic rename work just as well?

roblourens commented 5 years ago

We are using the lock to make sure that only one client is installing/starting the server at a time. Possibly, can you tell me more?

wmertens commented 5 years ago

@roblourens each client should create a temp random dir, and make a symlink from it to the correct name. If creating the symlink fails, or reading the symlink (*) doesn't link to the random dir, another client is installing.

Frankly though, the install script seems quite complex to get right on all unices, and I think it would be better to install from a node script. To do that, SSH in multiple times:

(*): hmm not all unices have readlink installed, so another option is to also create a file with unique contents and reading it through the symlink

roblourens commented 5 years ago

Thanks for the suggestion, I will experiment with that. But I will stick with the bash script because running multiple ssh commands requires users to enter their passwords multiple times.

wmertens commented 5 years ago

running multiple ssh commands requires users to enter their passwords multiple times

actually, you can set up a master connection and then run as many connections as you like, and if you use the node ssh2 module, you can do it from javascript, just call client.exec() on an open client as many times as you like.

roblourens commented 5 years ago

The master connection multiplexing is not supported on windows. And originally I used ssh2, but long story short, I want to stay as close to ssh myHost as possible for debugging purposes, and OpenSSH does a lot of other stuff that I didn't want to reinvent.

nicola-lunghi commented 5 years ago

what could be done is:

nicola-lunghi commented 5 years ago

or use a scripting language if its available

perl https://stackoverflow.com/questions/10526651/mac-os-x-equivalent-of-linux-flock1-command/13343904

python http://blog.e-shell.org/309

maybe check if flock is available and offer a replacement if not?

roblourens commented 2 years ago

We have actually had this for some time, with the remote.SSH.useFlock setting.