2

I'm able to reinstall grub using default boot-loader ID "ubuntu"

But if I use custom name like "MyUbuntu" I cannot make a successful grub installation.

Test installation on a well-booting Ubuntu 18.04:

1: Delete existing grub:

rm -r /boot/efi/EFI/*

2: Install new grub:

grub-install --target=x86_64-efi --bootloader-id=MyUbuntu /dev/sda

2: Update grub:

update-grub

System now boots into the Grub console. The EFI was seeing the new boot entry in the boot menu just fine.

enter image description here enter image description here

Just took a peak into the /boot/grub/grub.cfg, it still says: menuentry 'Ubuntu' --class ubuntu.....

  • I have a custom entry, but it really does not work as UEFI entry really uses /EFI/ubuntu/grub.cfg not my /EFI/Ubuntu_18_04/grub.cfg. So I only have one working UEFI entry and have to edit the grub.cfg in the ESP if I want to change default boot. And then I use grub to boot other installs. – oldfred Mar 28 '19 at 2:10
  • So is it a bug or by design? – MrCalvin Mar 28 '19 at 19:22
  • It is by design, but developers have for several years said they want to fix it. Obviously not a priority. – oldfred Mar 28 '19 at 20:28
  • Any workarounds? I need to have a non-default EFI folder? Been looking in the .cfg file but it didn't get me anywhere? – MrCalvin Mar 28 '19 at 20:47
  • I believe I saw someone who had two FAT32 formatted partitions and moved boot flag back & forth, changing which was ESP. But grub can boot any install you want either directly, chainload or configfile (load another grub). – oldfred Mar 28 '19 at 22:32
2

After I ran into systemd-boot as boot-loader I've never looked back at GRUB. systemd-boot, is in my view, way more stable and has a much better way of configuration. And by "stable" I mean it's not as vulnerable as GRUB. GRUB is so easy to break. Just adding a new disk to your box can give you big trouble (because of maybe identical boot-loader ID's that you cannot change etc.)

Only downside of systemd-boot is the lack of secure-boot support, but that's not an issue for me, and that your kernel must be located in the EFI partition, instead of root partition, as it is the case with GRUP.

With systemd-boot I got back full control of the boot-process...YES

It should be the default boot-loader instead of GRUB.

UPDATE, How to do (Debian/Ubuntu):
(This is a rather superficially guide, but I hope it will get you started. Other sources: Arhlinux.., freedesktop.. and readme..)

1: First copy the kernel files from you root partition, e.g. /boot/vmlinuz-4.9.0-8-amd64 and /boot/initrd.img-4.9.0-8-amd64, to your EFI partition. You can place them in a subfolder of your choice or even in root-folder if you like.

2: Many guides says you need access to the EFI variables, but I'm not sure if this is needed. But to test if you have, run efivar --list.
To Install if missing: apt install efivar

3: Install systemd-boot loader to the EFI partition: bootctl --path=/mnt/efi install (use you own path to your mounted EFI partition)

4: Edit the file /mnt/efi/loader/loader.conf to something like:

timeout 5
# default 6a9857a393724b7a981ebb5b8495b9e-*

(haven't figured out how to use the auto-added UUID in the file, so I just marked it out)

5: Each file in /mnt/efi/loader/entries/*.conf correspond to at boot-entry in the systemd-boot menu. So to add your current OS make a file looking something like:

title      Debian 9 :-)
linux      /debian9/vmlinuz-4.9.0-6-amd64
initrd     /debian9/initrd.img-4.9.0-6-amd64
options    root=UUID=084917b7-8be2-4e86-838d-f771a9902e08`

(Modify the path to the kernel files you copied in step 1. Modify the UUID to the filesystem-UUID of you root partition (use Linux command lsblk -o name,uuid)

General info:
bootctl will install two bootloader-files in your EFI partition:

../BOOT/BOOTX64.EFI
../systemd/systemd-bootx64.efi

These files are identical. Your EFI bios on your motherboard moust boot/point to one of them. Either do it in the BIOS directly or use the Linux command efibootmgr....

To add a new boot entries just create a new /mnt/efi/loader/entries/*.conf files which point to the right kernel files and root partition.

The kernel files MUST be located on the EFI partition (FAT32).
The EFI partition must be sized accordingly. I think the kernel files for e.g. Debian/Ubuntu is about 50-60MB. So if you have two installations you need 120MB.

  • I agree.....just limited time right now, but I'll add how in short words so people can get started – MrCalvin Apr 21 '19 at 12:00
  • I even did it on a USB flash. It has often been trouble full with GRUB. Now it should be easy to make an bootable USB key with multiple installation OS: Win10, WinSrv, Debian, Arch, Ubuntu etc.I always have my bag full of individual USB keys for each OS, now I can have one with good performance Mushkin Impact 64GB USB 3.0 (> 100MBs :-)) – MrCalvin Apr 21 '19 at 14:00
  • You can boot which ever Linux you like (You "normal" ubunto on HDD, Live for USB, any whould do. It doesn't even have to be the same distro. I assume all have the systemd-boot package available. You don't have to do all the painful chroot-thing as with GRUP. Just copy the kernel-files to EFI, install systemd-boot, modify/create the text-files, point EFI-bios to the need bootloader file....that's it :-) – MrCalvin Apr 22 '19 at 9:36
  • I doesn't matter, just boot any Linux. But if you boot from a USB you have to mount the EFI and root partition on the HDD to be able to access it. But if you boot your installed Ubuntu the EFI partition is already mounted to /boot/EFI. – MrCalvin Apr 22 '19 at 9:49
  • Nice :-) What error did you get? And which file did you point add for Win10...haven't tried that myself yet – MrCalvin Apr 24 '19 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.