1

So I'm trying to modify initrd.img which is used on Raspberry Pi 2(Ubuntu 18.04) but when I repack it again and start Raspberry Pi with new initrd.img I can't connect via SSH(dropbear is installed) to enter passphrase for unlocking LUKS encrypted drive: Permission denied (publickey).Same situation when I don't make any changes: just extracting initrd.img and repacking it again - can't connect via SSH. I'm getting almost same file size after repacking comparing with original file(difference is around ~1-2KB). So maybe my repacking method is wrong or maybe there is some protection for SSH keys inside initramfs?

Commands that I used for extraction:

gzip -dc < ~/initrd.img | cpio -i

Repacking:

find . | cpio -H newc -o | gzip -9 > ~/initrdNEW.img

EDIT

After extracting initrd.img there is root-sJD1OZ/.ssh/ directory with authorized_keys file inside it. When I update-initramfs on my Rasperry Pi and then extract contents again, that directory name changes(e.g. root-XXXXXX).

If you have any questions, please ask.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.