I'm looking to create an (internal, for legal reasons) preseeded debian (stretch) installer that will automatically create a root zpool from all available HDs instead of going through (whether automated or not) the usual partition setup.
Most advice I've seen for a ZFS root (or perhaps, a more authoritative guide) requires installing debian then manually booting into a LiveCD, installing ZFS on that LiveCD, setting up ZFS, then
chrooting into the new ZFS root to essentially reinstall everything. This seems very error prone and tedious. Although, I understand that for legal reasons the debian installer may never include ZFS as a builtin option.
In my research, I came across some mailing list threads where several people asked maintainers about something approximating this, but they always devolved into legal explanations and the question never was answered (I'd share if I could find them again, but reading them is largely a waste of time!).
Taking a look at an example preseed file for stable, we see the following interesting lines:
### Apt setup # You can choose to install non-free and contrib software. #d-i apt-setup/non-free boolean true #d-i apt-setup/contrib boolean true
And a little further down:
# Individual additional packages to install #d-i pkgsel/include string openssh-server build-essential
This seems promising, because you could indeed just ask for ZFS to be installed:
d-i apt-setup/contrib boolean true d-i pkgsel/include string zfs-dkms zfsutils-linux zfs-initramfs
But, since apt setup and package installation is done after the partitioning step, this is probably too late.
I did find this guide which explains another way of adding non-free packages to the install process (tl;dr download the deb,
dpkg-deb -x'd it into initrd, and remake the iso). This has the advantage (I think) of being available before the partitioning step. It seems like something similar could be done for installing ZFS (although, you'd first need to compile it before stuffing it into initrd). The tricky bit here is we need a hook to replace the partition step with a script that creates the ZFS pool. This comment by @FerencWágner from a SE Unix thread about changing some LVM things in partman seems promising, but no details were given as to specifically how this was achieved (and the accepted answer suggests partman can't do custom things like this).
So with that all in mind:
- Is the
d-i pkgsel/includeindeed too late to use ZFS when creating the root fs?
- If the above is correct, is including the packages in initrd a correct approach to making ZFS available at the partitioning step?
- And regardless of whether (1) is correct, how do I replace the partman step with my custom ZFS root pool creation?