Autor Thema: failed to mount /sysroot - zfs on luks with systemd-boot  (Gelesen 148 mal)

0 Mitglieder und 1 Gast betrachten dieses Thema.

Offline mksm

  • Neuling
  • *
  • Beiträge: 2
  • Karma: +0/-0
  • Skill: Durchschnitt
Hello Manjaro-Community,

this is my first forum post. After many years of just reading the post I now feel the urge to write a post myself.
I used many different wikis and blog posts. after a while i got tiered renaming things so I left the original names in there. hence the "arch" references everywhere. I gonna refactor this once i get something running.

so this is my setup:

└─luksCont                                                crypt
  ├─systemVG-rootLV                                lvm   
   |   └─zfs pool
  └─systemVG-swapLV                              lvm   
sdc                   8:32   1  28.7G  0 disk 
├─sdc1                8:33   1   550M  0 part  /mnt/efi
└─sdc2                8:34   1   250M  0 part  /mnt/boot

sda: Main Disk
sdc: for efi/boot, luksheader, keyfile

Bootloader: systemd-boot
mkinitcpio.conf:(only the Files and HOOKS)

FILES=(/boot/header.img /boot/key.img)

HOOKS=(base systemd autodetect modconf keyboard sd-vconsole block mycustomencrypthook lvm2 zfs filesystems)

first i wanted to use sd-encrypt then I read
so i wrote my own hook based on


run_hook() {

modprobe -a -q dm-crypt >/dev/null 2>&1
modprobe loop

[ "${quiet}" = "y" ] && CSQUIET=">/dev/null"

echo 'Waiting for USB:'
echo ' /efi '
echo -n ' '

while [ ! -L '/dev/disk/by-uuid/3EF6-1EDA' ]; do

printf "\b${sp:i++%${#sp}:1}"
sleep 1
printf "\bfound!"

echo ' /boot '
echo -n ' '

while [ ! -L '/dev/disk/by-uuid/1667-253D' ]; do

printf "\b${sp:i++%${#sp}:1}"
sleep 1
printf "\bfound!"

#mkdir -p /mnt
#mount /dev/disk/by-uuid/1667-253D /mnt

#cryptsetup open /mnt/key.img lukskey
cryptsetup open /boot/key.img luks-key
cryptsetup open /dev/disk/by-id/ata-SAMSUNG_MZ7TD256HAFV-000L7_S16GNEAD406956 --header=/boot/header.img --key-file=/dev/mapper/luks-key enc

cryptsetup close luks-key

not sure if this is worth it, but i also found this github repo
which apparently adds zfs support to systemd. I haven't tried that yet, because I don't know how to install it. I get this error:
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

But some seem to have a very similar issue with that to.
just that i don't use legacy mounts but inherited ones:

zfs get mountpoint returns:
rpool                                mountpoint  /mnt                           local
rpool/ROOT                           mountpoint  none                           local
rpool/ROOT/arch                      mountpoint  /mnt                           local
rpool/ROOT/opt                       mountpoint  /mnt/opt                       local
rpool/ROOT/usr                       mountpoint  /mnt/usr                       local
rpool/ROOT/usr/local                 mountpoint  /mnt/usr/local                 inherited from rpool/ROOT/usr
rpool/ROOT/var                       mountpoint  /mnt/var                       local
rpool/ROOT/var/lib                   mountpoint  /mnt/var/lib                   inherited from rpool/ROOT/var
rpool/ROOT/var/lib/systemd           mountpoint  /mnt/var/lib/systemd           inherited from rpool/ROOT/var
rpool/ROOT/var/lib/systemd/coredump  mountpoint  /mnt/var/lib/systemd/coredump  inherited from rpool/ROOT/var
rpool/ROOT/var/log                   mountpoint  /mnt/var/log                   inherited from rpool/ROOT/var
rpool/ROOT/var/log/journal           mountpoint  /mnt/var/log/journal           inherited from rpool/ROOT/var
rpool/home                           mountpoint  /mnt/home                      inherited from rpool
rpool/home/maksim                    mountpoint  /mnt/home/maksim               inherited from rpool
rpool/home/root                      mountpoint  /mnt/root                      local

I'm a bit confuesed why zfs mount shows different output from within the chroot.

zfs mount (in chroot)
rpool/ROOT/arch                 /
zfs mount (manjaro iso)
rpool/ROOT/opt                  /mnt/opt
rpool/home/root                 /mnt/root
rpool/ROOT/var/log              /mnt/var/log
rpool/home                      /mnt/home
rpool/ROOT/var/lib/systemd/coredump  /mnt/var/lib/systemd/coredump
rpool/ROOT/usr/local            /mnt/usr/local
rpool/home/maksim               /mnt/home/maksim
rpool/ROOT/var/log/journal      /mnt/var/log/journal
rpool/ROOT/arch                 /mnt

The comments are different variants I tried. They seem to not change anything. I still . But maybe I'm missing something
title Arch Linux
linux /vmlinuz-5.10-x86_64
initrd /intel-ucode.img
initrd /initramfs-5.10-x86_64.img
options root=zfs:AUTO
#options root=zfs:rpool/ROOT/arch
#options root=ZFS=rpool/ROOT/arch
#options zfs=rpool/ROOT/arch


default archlinux
timeout 3
console-mode max
editor 1
random-seed-mode with-system-token

On reboot I always get the error: Failed to mount /sysroot. see the 'screenshot' i provided.

Also can not enter the emergency shell because root seems to be locked.
journalctl in the chroot doesn't work also.


Offline mksm

  • Neuling
  • *
  • Beiträge: 2
  • Karma: +0/-0
  • Skill: Durchschnitt
Re: failed to mount /sysroot - zfs on luks with systemd-boot
« Antwort #1 am: 16. Juni 2021, 20:18:08 »
Ich habe zu spaet gemerkt, dass ich auf der deutschen Forum-Seite gelandet bin, deshalb alles auf Denglish. Leider kann ich den Post nicht mehr bearbeiten, sonst haette ich es noch uebersetzt.