You are not logged in.

#1 2017-05-01 19:57:56

emacsomancer
Member
Registered: 2014-09-20
Posts: 211

setup for luks-encrypt zfs root with systemd-boot?

I'm trying to setup a zfs root on a luks-encrypted partition using systemd-boot (née gummiboot) as my boot-loader.  (I'm changing this over from a ext4 root system which was also using a luks-encrypted root partition.)

I have the following settings for /etc/fstab, for my relevant boot entry (/boot/loader/entries/), and zfs:


/etc/fstab:

/dev/zvol/tank/swap     none     swap   sw  0 0

arch.conf:

title     Arch Linux mainline kernel
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options cryptdevice=UUID=<UUID>:cryptroot zfs=tank/ROOT/arch rw acpi_osi="!Windows 2012" zfs.zfs_arc_max=6442450944

(where <UUID> is a real UUID)


I have set the zfs cachefile with:

zfs set cachefile=/etc/zfs/zpool.cache tank

and tank/ROOT/arch has the mountpoint set as /   (i.e. zfs set mountpoint=/ tank/ROOT/arch )

and I set the bootfs as:

zpool set bootfs=tank/ROOT/arch tank

But when I boot, it asks me to enter the password for the cryptroot volume, which I do. It accepts the password, but then locks up after displaying:

:: running hook [zfs]
ZFS: Importing pool tank.
:: running late hook [lvm2]
:: running late hook [zfs]
no pool available to import
:: running cleanup hook [lvm2]
:: running cleanup hook [udev]
Freezing execution.

What am I doing wrong?

Last edited by emacsomancer (2017-05-01 20:01:58)

Offline

#2 2017-05-02 06:44:31

revo86er
Member
Registered: 2017-03-01
Posts: 6

Re: setup for luks-encrypt zfs root with systemd-boot?

Hi,
I'm beginner, but the execution order of those hooks is in the file `/etc/mkinitcpio.conf`.
They need to have the right order, you may want to check these...

Last edited by revo86er (2017-05-02 12:16:04)

Offline

#3 2017-05-03 01:08:03

emacsomancer
Member
Registered: 2014-09-20
Posts: 211

Re: setup for luks-encrypt zfs root with systemd-boot?

revo86er wrote:

Hi,
I'm beginner, but the execution order of those hooks is in the file `/etc/mkinitcpio.conf`.
They need to have the right order, you may want to check these...

You are quite right, I should have reported this as well.

I have tried a number of different combinations. The last one (which still didn't work) being:

 HOOKS="base udev autodetect modconf block keyboard zfs filesystems"

Offline

#4 2017-05-03 12:49:29

revo86er
Member
Registered: 2017-03-01
Posts: 6

Re: setup for luks-encrypt zfs root with systemd-boot?

I've a luks-encrypted harddrive as well, with btrfs.
My Hooks line looks like this:

HOOKS="base udev resume autodetect modconf block encrypt filesystems keyboard btrfs" 

you may need to add `encrypt`?

Offline

#5 2017-05-03 16:58:53

emacsomancer
Member
Registered: 2014-09-20
Posts: 211

Re: setup for luks-encrypt zfs root with systemd-boot?

revo86er wrote:

I've a luks-encrypted harddrive as well, with btrfs.
My Hooks line looks like this:

HOOKS="base udev resume autodetect modconf block encrypt filesystems keyboard btrfs" 

you may need to add `encrypt`?

Right, sorry, I actually have just gone to a straight zfs (w/o luks) setup just to try to cut down on the number of variables.  I did have 'encrypt' in there at the beginning though.

Offline

#6 2017-05-03 18:11:03

loqs
Member
Registered: 2014-03-06
Posts: 19,114

Re: setup for luks-encrypt zfs root with systemd-boot?

It seems the system is locking up on or after line 47 of /usr/lib/initcpio/init which is copied into the initrd as init

run_hookfunctions 'run_cleanuphook' 'cleanup hook' $CLEANUPHOOKS

if [ "$(stat -c %D /)" = "$(stat -c %D /new_root)" ]; then
    # Nothing got mounted on /new_root. This is the end, we don't know what to do anymore
    # We fall back into a shell, but the shell has now PID 1
    # This way, manual recovery is still possible.
    err "Failed to mount the real root device."
    echo "Bailing out, you are on your own. Good luck."
    echo
    launch_interactive_shell --exec
elif [ ! -x "/new_root${init}" ]; then
    # Successfully mounted /new_root, but ${init} is missing
    # The same logic as above applies
    err "Root device mounted successfully, but ${init} does not exist."
    echo "Bailing out, you are on your own. Good luck."
    echo
    launch_interactive_shell --exec
fi

if [ "${break}" = "postmount" ]; then
    echo ":: Post-mount break requested, type 'exit' to resume operation"
    launch_interactive_shell
fi

# this should always be the last thing we do before the switch_root.
rdlogger_stop

exec env -i \
    "TERM=$TERM" \
    /usr/bin/switch_root /new_root $init "$@"

# vim: set ft=sh ts=4 sw=4 et:

Perhaps add some more `echo`s to determine which line exactily it freezes on?
Edit:
Added more of the code as it could progress further without producing output.

Last edited by loqs (2017-05-03 18:14:15)

Offline

Board footer

Powered by FluxBB