You are not logged in.

#1 2019-02-03 11:52:05

From: Outta nowhere
Registered: 2014-04-04
Posts: 273

zfs root mounted but /sbin/init does not exist

I've installed Arch on ZFS before but this time its failing to boot, I suspect because I've made separate datasets for /usr, /opt and /var.

In short, I have a UEFI machine (i3 nuc from 2013) that's booting in legacy mode.
Disk has regular dos/mbr with 1 primary partition with type bf00.

I've created the pool:

root@archiso ~ # zpool create -f zroot /dev/disk/by-id/ata-KINGSTON_SUV500MS240G_50026B778242C725-part1


root@archiso ~ # zfs create -o mountpoint=none zroot/OS     
root@archiso ~ # zfs create -o mountpoint=none zroot/DATA
root@archiso ~ # zfs create -o compression=lz4 -o mountpoint=/ zroot/OS/root
root@archiso ~ # zfs create -o compression=lz4 -o mountpoint=/opt zroot/OS/opt
root@archiso ~ # zfs create -o compression=lz4 -o mountpoint=/usr zroot/OS/usr
root@archiso ~ # zfs create -o compression=lz4 -o mountpoint=/var zroot/OS/var
root@archiso ~ # zfs create -o compression=lz4 -o mountpoint=/home zroot/DATA/home

Set quota's:

root@archiso ~ # zfs set quota=8G zroot/OS/opt
root@archiso ~ # zfs set quota=25G zroot/OS/root
root@archiso ~ # zfs set quota=8G zroot/OS/usr  
root@archiso ~ # zfs set quota=8G zroot/OS/var
root@archiso ~ # zfs set quota=20G zroot/DATA/home


root@archiso ~ # zfs create -V 4G -b $(getconf PAGESIZE) -o logbias=throughput -o sync=always -o primarycache=metadata -o com.sun:auto-snapshot=false zroot/SWAP

Full list:

root@archiso ~ # zfs list
zroot            4.25G   211G    96K  /zroot
zroot/DATA        192K   211G    96K  none
zroot/DATA/home    96K  20.0G    96K  /home
zroot/OS          480K   211G    96K  none
zroot/OS/opt       96K  8.00G    96K  /opt
zroot/OS/root      96K  25.0G    96K  /
zroot/OS/usr       96K  8.00G    96K  /usr
zroot/OS/var       96K  8.00G    96K  /var
zroot/SWAP       4.25G   215G    56K  -

I've set acltype=posixacl on all nested datasets below zroot/OS.

Unmounted, set all mountpoints and exported the pool. Imported it on /mnt, arch-chroot into it and installed/configured the system.

I set the HOOKS and generated initramfs.

HOOKS=(base udev autodetect modconf block keyboard zfs usr filesystems shutdown)

Installed grub and generated the config:

ZPOOL_VDEV_NAME_PATH=1 grub-install --target=i386-pc /dev/sda
ZPOOL_VDEV_NAME_PATH=1 grub-mkconfig -o /boot/grub/grub.cfg

The linux and initrd lines in grub.cfg:

linux	/OS/root@/boot/vmlinuz-linux root=ZFS=zroot/OS/root rw  zfs_force=1 quiet
initrd	/OS/root@/boot/intel-ucode.img /OS/root@/boot/initramfs-linux.img

I tried correcting the path according to the wiki (the /@/):

linux	/OS/root/@/boot/vmlinuz-linux root=ZFS=zroot/OS/root rw  zfs_force=1 quiet
initrd	/OS/root/@/boot/intel-ucode.img /OS/root@/boot/initramfs-linux.img

In the rescue mode, I can see zroot/OS/root is mounted under new_root, but no other dataset is mounted.

From here on I got lost. I tried enabling the zfs services and the suggestion for zgenhostid and regenerating initramfs.

I can't get /usr, /opt, and the other datasets to mount.

Someone has an idea what I am doing wrong?

I made full notes of every step so ask away if you need more information.

Thanks for the help!

Last edited by mouseman (2019-02-03 12:05:36)


#2 2019-02-04 19:02:59

From: Outta nowhere
Registered: 2014-04-04
Posts: 273

Re: zfs root mounted but /sbin/init does not exist

So I've made a few more attempts, I can create datasets for /opt, /var and /home, but as soon as I put /usr in a separate dateset, I get this error.

Does anyone have an idea how to fix that please?



#3 2019-02-04 19:20:14

Inspector Parrot
Registered: 2011-11-29
Posts: 23,465

Re: zfs root mounted but /sbin/init does not exist

/sbin is a symlink to /usr/bin and you're initramfs is likely only mounting / - so the error message is accurate, there is no /sbin/init on the root partition.

You will (at least) need to add the usr hook to your mkinitcpio.conf if you haven't yet:

EDIT: oops, sorry it is there, I missed that info in your first post.  Note too that the order of the hooks may matter.

Last edited by Trilby (2019-02-04 19:20:56)

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman


#4 2019-02-04 20:04:30

From: Outta nowhere
Registered: 2014-04-04
Posts: 273

Re: zfs root mounted but /sbin/init does not exist

Thanks Trilby. I did indeed add the usr hook, wiki says after zfs but I've moved it to before too, to no avail.

There is this somewhat "lost" note on the wiki that I can't place:

When using systemd in the initrd, you need to install mkinitcpio-sd-zfs (aur) and add the sd-zfs hook after the systemd hook instead of the zfs hook. Keep in mind that this hook uses different kernel parameters than the default zfs hook, more information can be found at the project page.

I have no idea when or why I would want to use initrd (I know what it is), just nowhere does it explain why (in conjunction with root on zfs) it should be instead of initramfs.


Board footer

Powered by FluxBB