1

While trying to set up a usb key to unlock an encrypted OS drive on ubuntu 24.04 server, I accidentally created a broken script (typed rather than copy-pasting) and the system will no longer boot. I need to catch and repair the broken script, but not sure how.

I tried going into single-user mode to no avail, by pressing shift or escape during startup. I also tried using a live ubuntu usb to mount the boot partition of my OS drive and find the script, but cannot locate it. While the system was still running, I placed it in /bin/scriptname. Unfortunately I don't know where to look for it on the unencrypted boot sector (the OS partition is encrypted so I can't mount it). Any help would be really appreciated.

Edit: I made some headway, but still not solved. Specifically, I unpacked the initrd.img cpio archive, and repacked it after removing what I believed to be an appropriate portion of the crypttab file (pointing to the luksunlockusb script). However, the initrd.img file was malformed: not bootable. I tried again by unpacking and repacking without changes (unpacked with unmkinitramfs, packed with mkinitramfs) and still cannot boot. So clearly my problem is the way I am repacking the initrd file.

For reference, I have 4 directories after unpacking: early, early2, early3, and main. Not sure if I'll have to pack manually with cpio. Perhaps binwalk will help, will try that next. If anyone has the proper way to pack the initrd file for Ubuntu 24.04 (correct options) I'd really appreciate it.

1
  • Apologies as I didn't know there were different versions. I used the default LUKS-encrypted option on the Ubuntu 24.04 server installer. I don't believe the boot partition is encrypted (nor do I know how it would boot otherwise). Please let me know if other details are necessary.
    – anvoice
    Commented Jun 21 at 1:22

0

You must log in to answer this question.

Browse other questions tagged .