You are not logged in.

#1 2018-05-20 10:34:12

kaprikawn
Member
Registered: 2011-09-23
Posts: 25

Ubuntu upgrade hijacked boot loader

I have a dual boot with Arch and Ubuntu.  I use systemd-boot as my Arch boot loader.  I've updated my Ubuntu install from the last LTS to the recent one and now my system loads Ubuntu's Grub instead of systemd-boot which I don't want.

Following the systemd-boot wiki entry, I've first I tried

[wayne@arch boot]$ sudo bootctl update
[sudo] password for wayne: 
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/systemd/systemd-bootx64.efi".
Skipping "/boot/EFI/BOOT/BOOTX64.EFI", since it's owned by another boot loader.

I assume the problem is that /boot/EFI/BOOT/BOOTX64.EFI is what is loading Ubuntu/Grub, so I tried

sudo efibootmgr --create --disk /dev/sda3 --part 1 --loader /boot/EFI/systemd/systemd-bootx64.efi --label "systemd bootloader" --verbose

This outputs

efibootmgr: ** Warning ** : Boot0003 has same label systemd bootloader
BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0008,0003,0005,0009,0007,0001,0002,0006,0000,0004
Boot0000* rEFInd Boot Manager	VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot0001* Hard Drive	BBS(HD,,0x0)..GO..NO........o.S.a.n.D.i.s.k. .S.D.S.S.D.P.1.2.8.G....................A...........................>..Gd-.;.A..MQ..L.3.1.1.4.3.6.0.4.0.1.0.7. . . . . . . . ........BO..NO........o.C.r.u.c.i.a.l._.C.T.5.2.5.M.X.3.0.0.S.S.D.1....................A...........................>..Gd-.;.A..MQ..L. . . . . . . . .7.1.7.4.9.1.8.C.6.9.6.D........BO..NO........o.C.r.u.c.i.a.l._.C.T.5.2.5.M.X.3.0.0.S.S.D.1....................A...........................>..Gd-.;.A..MQ..L. . . . . . . . .6.1.3.4.4.1.5.6.C.D.4.0........BO
Boot0002  grub	HD(1,GPT,1a604bf9-ad1c-4615-b353-07a043fd963e,0x800,0xfa000)/File(\EFI\GRUB\GRUBX64.EFI)
Boot0003* systemd bootloader	HD(1,GPT,1a604bf9-ad1c-4615-b353-07a043fd963e,0x800,0xfa000)/File(\BOOT\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI)
Boot0004* Linux Boot Manager	VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot0005* ubuntu	HD(1,GPT,1a604bf9-ad1c-4615-b353-07a043fd963e,0x800,0xfa000)/File(\EFI\UBUNTU\SHIMX64.EFI)
Boot0006  rEFInd Boot Manager	HD(1,GPT,1a604bf9-ad1c-4615-b353-07a043fd963e,0x800,0xfa000)/File(\EFI\REFIND\REFIND_X64.EFI)
Boot0007* Linux Boot Manager	HD(1,GPT,1a604bf9-ad1c-4615-b353-07a043fd963e,0x800,0xfa000)/File(\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI)
Boot0009* UEFI OS	HD(1,GPT,1a604bf9-ad1c-4615-b353-07a043fd963e,0x800,0xfa000)/File(\EFI\BOOT\BOOTX64.EFI)..BO
Boot0008* systemd bootloader	HD(1,GPT,1a604bf9-ad1c-4615-b353-07a043fd963e,0x800,0xfa000)/File(\boot\EFI\systemd\systemd-bootx64.efi)

As you can see, 'BootCurrent' is set to 0005 (Ubuntu).  The boot order looks correct, but it's still booting into Ubuntu/Grub by default, can someone advise me how to set it to boot systemd-boot please.

Offline

#2 2018-05-22 05:40:58

IrvineHimself
Member
From: Scotland
Registered: 2016-08-21
Posts: 275

Re: Ubuntu upgrade hijacked boot loader

Edit: Sorry, I didn't read the question properly and thought you were using grub.However, the basic technique of using a chroot to repair the damage from inside Arch is still sound. So just ignore any reference to grub and refer to the wiki page of your chosen boot-loader.

This is the reason why I stopped keeping a separate partition with either Fedora or Ubuntu, the are both equally as bad for failing to recognise the Arch boot loader.

If you have installed the arch-install-scripts then the solution is fairly straight forward.

If not:

  • [1.] You either need to build a chroot, or, better, using squashfs, extract arch-chroot from the installation media. Full details of how to do all of this can be found in this wiki page.
    [2.] From Ubuntu, drop whichever variety of chroot shell you decide to use into the Arch partition's /usr/bin

Now that you have your chroot you need to mount it. Again, full details are in the linked wiki page. However, I have had to do this so often, I keep abridged notes on doing it from an Xubuntu usb smile

From Xubuntu, I open a terminal and run the following:

  • [1.] sudo /media/xubuntu/Arch/usr/bin/arch-chroot /media/xubuntu/Arch/
    [2.] grub-mkconfig -o /boot/grub/grub.cfg

Note: You will need to edit the partitions and paths to suite your environment. Similarly, if you've decided to write your own chroot shell, you will need to change the arch-chroot to whatever is appropriate.

Any way, you should now be able to boot into either Arch or Ubuntu. If not, you need to go back into the chroot environment and run the grub-install command. You can find full details on the wiki

Like I say, for this problem, you should not have to do this step. But my notes, with the usual caveat about paths and partitions,  are as follows:

  • [1.] sudo /media/xubuntu/Arch/usr/bin/arch-chroot /media/xubuntu/Arch/
    [2.] mount /dev/sda1 /boot/efi
    [3.] grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub
    [4.] grub-mkconfig -o /boot/grub/grub.cfg

WARNING: My notes are only my own personal notes. You need to read the linked Wiki pages.

All the best,
Irvine

Ps:
If, after this, you decide to install the arch-install-scripts, then, since it won't have been installed by pacman, you will first need to remove the copy of arch-chroot which you placed in /usr/bin
Irvine

Last edited by IrvineHimself (2018-05-22 05:48:19)


Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!

Offline

Board footer

Powered by FluxBB