Ubuntu 20.04 on ZFS can't update kernel, bpool missing
Symptoms
- Kernel doesn't update. That is after restart, the system is still on the old kernel.
- Changes to GRUB config aren't applied.
- Installing a new kernel isn't applying.
- bpool is missing due to not being imported.
Problem
This is caused by a change in the name of the disk device from time of installation to when the symptoms began. For example, if the disk where Ubuntu was installed was /dev/sda at the time of installation, then another disk was added, the first disk can become /dev/sdb. There Ubiquity installer version shipped with the Ubuntu 20.04 installation media uses the /dev/sdX names when creating the ZFS pools. That means rpool
and bpool
are created with vdevs /dev/sdaX
. Once those change post installation, the non-root pool cannot be imported because the original vdev ID no longer contains a ZFS pool in it. That results in booting Ubuntu without the /boot filesystem used by GRUB mounted. Instead files written to /boot during kernel updates or installation end up in /boot in rpool
which isn't used by GRUB during boot. Et viola.
When I faced this issue recently the bpool was missing from online status when run
sudo zpool status
so I do this
First I import bpool
like this
sudo zpool import -d /dev/sdX bpool
my previously bpool was in /dev/sdb6
So when run zpool status
its says rpool
and bpool
are online, Then I reinstall last image like this to enforce to write on empty /boot
In my case
sudo apt --reinstall install linux-image-5.4.0-52-generic
Then reboot and seem the new kernel was updated successfully
That's it
I hope this help someone else
BR
Solution
Post install
I am not certain if this can be reliably fixed post-install. One thing I found is if I import bpool
with the right vdev, then it shows up and it gets mounted on subsequent reboots since it gets remembered in the pool cache. It seems to be possible to change the ZFS vdev name upon import but I'm not sure how this can be done exactly so I'm not suggesting it. Someone with better ZFS-fu can suggest the correct sequence of commands, maybe involving zpool import ... -d ...
.
At install time
There's already a fix in the responsible code block in Ubiquity but it isn't part of the current version shipped with the first 20.04 media. You can however grab it once you've booted into the Live desktop environment.
- Boot from the Ubuntu installation media.
- Choose
Try Ubuntu without installing
. - Grab that fixed
zsys-setup
:
sudo wget -O /usr/share/ubiquity/zsys-setup https://git.launchpad.net/ubiquity/plain/scripts/zsys-setup?h=20.10.2
- Run the Ubuntu installer and install on ZFS (experimental) as normal.