The ssh service is abnormal after the device is burned

hi nvidia
After I download the code, compile and burn it according to the documentation
Only a part of the file modification was made, the device tree dtb
No other modifications
But ssh can’t connect after burning

Connecting to 192.168.1.218:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Socket error Event: 32 Error: 10053.
Connection closing...Socket close.

Connection closed by foreign host

Want to see related configuration files and logs

um@tegra-ubuntu:/var/log$ tail -f auth.log 
Aug 25 08:07:53 tegra-ubuntu sshd[7584]: error: key_load_private: invalid format
Aug 25 08:07:53 tegra-ubuntu sshd[7584]: error: key_load_public: invalid format
Aug 25 08:07:53 tegra-ubuntu sshd[7584]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Aug 25 08:07:53 tegra-ubuntu sshd[7584]: error: key_load_private: invalid format
Aug 25 08:07:53 tegra-ubuntu sshd[7584]: error: key_load_public: invalid format
Aug 25 08:07:53 tegra-ubuntu sshd[7584]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Aug 25 08:07:53 tegra-ubuntu sshd[7584]: fatal: No supported key exchange algorithms [preauth]
Aug 25 08:08:05 tegra-ubuntu login[5127]: pam_unix(login:session): session opened for user um by LOGIN(uid=0)
Aug 25 08:08:05 tegra-ubuntu systemd: pam_unix(systemd-user:session): session opened for user um by (uid=0)
Aug 25 08:08:05 tegra-ubuntu systemd-logind[4307]: New session 3 of user um.
Aug 25 08:34:21 tegra-ubuntu sshd[7783]: error: key_load_private: invalid format
Aug 25 08:34:21 tegra-ubuntu sshd[7783]: error: key_load_public: invalid format
Aug 25 08:34:21 tegra-ubuntu sshd[7783]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Aug 25 08:34:21 tegra-ubuntu sshd[7783]: error: key_load_private: invalid format
Aug 25 08:34:21 tegra-ubuntu sshd[7783]: error: key_load_public: invalid format
Aug 25 08:34:21 tegra-ubuntu sshd[7783]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Aug 25 08:34:21 tegra-ubuntu sshd[7783]: error: key_load_private: invalid format
Aug 25 08:34:21 tegra-ubuntu sshd[7783]: error: key_load_public: invalid format
Aug 25 08:34:21 tegra-ubuntu sshd[7783]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Aug 25 08:34:21 tegra-ubuntu sshd[7783]: fatal: No supported key exchange algorithms [preauth]
service sshd status
Aug 25 08:39:23 tegra-ubuntu sshd[5044]: key_load_public: invalid format
Aug 25 08:39:23 tegra-ubuntu sshd[5044]: Could not load host key: /etc/ssh/ssh_h
Aug 25 08:39:23 tegra-ubuntu sshd[5044]: key_load_private: invalid format
Aug 25 08:39:23 tegra-ubuntu sshd[5044]: key_load_public: invalid format
Aug 25 08:39:23 tegra-ubuntu sshd[5044]: Could not load host key: /etc/ssh/ssh_h
Aug 25 08:39:23 tegra-ubuntu sshd[5044]: key_load_private: invalid format
Aug 25 08:39:23 tegra-ubuntu sshd[5044]: key_load_public: invalid format
Aug 25 08:39:23 tegra-ubuntu sshd[5044]: Could not load host key: /etc/ssh/ssh_h
Aug 25 08:39:23 tegra-ubuntu sshd[5044]: Server listening on 0.0.0.0 port 22.
Aug 25 08:39:23 tegra-ubuntu sshd[5044]: Server listening on :: port 22.
sshd_config  ssh_host_ed25519_key    ssh_host_rsa_key.pub
um@tegra-ubuntu:~$ ll /etc/ssh/
total 572
drwxr-xr-x   2 root root   4096 Dec 10  2021 ./
drwxr-xr-x 146 root root  12288 Aug 25 08:39 ../
-rw-r--r--   1 root root 553122 Feb 10  2018 moduli
-rw-r--r--   1 root root   1580 Feb 10  2018 ssh_config
-rw-r--r--   1 root root   3264 Feb 10  2018 sshd_config
-rw-------   1 root root      0 Dec 10  2021 ssh_host_ecdsa_key
-rw-r--r--   1 root root      0 Dec 10  2021 ssh_host_ecdsa_key.pub
-rw-------   1 root root      0 Dec 10  2021 ssh_host_ed25519_key
-rw-r--r--   1 root root      0 Dec 10  2021 ssh_host_ed25519_key.pub
-rw-------   1 root root      0 Dec 10  2021 ssh_host_rsa_key
-rw-r--r--   1 root root      0 Dec 10  2021 ssh_host_rsa_key.pub
-rw-r--r--   1 root root    338 Jun 22  2018 ssh_import_id

Using the same computer, there is a certain probability that this problem will occur after burning
What is the reason for this and what should I do
please help me

Hi,
Not sure what the issue is and would like to get more information. So you can successfully build kernel image and after replacing the default kernel image, the system can boot up to Ubuntu desktop. But cannot remotely login through ssh. Is this the issue?

Yes, everything is ok, only the ssh service can’t connect

Is this still an issue to support? Any result can be shared? Thanks

I will guess that since keys can be built in a variety of formats (e.g., DSA or RSA, 1024 bit or 2048 bit, so on) that perhaps one side of the connection is using a format not supported (either sending a key or receiving a key). If that is the case, then perhaps the kernel config did not have that algorithm enabled at one end. I probably couldn’t debug it, but a verbose attempt to use ssh might show information, e.g., “ssh -v ...”.

-rw-------   1 root root      0 Dec 10  2021 ssh_host_ecdsa_key
-rw-r--r--   1 root root      0 Dec 10  2021 ssh_host_ecdsa_key.pub
-rw-------   1 root root      0 Dec 10  2021 ssh_host_ed25519_key
-rw-r--r--   1 root root      0 Dec 10  2021 ssh_host_ed25519_key.pub
-rw-------   1 root root      0 Dec 10  2021 ssh_host_rsa_key
-rw-r--r--   1 root root      0 Dec 10  2021 ssh_host_rsa_key.pub

The files are all zero size, that’s the problem, but don’t know how it happened, we burned six devices and two devices had this problem

Perhaps the filesystem write location has an issue. If you are generating a key as a regular user, but the destination files of the same name are owned by root, then write would not be allowed. Similarly, if the directory itself is owned and only writable as root, then write would be denied. What user are you logged in to when you run the key generation command?

I didn’t do any of these steps. The problem was that after burning the device, I followed the documentation to compile and didn’t make any changes.

Installation of individual user ssh keys is not part of installation. When you showed the permissions of the keys, was this with sudo (as user root)? Unless this was actually for root, then those keys should be owned only by the user and not root.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.