Restoring Manjaro Grub after Ubuntu upgrade

On a multi-boot Linux computer where Ubuntu has already been installed, adding on Manjaro Linux installs its own version of Grub (that I’ll call Arch-Grub) that is different but compatible with that previously installed (that I’ll call Debian-Grub).

Updating Ubuntu to a newer version (or installing an older version) restores Debian-Grub, replacing the working Arch-Grub.  This will result in Debian-Grub showing both Ubuntu and Manjaro as options on booting.  Choosing Ubuntu from Arch-Grub works just fine.  However, choosing Manjaro from Debian-Grub will lead to a black screen with messages, e.g.:

… Failed to execute /init (error -13)
… Starting init: /sbin/init exists but couldn’t execute it (error -13)
… Starting init: /bin/init exists but couldn’t execute it (error -13)
… Starting init: /bin/sh exists but couldn’t execute it (error -13)
… Kernel panic – not syncing: No working init found. Try passing init option to kernel …

… —[ end Kernel panic – not syncing: No working init found …

Kernel Panic after upgrade

“Kernal Panic after upgrade” as reported by ben1 in December 2017

On my Thinkpad X200, the only way to exit this screen was to pull the battery for a cold reboot.

The reason that Arch-Grub is different from Debian-Grub is that it loads Intel microcode before the OS, rather than inside the OS.

Manjaro will load intel-ucode using grub.
Unlike other OS’s, it is not built into initd (initramfs) nor into kernel.
But it will load this separately (first) from /boot/intel-ucode.img

But don’t worry about this. It will be done automatically for you when you install or boot Manjaro (provided you use Manjaro’s bootloader (grub) as default bootloader).

… says gohlip | “Does manjaro supply intel microcode automatically?” | May 2016 at https://forum.manjaro.org/t/does-manjaro-supply-intel-microcode-automatically/646/2

Thus, Arch-Grub does more work than Debian-Grub.  Arch-Grub will successfully start Ubuntu (based on Debian), but Debian-Grub will not successfully start Manjaro (based on Arch).  The resolution is to replace Debian-Grub with Arch-Grub to the multiboot system.

gohlip suggests seven ways to fix this …

1. chroot from livecd (which you’re aware of, I think)
2. use this method which does not need chroot or boot livecd but still make manjaro default boot
3. remove intel-code from manjaro OS but you’ll boot Manjaro without intel microcode enabled
4. …

The Intel microcode updates are theoretically desirable for patches, e.g. Spectre, but unfortunately the Core 2 Duo Penryn CPU I have isn’t one of the them, says “Intel finishes Spectre patching, some older CPUs won’t receive planned updates” | Brad Chacos | April 4, 2018 at https://www.pcworld.com/article/3268007/components-processors/intel-finishes-spectre-cpu-patches-cancels-update-plans.html

After digging into trying to remove the intel-ucode, I figured out it was simpler to just use a Manjaro install DVD (or USB) to restore the Arch-Grub. This then has to be done after every Ubuntu upgrade … but is relatively straightforward (and having a Manjaro install ISO burned onto a DVD means that it’s readily at hand).

Here’s a summary of the steps I’ve used:

  1. With Ubuntu running, use GPartEd to confirm which partition has Manjaro installed.  (In my case, it was sda11).
  2. Boot from the Manjaro install DVD or USB.
  3. When the menu appears, choose the LiveDVD option (rather than immediately (re-)installing Manjaro, which isn’t necessary).
  4. Open a terminal.
  5. Confirm the partition with Manjaro installed:
    $ sudo fdisk -l
    $ lsblk -f
  6. Mount the Manjaro system partition (mine was sda11):
    $ sudo mount  /dev/sda11  /mnt
  7. Reinstall Arch-Grub:
    $ sudo  grub-install  –boot-directory=/mnt/boot  /dev/sda

(That’s two hyphens preceding “boot-directory”)!

This method is consistent with the description of “Restore the GRUB Bootloader” at https://wiki.manjaro.org/index.php?title=Restore_the_GRUB_Bootloader for a BIOS (not UEFI) system.

While this procedure will have to be repeated after every Ubuntu upgrade, it’s understandable and replicable.

Advertisements

#arch, #boot, #debian, #dual-boot, #kernel-panic, #manjaro, #multiboot, #ubuntu