sudo -i
zpool export -a
zpool import -N -R /mnt rpool
zpool import -N -R /mnt bpool
zfs load-key -a
# Replace “UUID” as appropriate; use zfs list to find it:
zfs mount rpool/ROOT/ubuntu_UUID
zfs mount bpool/BOOT/ubuntu_UUID
zfs mount -a
mount --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys
mount -t tmpfs tmpfs /mnt/run
mkdir /mnt/run/lock
chroot /mnt /bin/bash --login
mount -a
grub-probe /boot
update-initramfs -c -k all
update-grub
grub-install /dev/sdX # For legacy (BIOS) booting
exit
reboot