ZFS Filesystems Mounts Manually but not on Boot
@July 10, 2024
We’ve recently had a case of ZFS filesystems that were added to an existing Ubuntu 22.04 system but everytime the system restarted, the zfs daemon would be shown “dead” and zpool list
returned “No pools available”
This was problematic since users could log in, but not access their files and configs since /home
was on that ZFS.
Starting the zfs systemd daemons manually would succeed but not mount the FS but zpool import -a
would temporarily resolve the issue. Still, the FS would not come up on boot..
root@capernaum:/root# systemctl status zfs-zed
○ zfs-zed.service - ZFS Event Daemon (zed)
Loaded: loaded (/lib/systemd/system/zfs-zed.service; enabled; vendor prese>
Active: inactive (dead)
Docs: man:zed(8)
root@capernaum:/root# systemctl status zfs-import-cache
○ zfs-import-cache.service - Import ZFS pools by cache file
Loaded: loaded (/lib/systemd/system/zfs-import-cache.service; enabled; ven>
Active: inactive (dead)
Docs: man:zpool(8)
ZFS was there and loaded but did “nothing” to mount the filesystems despite all disks being present.
root@capernaum:/root# dmesg | grep zfs
[ 3.911970] zfs: module license 'CDDL' taints kernel.
[ 3.912006] zfs: module license taints kernel.
root@capernaum:/root# journalctl -u zfs
-- No entries --
root@capernaum:/root# zpool status
no pools available
Problem: Missing zfs target and no ZFS in Initrd
It turns out, that the zfs target was never enabled and initrd was missing zfs support:
root@capernaum:/root# ls /etc/systemd/system/multi-user.target.wants/zfs.target
ls: cannot access '/etc/systemd/system/multi-user.target.wants/zfs.target': No such file or directory
root@capernaum:/root# lsinitramfs /boot/initrd.img-$(uname -r) | grep zfs
root@capernaum:/root# # (no results listed)
Solution: Install zfs-initramfs and enable zfs.target
After installing the missing zfs-initramfs
package with sudo apt install zfs-initramfs
which conveniently also regenerates the initramfs, and enabling the systemd target the problem was solved.
root@capernaum:/root# lsinitramfs /boot/initrd.img-$(uname -r) | grep zfs
conf/conf.d/zfs
etc/default/zfs
etc/zfs
etc/zfs/zed.d
# ...
Enable the systemd target with
root@capernaum:/root# systemctl enable zfs.target
Created symlink /etc/systemd/system/multi-user.target.wants/zfs.target → /lib/systemd/system/zfs.target.
We also installed the missing zsys
package with sudo apt install zsys
Upgrade ZFS
For good measure, we also upgraded the zfs filesystem with zpool upgrade [poolname]
for the pool that was listed as missing some features with zpool upgrade
as it was created from a live disk with an older zfs version.
You need help with a Linux system too? Contact us now.
Contact us