K.S. Bhaskar on 14 Jul 2016 08:06:30 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Making a UEFI partition bootable after an upgrade

The magic was to set configfile on the grub minimal shell to point (hd0,gpt2)/boot/grub/grub.cfg and boot into the Ubuntu 14.04 partition, then do update-grub followed by grub-install. Now I'm booted into 14.04 from where I can do further troubleshooting / repair.

-- Bhaskar

On Thu, Jul 14, 2016 at 9:26 AM, K.S. Bhaskar <bhaskar@bhaskars.com> wrote:
I have a PC with UEFI that is unbootable after an Ubuntu 14.04 to 16.04 upgrade.

First, I should explain how I set up PCs. I have two root partitions, let me call them A & B. When A is booted, it mounts B as /spare, and when B is booted, it mounts A as /spare.The goal is to enable safe upgrades as follows, assuming that the system is running with A booted:
  • rm -rf /spare/*, and clone / to /spare/ with a command such as rsync -auvx --sparse / /spare/ (I usually also need --exclude=lastlog and then manually copy it with cp -av --sparse=always /var/log/lastlog /spare/var/log/, but that's incidental, and not a core part of the technique).
  • ​Edit /spare/etc/fstab to swap the UUIDs of / and /spare (so that when B is booted, it mounts A as /spare).
  • ​R​
    un update-grub, and edit /boot/grub/grub.cfg (when B boots, I want boot the root and boot image to come from B, and this requires some manual editing of the os-prober section of grub.cfg generated by update-grub). I save the file.
  • E​
    dit the grub.cfg to swap the UUIDs and partitions between A and B, and save as /spare/boot/grub/grub.cfg.
  • ​Reboot the machine (which brings up the grub.cfg from A) and manually boot into B as root.
  • ​U​
    pgrade B (typically using do-release-upgrade -d). If at any point, the upgrade fails, I just reboot, and the machine boots by default into A because neither the bootloader nor partition A have been touched.
  • As the last step of the upgrade is to install a new boot loader, once the upgrade completes, rebooting by default boots B.

This has been my standard configuration and technique for perhaps 10 years, perhaps longer, and this belt-and-suspenders technique has always worked… until yesterday when I tried it on a machine with A booting via UEFI rather than legacy boot (someone else did the original install; I have always installed with legacy boot).

After starting with Ubuntu 14.04 on A, I cloned to B, booted B and upgraded it to 16.04. The upgrade appeared to be successful, but when booting it now takes me to the minimal shell and I am not sure what to do next. If I try a legacy boot, it says there is no bootable partition.

Where did I go wrong, and more importantly, how do I fix it? I am able to UEFI boot it with live CD images on USB drives - both Kubuntu 16.04 and System Rescue boot, and would presumably be one path to fixing it (the minimal shell would be the other).

Thank you very much, in advance.

-- Bhaskar

Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug