TC crash during file operation with Dropbear ssh server

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

xodiwan
Junior Member
Junior Member
Posts: 3
Joined: 2023-10-25, 05:57 UTC

TC crash during file operation with Dropbear ssh server

Post by *xodiwan »

Hello,

I found unexpected behavior during my operation with a Raspberry Pi with DietPi as OS and Dropbear ssh server.

I use:
- Windows 11 pro x64
- TC 11.01 x64 release
- sftp plugin
- Dietpi OS 8.23
- Raspberry Pi 4
- Dropbear ssh server (which is default on DietPi OS)

The DietPi OS uses the Dropbear ssh server and this ssh server has no scp and no sftp.
You can connect via sftp plugin to the Raspberry Pi and walk around in the file system and all works fine.

During the walk I pressed F5 copy file to/from Raspberry Pi and TC crashed immediately.

You found this in the windows Event Log:

---
Name der fehlerhaften Anwendung: TOTALCMD64.EXE, Version: 11.1.0.0, Zeitstempel: 0x00000000
Name des fehlerhaften Moduls: ntdll.dll, Version: 10.0.22621.2428, Zeitstempel: 0x806d3ecf
Ausnahmecode: 0xc0000374
Fehleroffset: 0x000000000010c849
ID des fehlerhaften Prozesses: 0x0x1C7C
Startzeit der fehlerhaften Anwendung: 0x0x1DA069E72244CAD
Pfad der fehlerhaften Anwendung: C:\Program Files\totalcmd\TOTALCMD64.EXE
Pfad des fehlerhaften Moduls: C:\Windows\SYSTEM32\ntdll.dll
Berichtskennung: 02d10541-16ee-4a1a-9c52-7cc5253e71be
Vollständiger Name des fehlerhaften Pakets:
Anwendungs-ID, die relativ zum fehlerhaften Paket ist: 
---

I know that this copy operation is not possible with the Dropbear ssh server, so I expected a Message Box like "Operation not allowed" or "Service not available"

The workaround is to use the OpenSSH server instead of Dropbear.

lG
Michael
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC crash during file operation with Dropbear ssh server

Post by *ghisler(Author) »

Thanks for your report. This sounds more like a problem in the SFTP plugin, so I'm moving it to the plugins forum.

Moderator message

Moved to plugins forum
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: TC crash during file operation with Dropbear ssh server

Post by *Dalai »

Dropbear can do SCP transfers. Fli4l uses Dropbear as well, and SSH is the way to remotely update files on the system, i.e. SCP is used for this. You might want to take a closer look at the Dropbear configuration.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC crash during file operation with Dropbear ssh server

Post by *ghisler(Author) »

I have installed dietpi now (PI4) and I can confirm that libssh2 crashes when trying to do SCP transfers.
libssh2_scp_recv2 seems to succeed and returns a channel to receive the data. But it does not populate the file size field, so the plugin can't transfer the data. After closing the data channel, the next call libssh2_scp_recv2 crashes.
libssh2_scp_send64 creates an empty remote file and returns a channel to send the data. But sending the data doesn't put it in the file. After closing the data channel, the next call libssh2_scp_send64 also crashes.
So it looks like dropbear doesn't properly support SCP transfers, and causes libssh2 to crash.

If you use dietpi, try switching to openssh server.
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: TC crash during file operation with Dropbear ssh server

Post by *JOUBE »

ghisler(Author) wrote: 2023-11-28, 12:01 UTC I have installed dietpi now (PI4) and I can confirm that libssh2 crashes when trying to do SCP transfers.
...
So it looks like dropbear doesn't properly support SCP transfers, and causes libssh2 to crash.
I think it is not dropbear itself, but only the configuration of dropbear within dietpi, that does not work as expected.
ghisler(Author) wrote: 2023-11-28, 12:01 UTC If you use dietpi, try switching to openssh server.
Yes, best solution of the problem within dietpi.

Joube
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC crash during file operation with Dropbear ssh server

Post by *ghisler(Author) »

I found the solution to use dropbear! You need to install the scp binary. This is done with the following command:

Code: Select all

sudo apt install openssh-client
Afterwards both uploads and downloads work fine.
And yes, it's in the client package, not the server package.

Edit: Beta 3 now should not crash when the scp command is missing:
viewtopic.php?p=445883#p445883
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: TC crash during file operation with Dropbear ssh server

Post by *JOUBE »

Sorry, no.

Now there is no crash, but there is no error message saying that copying will not work. And actually: It appears as if it is copying and it takes as long as real copying would take. But unfortunately no files are transferred.

The main problem now is that there is no error message saying that nothing can be copied.

Note: I haven't installed the openssh-client because user of the Plugin normally don't know that he has to do that. And there is no message about this

Joube
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC crash during file operation with Dropbear ssh server

Post by *ghisler(Author) »

What do you mean? When I don't install the scp binary, I get an error immediately that the file could not be transferred, and the log shows error
bash: line 1: scp: command not found
and when I try again I get
SCP download error: SCP_PROTOCOL (28)

Maybe you have an older version of dropbear? I made a fresh install of DietPI based on Debian Bookworm. Which version do you use?
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: TC crash during file operation with Dropbear ssh server

Post by *JOUBE »

ghisler(Author) wrote: 2023-11-29, 10:05 UTC What do you mean? When I don't install the scp binary, I get an error immediately that the file could not be transferred, and the log shows error
bash: line 1: scp: command not found
and when I try again I get
SCP download error: SCP_PROTOCOL (28)

Maybe you have an older version of dropbear? I made a fresh install of DietPI based on Debian Bookworm. Which version do you use?
My dietPI installation based on Debian Bookworm (Newest Version, installed 5 days ago)

cat /etc/*release ----> PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
echo $G_HW_MODEL_NAME ----> RPi 4 Model B (aarch64)
echo “$G_DIETPI_VERSION_CORE.$G_DIETPI_VERSION_SUB.$G_DIETPI_VERSION_RC” ----> “8.24.1”
dropbear -V ----> Dropbear v2022.83
htop ----> /usr/sbin/dropbear -EF -p 22 -W 65536

Sorry, no error message here at trying download from dietpi to local PC.

sftpplug.ini:

Code: Select all

[RP_dietpi]
server=the_IP
user=root
codepage=0
proxynr=1
password=!
fingerprint=the_fingerprint
utf8=1
unixlinebreaks=1
scponly=1
largefilesupport=0
detailedlog=1
I have NO installation of openssh_client on dietpi

Hint: If you want - for testing purposes - remove the openssh_client maybe 'apt remove openssh_client' should not be enough, try 'apt purge openssh_client' to remove configurations of it too.

Joube
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC crash during file operation with Dropbear ssh server

Post by *ghisler(Author) »

I have installed openssh_client. The command
which scp
returns an empty line, otherwise it reports where scp is located.
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: TC crash during file operation with Dropbear ssh server

Post by *JOUBE »

An empty line?

Here 'which scp' returns nothing:

root@dietpi:~# which scp
root@dietpi:~#

Normaly openssh_client is not installed at dietpi. There is a choice between Dropbear and OpenSSH in the configuration of dietpi. But default is the usage of Dropbear. Maybe dropbears default configuration is wrong on dietpi and have errors. But the solution is not: mixing dropbear and openssh on dietpi. TC's SFTPPlugin would have to report an error and not hang, which it did before or not copying without error message which it did now (direction: download from dietpi to PC) And this 'not copying' means, it takes the same time as if the copying would work, but files are not copied but only folders. Maybe only the names of the files are not transferred, so on PC the downloads goes to nul, /dev/null, nirvana, ...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC crash during file operation with Dropbear ssh server

Post by *ghisler(Author) »

Both Dropbear and OpenSSH do not include internal SCP support - they both call the external scp executable. The same is true for sftp.
So if you want to transfer files with Dropbear, you need to install SCP or it will simply not work. I don't know why you don't get an error message when it's missing (maybe you use a non-English installation), but it's only fighting symptoms - there is no point in using my sftp plugin when neither SCP nor SFTP are installed on the server.
Author of Total Commander
https://www.ghisler.com
xodiwan
Junior Member
Junior Member
Posts: 3
Joined: 2023-10-25, 05:57 UTC

Re: TC crash during file operation with Dropbear ssh server

Post by *xodiwan »

Hello,

I tested the new sftp plugin 3.10b3 on a Raspberry Pi 4 and have observed this behave:
I used DietPi 3.24 with Dropbear, no openssh_client package installed.

Scenario 1: Copy one single file ends up immediately in an error message box "Fehler beim Herunterladen!" -> this is correct, and all works fine and no plugin crash

Scenario 2: Copy a Directory with some files in it, here no error message box shows up.
The transfer window comes up and it seems that all the files will be transferred -> at the end only the directory structure is generated and no files are copied. In the log window you can see an error messages for each file that is not copied like this:

...
bash: line 1: scp: command not found
File download /home/dietpi/python/hello.py
SCP download error: SCP_PROTOCOL (28)
...

That means in scenario 2 you must have sharp eyes to identified all the error messages, no message box is poped up.
The time to copy the files is so long, as it takes to copy real files (nearly).

I hope my report helps you to optimised the sftp plug in.

Thank you.

lG
Michael
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: TC crash during file operation with Dropbear ssh server

Post by *JOUBE »

xodiwan wrote: 2023-12-03, 18:12 UTC Hello,

I tested the new sftp plugin 3.10b3 on a Raspberry Pi 4 and have observed this behave:
I used DietPi 3.24 with Dropbear, no openssh_client package installed.

Scenario 1: Copy one single file ends up immediately in an error message box "Fehler beim Herunterladen!" -> this is correct, and all works fine and no plugin crash

Scenario 2: Copy a Directory with some files in it, here no error message box shows up.
The transfer window comes up and it seems that all the files will be transferred -> at the end only the directory structure is generated and no files are copied. In the log window you can see an error messages for each file that is not copied like this:

...
bash: line 1: scp: command not found
File download /home/dietpi/python/hello.py
SCP download error: SCP_PROTOCOL (28)
...

That means in scenario 2 you must have sharp eyes to identified all the error messages, no message box is poped up.
The time to copy the files is so long, as it takes to copy real files (nearly).

I hope my report helps you to optimised the sftp plug in.

Thank you.

lG
Michael
Thanks. Exactly what I wrote...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC crash during file operation with Dropbear ssh server

Post by *ghisler(Author) »

Thanks, I can confirm the problem. Unfortunately it seems to be a bug in Total Commander, nit the plugin. I will check it.
Author of Total Commander
https://www.ghisler.com
Post Reply