Need help with wine / postgresql / ssh

raphael75's profile image raphael75 posted 5 years ago in Creating a connection Permalink

I used wine to install putty and heidisql on Debian 10. I need to connect to a postgres db using ssh. When I try to connect I get the error:

"could not execute plink"

It seems that it would need to prefix "wine" to the command so it would be something like

wine C:\Program Files\PuTTY\plink.exe ...

Is that correct, or is there some other way to get it to work?

Also, I'm not sure what to put for the "local port".

Thanks!

ansgar's profile image ansgar posted 5 years ago Permalink

I heard before that the path to plink makes problems on Wine when executing the command. To prevent that, you can try use a relative path to plink. Maybe you need to put plink.exe into the same folder as heidisql.exe and remove the entire path to it.

Related topic

Arffeh's profile image Arffeh posted 5 years ago Permalink

My 2 cents:

Don't give Heidi relative paths. Certain dialogs cause Heidis working path to "slip" to another directory after using certain dialogs. I'm yet to narrow down which dialogs cause it, as I've usually done many different actions in the course of a day before attempting another connection, when Heidi starts spitting that it can't find the plink executable anymore.

For me, I have plink set up as C:\plink.exe (plink sitting in wines C:\ directory, /home/arffeh/.wine/drive_c/plink.exe), which for some reason the wine pathing interaction seems fine with.

Just Wine Thingsā„¢

imsorryansgarpleasedonthurtme :)

ansgar's profile image ansgar posted 5 years ago Permalink

Won't hurt you as you're far enough away from me :)

I just wonder about that path confusion, as I never experienced it, at least on Windows. But it may also be I am just not using relative paths.

Arffeh's profile image Arffeh posted 5 years ago Permalink

In the above case, the relative path issue has been on both windows and wine.

I gave up attempting to using relative after a while, it was getting in the way of work.


Unrelated, how many wine related issues am I allowed to clobber you with at the same time? Would you prefer one megathread here, or one issue on GitHub per problem? :)

I'm finding my experience under wine severely broken. I found myself reaching for phpmyadmin for the first time since Heidis release because I wasn't even able to delete a row without crashing. :)

ansgar's profile image ansgar posted 5 years ago Permalink

If you provide feedback and reproduction recipe, I would prefer Github issues for each of them. Unfortunately, I have no machine for testing Linux things, so some things can take a while, or may even be unsolvable for me. If there's a callstack (the text file you can save on the crash handler), then you should definitely include these in your reports.

Here are all open Wine issues on Github, maybe you find one or the other you also faced: https://github.com/HeidiSQL/HeidiSQL/labels/wine

Arffeh's profile image Arffeh posted 5 years ago Permalink

I can reliably make it crash every minute. :)

Do you have access to a hypervisor? (vbox, qemu, vshere, etc)

If you would like, I could create a VM, reproduce all crashes, report all crashes(callstack, steps of reproduction, screenshots) in github, and send you the VM image. That way you have a fuss-free environment to test in.

If heidi could get to a state of not crashing every minute, it would be extremely impressive.

ansgar's profile image ansgar posted 5 years ago Permalink

I am just familiar with Microsoft's HyperV, never heard of the other ones.

Though the idea sounds nice. Probably you can advice me what to do to get that VM running after you set it up?

raphael75's profile image raphael75 posted 4 years ago Permalink

I tried putting plink in both ~/.wine/drive_c and in ~/.wine/drive_c/Program\ Files/HeidiSQL/ and I got the error in both cases.

I noticed the command that Heidi is running includes the -P <port> and -L arguments. If I run plink on the command line and leave those arguments out, I am able to connect. I'm not sure if that is what's causing the issue or something else.

ansgar's profile image ansgar posted 4 years ago Permalink

... and I got the error in both cases

Which error? Still "could not execute plink" ?

raphael75's profile image raphael75 posted 4 years ago Permalink

That's correct, "could not execute plink". If HeidiSQL couldn't find plink, would I get a different error? It would be helpful if the error would indicate if it can't find plink or if it did find plink but got an error code from plink.

On a side note, I have tried many other SQL clients, but HeidiSQL is by far my most favorite. The features it has are so intuitive and helpful, and I really want to get this to work. If I can, I will post it on the WineHQ website to help others.

ansgar's profile image ansgar posted 4 years ago Permalink

There are two messages, happening in different situations:

  • "Could not execute PLink: Port xyz already in use"
  • "Could not execute PLink: your\command\line -ssh ..."

I suppose we're talking about the latter one, which is thrown when it cannot find or execute the plink binary file. There is no problem with parameters in that case.

I can go and reveal the system message, using SysErrorMessage(GetLastError) after that plink call. But I'm not sure if that will show you something helpful on Wine.

In any case, I would focus on the executable path itself, not on the parameters. Perhaps you should place it in ~/.wine/drive_c/ and use a relative path in HeidiSQL: ../../plink

raphael75's profile image raphael75 posted 4 years ago Permalink

I tried the ../../plink, and the error I get now is:

  • Plink exited unexpected. Command line was: ...

Does that indicate that it can now see plink? I think another problem might be that plink itself needs to be run with WINE. For example, to run it on the command line directly, I have to do it like this:

raphael75@rpc:~$ wine ~/.wine/drive_c/Program\ Files/PuTTY/plink.exe -ssh <user>@<ip> -pw <password>

I don't think HeidiSQL is prefixing the "wine" command to plink.

I thought maybe I could set up a bash script called "plink.exe" that HeidiSQL would think is the executable. It would add in the wine command and then pass in the rest of the arguments from Heidi, but I'm not sure if that would work.

Code modification/commit 96aca7f from Ansgar Becker <anse@heidisql.com>, 4 years ago, revision 10.2.0.5757
Display last system error when plink process could not be started for some reason. Helps in debugging. See https://www.heidisql.com/forum.php?t=34556#p35000
ansgar's profile image ansgar posted 4 years ago Permalink

Yes, "Plink exited unexpected.." indicates it was successfully started but then exited for some reason. Perhaps you are on the right way now.

I just pushed a change which now displays a system message when HeidiSQL cannot find plink or something:

Description

No, HeidiSQL does not add a "wine" prefix to that command. If you are sure you need that, did you already try to add it to the plink path box in HeidiSQL?

raphael75's profile image raphael75 posted 4 years ago Permalink

I changed Heidi to use:

wine ../../plink.exe

for the plink location, and I get the "could not execute plink" error.

To test, I switched to the HeidiSQL directory and typed in the exact command Heidi is trying to run, and it works on the command line.

raphael75's profile image raphael75 posted 4 years ago Permalink

I updated to 5757 and it says "system message: file not found". I tried using "wine ../../plink.exe", "wine ....\plink.exe", and "wine plink.exe" and got that message for each one. I'm not sure what else I can try. It seems that HeidiSQL just can't find plink. I still have plink in both the /.wine/drive_c/ and /.wine/drive_c/Program Files/HeidiSQL/ folders.

ansgar's profile image ansgar posted 4 years ago Permalink

Wasn't it already the other message ("Plink exited unexpected. Command line was...") ?

raphael75's profile image raphael75 posted 4 years ago Permalink

That was before I updated to 5757. :) I have attached an image of what it currently looks like.

1 attachment(s):
  • error_2019-11-21__1.31p
ansgar's profile image ansgar posted 4 years ago Permalink

And did you again try the relative path "../../plink" without the "wine" prefix?

raphael75's profile image raphael75 posted 4 years ago Permalink

I apologize for the delay in getting back with you! I did try both with and without the "wine" prefix and got the same result in both cases.

ansgar's profile image ansgar posted 4 years ago Permalink

Well, in that case I can just assume you have a wrong path. Or probably a local user privilege issue. Can you test that somehow? For example open a shell, change to the directory where heidisql.exe is located, and then run the above commands, without all the plink parameters first, which do not matter here.

raphael75's profile image raphael75 posted 4 years ago Permalink

I have good news. I was able to connect by NOT using the SSH tunnel and just using the TCP/IP. I am connecting to the server over VPN, and it turned out they had some things blocked if coming in from VPN. Even though it turned out to not be a plink issue, thanks so much for your help!

Please login to leave a reply, or register at first.