LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > zaivala
User Name
Password

Notices


Rate this Entry

Adventures In Boot

Posted 11-16-2020 at 08:06 AM by zaivala

This is an excerpt of my presentation in mintCast 333.5. I thought I had done this already; we're up to Episode 346 now. It does not cover ALL the bases but it should give someone a head start.

This report is not meant to be a Deep Dive so much as an I Want It Fixed NOW, How Do I Do It? We may be hearing from my other team members as I go along for more tips.

Cleaning up EFI

After many installations of different distros on my computer, I discovered that my EFI boot sector held a folder for each and every one of those distros, making for a lot of non-booting artifacts.

If you want to see what’s in your EFI, you can run efibootmgr in a terminal. Or you can install rEFInd, which will replace your current GRUB menu with an EFI graphical menu, which may help or further confuse you. I note there are icons for boot menus, Ubuntu distros, Mint (has the old logo), and a penguin logo for other Linuxes.

I was greatly confused by all of this. I won’t go through the long process I went through trying to understand the differences between EFI and GRUB, and also being sidetracked by friends who threw them both out and are using systemd-boot.

The final solution, proposed by Andreas in the Ubuntu Podcast Telegram group and refined by conversations with Londoner and cryptodan in the DHD group, is as follows:

Delete everything on your EFI menu (using efibootmgr). Then reinstall with grub-install with a key to writing it in the EFI partition.

Specifics:

using efibootmgr, you view and identify your EFI boots.
zaivala@zaivala-Galago-Pro:~$ efibootmgr
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0005,000A,0008
Boot0000* ubuntu
Boot0005* rEFInd Boot Manager
Boot0008* UEFI OS
Boot000A* openmandriva

zaivala@zaivala-Galago-Pro:~$
Then using sudo efibootmgr, delete each one:
zaivala@zaivala-Galago-Pro:~$ efibootmgr -b 0005 -B
Could not delete variable: Permission denied
zaivala@zaivala-Galago-Pro:~$ sudo !!
sudo efibootmgr -b 0005 -B
BootCurrent: 0000
Timeout: 1 seconds

BootOrder: 0000,000A,0008
Boot0000* ubuntu
Boot0008* UEFI OS
Boot000A* openmandriva

zaivala@zaivala-Galago-Pro:~$
Note that you must use sudo. My illustration showed what happens when you do not.

Continue until all are deleted.

Run efibootmgr again, and you will see how effective you were.
zaivala@zaivala-Galago-Pro:~$ efibootmgr
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000
Boot0000* ubuntu
zaivala@zaivala-Galago-Pro:~$
Then use:

sudo grub-install –target=x86_64-efi


If you get this warning…:
grub-install: warning: disk does not exist, so falling back to partition device /dev/sdb1
…then you forgot to use sudo

{NOTE: I have perused the man page for grub-install, and the –target switch is not shown. Thanks to Andreas on Ubuntu Podcast Telegram group for bringing it to my attention.)

Then you just run “sudo update-grub” to get all your boots back.
zaivala@zaivala-Galago-Pro:~$ update-grub
grub-mkconfig: You must run this as root
zaivala@zaivala-Galago-Pro:~$ sudo !!
sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Sourcing file `/etc/default/grub.d/60_mint-theme.cfg'
Generating grub configuration file ...
Found theme: /boot/grub/themes/linuxmint/theme.txt
Found linux image: /boot/vmlinuz-5.3.0-45-generic
Found initrd image: /boot/initrd.img-5.3.0-45-generic
Found linux image: /boot/vmlinuz-5.3.0-42-generic
Found initrd image: /boot/initrd.img-5.3.0-42-generic
Found linux image: /boot/vmlinuz-5.3.0-40-generic
Found initrd image: /boot/initrd.img-5.3.0-40-generic
Found linux image: /boot/vmlinuz-5.3.0-28-generic
Found initrd image: /boot/initrd.img-5.3.0-28-generic
Found linux image: /boot/vmlinuz-5.0.0-32-generic
Found initrd image: /boot/initrd.img-5.0.0-32-generic
Found Feren OS (18.04) on /dev/sda1
Found Ubuntu 16.04.6 LTS (16.04) on /dev/sda2
Found Ubuntu 18.04.4 LTS (18.04) on /dev/sda3
Found Zorin OS 15.2 (15) on /dev/sda4
Found OpenMandriva Lx 4.1 (4.1) on /dev/sdb3
Found linux image: /boot/vmlinuz-5.3.0-45-generic
Found initrd image: /boot/initrd.img-5.3.0-45-generic
Found linux image: /boot/vmlinuz-5.3.0-42-generic
Found initrd image: /boot/initrd.img-5.3.0-42-generic
Found linux image: /boot/vmlinuz-5.3.0-40-generic
Found initrd image: /boot/initrd.img-5.3.0-40-generic
Found linux image: /boot/vmlinuz-5.3.0-28-generic
Found initrd image: /boot/initrd.img-5.3.0-28-generic
Found linux image: /boot/vmlinuz-5.0.0-32-generic
Found initrd image: /boot/initrd.img-5.0.0-32-generic
Found Feren OS (18.04) on /dev/sda1
Found Ubuntu 16.04.6 LTS (16.04) on /dev/sda2
Found Ubuntu 18.04.4 LTS (18.04) on /dev/sda3
Found Zorin OS 15.2 (15) on /dev/sda4
Found OpenMandriva Lx 4.1 (4.1) on /dev/sdb3
Found Feren OS (18.04) on /dev/sda1
Found Ubuntu 16.04.6 LTS (16.04) on /dev/sda2
Found Ubuntu 18.04.4 LTS (18.04) on /dev/sda3
Found Zorin OS 15.2 (15) on /dev/sda4
Found OpenMandriva Lx 4.1 (4.1) on /dev/sdb3
Adding boot menu entry for EFI firmware configuration
done
zaivala@zaivala-Galago-Pro:~$
FIXING GRUB

You know that issue I’ve had with each successive installation taking over GRUB? Running grub-install as shown above, in the distro you want to have controlling GRUB, will fix this. [Note that some distros require you to run grub2-install]

If you’re installing a distro and don’t want it to take control of GRUB, and *if* it uses the Ubiquity installer common to many Ubuntu-based distros, our listener Londoner points out you can install by booting to the live disk, open a Terminal, and type “ubiquity –no-bootloader“. This will open a graphical Ubiquity installer but will not install GRUB as part of the process.
Posted in Uncategorized
Views 915 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 11:19 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration