Comment 23 for bug 2051999

Revision history for this message
Mike Ferreira (mafoelffen) wrote (last edit ):

The command log for the work-around for a broken jammy install:
>>>
sudo su -
zpool export -a
zpool import -N -R /mnt rpool
zpool import -N -R /mnt bpool
UUID=$(zfs list | awk '/^bpool\/BOOT\/ubuntu_/ {print $1}' | sed 's/bpool\/BOOT\/ubuntu_//g')
zfs mount rpool/ROOT/ubuntu_$UUID
zfs mount bpool/BOOT/ubuntu_$UUID
zfs mount -a
mount --make-private --rbind /dev /mnt/dev
mount --make-private --rbind /proc /mnt/proc
mount --make-private --rbind /sys /mnt/sys
mount --make-private --rbind /run /mnt/run
chroot /mnt /bin/bash --login
mount -a

# Make backup of the original Jammy sources.list
cp /etc/apt/sources.list /etc/apt/sources.list.jammy

# Create a new Noble sources.list
sudo nano /etc/apt/sources.list.noble

# Fill with these contents:
deb http://us.archive.ubuntu.com/ubuntu/ noble main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ noble-updates main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ noble-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu noble-security main restricted universe multiverse
# Save and exit
cp /etc/apt/sources.list.noble /etc/sources.list
apt update

# Add the Grub2 2.12 ppa
add-apt-repository ppa:ubuntu-uefi-team/build

# Modify the sources.list line of the PPA to work with Jammy
nano /etc/apt/sources.list.d/ubuntu-uefi-team-ubuntu-build-jammy.list

# Change the active line to:
deb [trusted=yes] https://ppa.launchpadcontent.net/ubuntu-uefi-team/build/ubuntu/ noble main
# Save and exit nano
apt update

# Install the Grub2 packages
apt install grub-efi-amd64 grub-efi-amd64-signed
# This will pull in some needed depends of Grub2 2.12~rc1 from the Nolble Repo's

# Reinstall/configure grub
grub-install --target=x86_64-efi --efi-directory=/boot/efi \
    --bootloader-id=ubuntu --recheck --no-floppy

# Update the intramfs images
update-intramfs -c -k all

# Change the repo sources back to Jammy
cp /etc/apt/sources.list.jammy /etc/apt/sources.list
apt update

# Test: (Skip if snapshots already exist...)
zfs snapshot bpool/BOOT/ubuntu_2nlhsy@20230204a
zfs snapshot bpool/BOOT/ubuntu_2nlhsy@20230204b
zfs snapshot bpool/BOOT/ubuntu_2nlhsy@20230204c

zfs list -t snapshot

# Output:
#NAME USED AVAIL REFER MOUNTPOINT
#bpool/BOOT/ubuntu_2nlhsy@20230204a 0B - 298M -
#bpool/BOOT/ubuntu_2nlhsy@20230204b 0B - 298M -
#bpool/BOOT/ubuntu_2nlhsy@20230204c 0B - 298M -

# Exit Gracefully:
exit
mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | \
    xargs -i{} umount -lf {}
zpool export -a

reboot
>>>