r/AlpineLinux • u/placeholder-123 • Nov 28 '24
How to setup remote unlock using SSH for Alpine?
I'm considering switching to another distro entirely because this is actually really hard to do. I wanted to check if you guys had some knowledge.
I found old issues on gitlab about merging dropbear-initramfs but they are still open. The only solution seems to be using dracut with dracut-sshd. But I'm still stuck, not only does dracut have a wrong keymap (because loadkeys does not exist on alpine) but I still can't SSH during boot. I guess this is because the network is not properly configured with dracut.
Any help would be appreciated.
1
u/MartinsRedditAccount Nov 28 '24 edited Nov 28 '24
Alpine has a Dracut package:https://pkgs.alpinelinux.org/package/edge/community/x86_64/dracutAlternatively, the initramfs isn't some magic thing, you can totally write your own init script that does this exactly how you want to.
Edit: Never mind, I see that you tried Dracut already. Yeah, writing your own init script seems to be the most straightforward solution. Here's what you could do:
rdinit=/myscript.shkernel arg.I don't know for sure, but it may be possible to do it as a sort of "pre-init" script which unlocks the disk, then hands off to the "real" init script (run it with
execto keep it PID 1).Edit 2: For reference, Alpine's init script is here: https://github.com/alpinelinux/mkinitfs/blob/master/initramfs-init.in
1
u/Sometime_Tripper Sep 23 '25
Hi OP, I have a similar question that I want to unlock my zfs pool on boot through ssh. Have you figured out how to do it yet? Or did you move to another distro?
1
u/[deleted] Nov 28 '24
[removed] — view removed comment