'Locked out' of my Raspbery Pi

Not sure if anyone can help me out, or if I have to chalk this one up to experience, but:

I’m running an RPi4b with Dietpi 6.25, which I installed headless with a view to accessing via SSH. My aim was to make this into a media server/torrentbox, which I managed to put together after a a dozen hours (quite proud). Everything is now in place, and everything is accessible/running fine.

The problem I’ve encountered is that when swapping over Dropbear for OpenSSH for SFTP access, the SSH timed out towards the end of the uninstallation process. As a result, I can no longer access my Pi via SSH or SCP at all.
To make matters worse, this is a completely headless setup so I have turned off HDMI output and am now effectively locked out of my pi! Is there a slim chance that I can activate/install an ssh client directly onto my SD card? I really, really hope that I don’t have to start over and say goodbye to an entire weekend.

Thanks for reading, eager for responses!

thewhatofwhom
Many thanks for your report.

Did you switch from Dropbear to OpenSSH via dietpi-software SSH server choice? During our tests, the active SSH session did survive, but probably that has changed or is not true on certain circumstances. Probably we need to only allow this either when current session is not SSH or it runs within a GNU/screen session that finishes the install in background and can be reattached as fast as OpenSSH is up.

For now you can re-enable HDMI by plugging the SDcard and mounting the first (fat) partition to a remote system:

  • In config.txt, comment: hdmi_ignore_hotplug, hdmi_ignore_composite and all framebuffer settings.

I already had the idea to implement some emergency method, e.g. placing an empty file like disable_headless beside the config.txt/dietpi.txt and our boot scripts can check for it’s existence, enable video features, remove the file and reboot.

But another thing, since you are on RPi4, there all HDMI settings exist two times, while the above should only have an effect on the first HDMI port. Does the second not react as well?