From e3392a5e7d1407cb1054af2053b7ed07179b4921 Mon Sep 17 00:00:00 2001 From: Cong Zhang <13283869+congzhangzh@users.noreply.github.com> Date: Sat, 23 Aug 2025 04:11:41 +0800 Subject: [PATCH] Prompt user to unlock when login from dropbear MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the zfsunlock initramfs hook to provide instructions on how to unlock the root filesystem when appropriate. The intent is to make the dropbear ssh MOTD more user friendly. Reviewed-by: Brian Behlendorf Reviewed-by: Ahelenia ZiemiaƄska Signed-off-by: Cong Zhang <13283869+congzhangzh@users.noreply.github.com> Closes #17661 Closes #17662 --- contrib/initramfs/hooks/zfsunlock.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/initramfs/hooks/zfsunlock.in b/contrib/initramfs/hooks/zfsunlock.in index 4776087d9..db9bf0e20 100644 --- a/contrib/initramfs/hooks/zfsunlock.in +++ b/contrib/initramfs/hooks/zfsunlock.in @@ -8,3 +8,12 @@ fi . /usr/share/initramfs-tools/hook-functions copy_exec /usr/share/initramfs-tools/zfsunlock /usr/bin/zfsunlock + +if [ -f /etc/initramfs-tools/etc/motd ]; then + copy_file text /etc/initramfs-tools/etc/motd /etc/motd +else + tmpf=$(mktemp) + echo "If you use zfs encrypted root filesystems, you can use \`zfsunlock\` to manually unlock it" > "$tmpf" + copy_file text "$tmpf" /etc/motd + rm -f "$tmpf" +fi