Fixing dropbear-initramfs '/scripts/init-premount/dropbear: cat: not found' error

Here’s an irritating one.

I use dropbear to remotely unlock LUKS-encrypted volumes. It works well. I can reboot a machine, and then use dropbear’s ssh to login, unlock the LUKS volumes, and then finish booting the machine.

Yesterday, I rebooted a machine, and I was unable to log in to dropbear’s ssh server. This was odd, and I had no reason to suspect anything was amiss.

Connecting a monitor to the machine and watching the boot process, I could unlock LUKS via a keyboard, but there was no sign that dropbear was loading, or that the initramfs had obtained an IP address (as would normally show).

After entering the password, the prompt did not show for around 60 seconds, and then showed a non-stop stream of error messages:

/scripts/init-premount/dropbear: cat not found
/scripts/init-premount/dropbear: sleep: not found

To stop this, I used Alt + F4.

This brought me to the normal login prompt, so I could log in to the server.

The script in question is in /usr/share/initramfs-tools/scripts/init-premount, but it looked fine. I compared it, and its permissions, with the script on a machine where dropbear-initramfs was working correctly, and they were identical.

I checked if cat and sleep are in the initramfs, using lsinitramfs /initrd.img | grep -e/{sleep,cat}

This returned:


So it looked like both cat and sleep were present.

In the end, I did fix it, in that I removed dropbear-initramfs (apt remove --purge dropbear-initramfs -y) and then reinstalled it (apt install dropbear-initramfs -y), and re-added my settings to the config file.

I rebuild the initramfs and updated grub.

And it worked.

Why it worked, or why it needed this, or why it happened in the first place, I don’t know.

But perhaps even this will helpful someone - or me - in the future.