error purging survey data

Does it actually work when you try to access via Dropbear:

dbclient dietpi-survey@ssh.dietpi.com
# then enter
upload2dietpi

It will ask you to accept the host key, since Dropbear supports the modern Ed25519 key format while libssh2 (used by curl) supports only RSA. After entering the password it will exit immediately as only SFTP is supported:

This service allows sftp connections only.

But if you get so far, at least we know that generally SSH communication and authentication from you system works, so it then must be something about curl/libssh2.

Can you also show the output of these commands:

echo $G_HW_MODEL_NAME
uname -a
apt policy curl libssh2-1

I use openSSH and not dropbear, is that a problem?

Here is the output of the last command:

RPi 3 Model B+ (aarch64)
Linux DietPi 5.10.60-v8+ #1449 SMP PREEMPT Wed Aug 25 15:01:33 BST 2021 aarch64 GNU/Linux
curl:
  Installiert:           7.74.0-1.3+deb11u1
  Installationskandidat: 7.74.0-1.3+deb11u1
  Versionstabelle:
 *** 7.74.0-1.3+deb11u1 500
        500 https://deb.debian.org/debian bullseye/main arm64 Packages
        100 /var/lib/dpkg/status
libssh2-1:
  Installiert:           1.9.0-2
  Installationskandidat: 1.9.0-2
  Versionstabelle:
 *** 1.9.0-2 500
        500 https://deb.debian.org/debian bullseye/main arm64 Packages
        100 /var/lib/dpkg/status

And here is the output of the command:

sftp dietpi-survey@ssh.dietpi.com



Warning: Permanently added the RSA host key for IP address '2a06:1c40:3::142' to the list of known hosts.
dietpi-survey@ssh.dietpi.com's password:
Connected to ssh.dietpi.com.

interesting, the IPv6 address of ssh.dietpi.com has been added to know hosts

;; ANSWER SECTION:
ssh.dietpi.com.         300     IN      AAAA    2a06:1c40:3::142



IP address '2a06:1c40:3::142' to the list of known hosts.

Can you try agin

> "$G_HW_UUID.txt"
curl --verbose --key '' -m 20 -T "$G_HW_UUID.txt" "sftp://dietpi-survey:upload2dietpi@ssh.dietpi.com/survey/$G_HW_UUID.txt"
root@DietPi:~# > "$G_HW_UUID.txt"
curl --verbose --key '' -m 20 -T "$G_HW_UUID.txt" "sftp://dietpi-survey:upload2d                                                                                                                                                             ietpi@ssh.dietpi.com/survey/$G_HW_UUID.txt"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*                                                                                                                                                                Trying 2a06:1c40:3::142:22...
* Connected to ssh.dietpi.com (2a06:1c40:3::142) port 22 (#0)
* Found host ssh.dietpi.com in /root/.ssh/known_hosts
* Set "ecdsa-sha2-nistp256" as SSH hostkey type
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Closing connection 0
curl: (79) Error in the SSH layer

Strange, there was another report about this SSH layer error and we couldn’t find any reason or solution for it. I’m puzzled since it works for everyone else and the package/build of all underlying libraries and commands are the same.

Not sure whether the known_hosts entry autogenerated like that may cause the issue. Generally our images ship with our host key added, here how to recreate it: https://github.com/MichaIng/DietPi/issues/5137#issuecomment-1006110606
If you have other known hosts in that file, please add the line manually as the given command was to recreate the file, which was missing competely for that user.

Wow… I renamed the existing known_hosts file and created a new one with your command and suddenly sending the survey data works… Well, thanks for your help!

hmm probably the host file got corrupted?

Wow, I’m somehow surprised as well. The error message was so absolutely not pointing into that direction, also the output Found host ssh.dietpi.com in /root/.ssh/known_hosts looks like it is all fine.

Only now I see that Set “ecdsa-sha2-nistp256” as SSH hostkey type actually refers to a wrong host key type, since the stored one is an RSA host key. On a successful upload it shows hence Set “ssh-rsa” as SSH hostkey type. Still, I’d have expected an error message then that the SSH host key retrieved from the server does not match known host key :thinking:.

However, great that it finally works now. Looks like we need to keep in mind the known_hosts recreation as a generic solution for survey issues :sunglasses:.