L4t_backup_restore.sh — SSH connection to target fails silently (exit 255) right after boot, only on one specific host

Setup:

  • Jetson AGX Orin devkit
  • Jetson Linux (L4T) R36.4.4
  • Host: Ubuntu, x86_64 workstation (bare metal, confirmed via systemd-detect-virt)

Command run:

sudo ./tools/backup_restore/l4t_backup_restore.sh -e mmcblk0 -b jetson-agx-orin-devkit

Symptom:
The device boots into the initrd network-flash environment successfully every time — RCM boot completes, the initrd’s USB gadget (RNDIS) network interface comes up, and the script’s own SSH-readiness check (a simple ssh ... true) succeeds, printing:

Device has booted into initrd. You can ssh to the target by the command:
$ ssh root@fc00:1:1:0::2

Immediately after, the script issues the actual backup command over a second SSH connection:

mount -o nolock [fc00:1:1::1]:.../tools/backup_restore /mnt && /mnt/nvbackup_partitions.sh -e mmcblk0 -n && echo Backup image is stored in ...

This second SSH invocation returns quickly with exit code 255 (confirmed by instrumenting l4t_backup_restore.sh to capture the real exit status) and produces zero output — no error message on stdout or stderr, nothing from the remote command, no images/ directory ever created.

backup17.log (105.7 KB)

What’s confirmed via packet capture and serial (UART) console:

  • Every SYN packet from host to target during connection attempts is answered with an immediate TCP RST from the target when this fails, while ICMPv6 to the same address keeps working — so the network path itself is healthy; something specifically about port 22 / the second SSH session is being refused.
  • Serial console on the target shows completely healthy boot — no kernel panic, no OOM, no Oops — right up through USB gadget networking coming up.

What I’ve ruled out:

  • Host firewall / iptables / ip6tables / nftables / ufw / Docker network rules — all clean
  • NFS export configuration/permissions — confirmed correct and present at the exact moment of the mount attempt
  • rpcbind/portmapper — running correctly, responds properly over IPv6
  • Missing sshd/host keys in the target’s initrd ramdisk — confirmed present in the extracted recovery.img ramdisk
  • udisks2 automount interference — stopped per documented requirements, no change
  • Board/BSP-specific issue — ruled out by cross-testing: this exact devkit works fine from a different host machine; a different board exhibits the identical failure on this host. So it’s host-specific, not board-specific.
  • Kernel Image/DTB corruption — verified intact
  • VM/USB-passthrough issues — this host is bare metal

Open question: what would cause a second SSH connection to the same target, moments after a first one succeeded, to fail with exit 255 and zero diagnostic output — especially given this is reproducible on one specific host but not on another host with the same board?

Has anyone seen this specific failure mode before, or does the initrd’s sshd have any known single-connection or rate-limiting behavior that could explain a second connection being refused right after the first one succeeds?

This itself show that some settings or some difference in the host pc is causing the issue.. nothing to do with the board

initramfs is likely using Dropbear ssh server. It could be Dropbear has a hardcoded single ssh connection, or Dropbear is explicitly executed in the foreground with the -F flag and runs single-threaded.

Found and fixed the root cause. Posting the full explanation in case it helps anyone else who hits this.

Root cause:

sshd inside the target’s initrd (the ramdisk booted during l4t_backup_restore.sh/l4t_initrd_flash.sh) was exiting immediately with:

Permissions 0644 for '/etc/ssh/ssh_host_rsa_key' are too open.
Unable to load host key "/etc/ssh/ssh_host_rsa_key": bad permissions
Unable to load host key "/etc/ssh/ssh_host_ecdsa_key": bad permissions
Unable to load host key "/etc/ssh/ssh_host_ed25519_key": bad permissions
sshd: no hostkeys available -- exiting.

All three SSH host keys baked into the ramdisk had world-readable permissions (0644) instead of the required 0600. OpenSSH refuses to load a private key with overly-permissive permissions as a security measure — with all three rejected, sshd had zero usable host keys and exited on startup. From the host side, this looked exactly like a network/USB/connectivity problem: SSH would connect fine for a trivial readiness check, then the actual backup/restore command’s SSH session would fail instantly with exit code 255 and zero diagnostic output — no error message, nothing.

The fix:

Add an explicit chmod 600 immediately after the ssh-keygen calls in prepare_sshd_files():

tools/ota_tools/version_upgrade/ota_make_recovery_img_dtb.sh

 	ssh-keygen -t dsa -N "" -f "${_initrd_dir}/${ssh_config_dir}/ssh_host_dsa_key" >/dev/null 2>&1;check_error
 	ssh-keygen -t rsa -N "" -f "${_initrd_dir}/${ssh_config_dir}/ssh_host_rsa_key" >/dev/null 2>&1;check_error
 	ssh-keygen -t ecdsa -N "" -f "${_initrd_dir}/${ssh_config_dir}/ssh_host_ecdsa_key" >/dev/null 2>&1;check_error
 	ssh-keygen -t ed25519 -N "" -f "${_initrd_dir}/${ssh_config_dir}/ssh_host_ed25519_key" >/dev/null 2>&1;check_error
+	# Force private key permissions: some hosts have a directory default ACL
+	# that grants group/other read access to newly created files regardless
+	# of the requested creation mode, which causes sshd on the target to
+	# reject these host keys ("bad permissions") and refuse to start.
+	chmod 600 "${_initrd_dir}/${ssh_config_dir}/"ssh_host_*_key;check_error

This forces correct permissions regardless of any directory ACL/umask quirk on the build host, so it applies automatically on every future run.