LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-17-2017, 02:54 PM   #1
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Rep: Reputation: 1
Asking advise on UEFI boot loaders


Hello,

I'm familiar with installing Linux on machines with legacy bios.

I just got a new laptop with uefi bios. I created three partitions and installed several flavors on the machine just to learn how the UEFI system works. (I am not completely clear on every aspect of it yet)

I noticed that always the last distro's bootloader places itself into the UEFI partition loader.

My question is: Is there any chance of leaving the already existing bootloader in the boot partition but somehow booting the other distro from it without getting replaced with the fresh disto's bootloader all the time?

I read some arch wiki pages relating to this question but couldn't find any clear suggestions relating to this issue.

Thank you

Last edited by jozmak; 06-17-2017 at 02:56 PM.
 
Old 06-17-2017, 05:07 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,534

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
You should have an option on the secondary installs to install the bootloader to the partition on which you are installing it. You would then boot into the original system whose bootloader you were using and run the grub-mkconfig or update-grub command to add the new install to the boot menu.
 
Old 06-17-2017, 05:38 PM   #3
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by yancek View Post
You should have an option on the secondary installs to install the bootloader to the partition on which you are installing it. You would then boot into the original system whose bootloader you were using and run the grub-mkconfig or update-grub command to add the new install to the boot menu.
Apparently, that method is not working anymore.

This is what arch wiki says:

"First, tell GRUB to use UEFI, set the boot directory and set the bootloader ID. Mount the ESP partition to e.g. /boot or /boot/efi and in the following change esp_mount to that mount point (usually /boot):"
Code:
# grub-install --target=x86_64-efi --efi-directory=esp_mount --bootloader-id=grub
"You might note the absence of a <device_path> option (e.g.: /dev/sda) in the grub-install command. In fact any <device_path> provided will be ignored by the GRUB install script, as UEFI bootloaders do not use a MBR or partition boot sector at all."
 
Old 06-17-2017, 09:18 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,139

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
Not the issue it used to be with BIOS. Each new system adds an entry to the EFI NVRAM on the motherboard. What you are seeing is the (Linux) installer setting the latest install as the default entry - all the others are still there. You can change the default entry from a Linux terminal easily using efibootmgr.
 
Old 06-18-2017, 10:05 AM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,534

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
The method I mentioned in my previous post is what I used last week to install and boot two different Linux distributions with the second install putting it's boot files on the / partition, rebooted the first Linux and updated Grub and was able to boot both. This is also my first experience with UEFI so I'm sure there are other and probably better ways to do it.
 
Old 06-19-2017, 02:49 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,996

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
"last distro's bootloader places itself into the UEFI partition loader"

Tell the installer not to do any loader. Then fix the loader later. Many well designed advanced installers have options for almost every situation. Generally people use some default installer. Text based is one term that usually brings up features.
 
Old 06-20-2017, 05:52 AM   #7
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Quote:
Originally Posted by jozmak View Post
My question is: Is there any chance of leaving the already existing bootloader in the boot partition but somehow booting the other distro from it without getting replaced with the fresh disto's bootloader all the time?
Hi, the answer is yes.

With BIOS, the system was simpler, but you could only install one bootloader at a time. As we know, the last distro replaced anything in MBR by its own bootloader.

However, with UEFI it is completely different. The hard disk filesystem itself is different and the EFI partition is much much larger than MBR. This was mainly done to accomodate drivers, but the EFI partition can be used to host all your bootloaders. If you have Windows and 2 Linux distros, you can have a bootloader for each one of them on the EFI partition.

Now, how does your computer know what to boot? Simple, every bootloader is in the form of an EFI binary (.efi file) which is registered in the UEFI firmware settings (BIOS basically). That is, somewhere in the BIOS, the computer keeps track of the bootloaders present on the EFI partition and their boot priority, i.e. which one to boot by default.

So, you can have the Windows bootloader (usually Microsoft/Boot/bootmgfw.efi), a GRUB for one distro (e.g. ubuntu/grubx64.efi), another GRUB for a second distro (e.g. Linux/grubx64.efi), or LILO for yet another distro (e.g. Slackware/elilo.efi), and so on ...

The key is to have your EFI binary registered in the UEFI firmware settings. You can check this by using
Code:
# modprobe efivarfs
# modprobe efivars
# efibootmgr -v
It will also give you the order of boot. Normally you can see this list of option at boot if you press one of the Fn keys (e.g. F12, whatever it is on your machine).

On some machines you can change the boot order inside the BIOS itself. But in order to register EFI binaries you need efibootmgr.

If you want more information, I invite you to read the man pages for efibootmgr. You can also check out: https://docs.slackware.com/howtos:sl...d_on_slackware
This page describes the installation and use of rEFInd, which is a bootloader manager. Yes, you can go as far as installing a program on the EFI partition which will chainload your different bootloaders. I'm not telling you to install refind, I just recommend you read that page to learn a bit about how UEFI works; there are also useful commands in there in case you're multi-booting. It also explains how to register an EFI binary under section "rEFInd Manual Install".

Last edited by aragorn2101; 06-20-2017 at 05:59 AM.
 
1 members found this post helpful.
Old 06-20-2017, 07:22 AM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,534

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
Quote:
With BIOS, the system was simpler, but you could only install one bootloader at a time
You could install as many bootloaders as you want to as many partitions as you want with the older MBR system but only one to the MBR, that's correct.

Quote:
As we know, the last distro replaced anything in MBR by its own bootloader.
No, that's not true. That was only if you accept the default on the install but every Linux I've installed always gave an option
 
1 members found this post helpful.
Old 06-21-2017, 12:24 AM   #9
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Quote:
Originally Posted by aragorn2101 View Post
As we know, the last distro replaced anything in MBR by its own bootloader.
Quote:
Originally Posted by yancek View Post
No, that's not true. That was only if you accept the default on the install but every Linux I've installed always gave an option
Yes yes, you're right. Sorry for that mistake. Now I remember, all the distros I installed as well offered the option to install the bootloader or not. Then we can have one distro's GRUB in the MBR and we manage to boot all the other distros with it.

Thanks for the precision yancek.

Last edited by aragorn2101; 06-21-2017 at 12:38 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mobo only supports uefi boot - how do I boot off a non-uefi cd? Ulysses_ Linux - Hardware 3 02-25-2016 08:06 PM
Can't get dual boot, win 7 uefi and elementary freya os uefi working shywolf Linux - Newbie 4 12-10-2015 06:14 PM
Boot Camp (fixing boot loaders, learning your way around boot & chainloaders) Siljrath Linux - General 8 01-20-2015 11:00 AM
Can I have 2 different Linux boot loaders installed in 1 /boot partition? Wiking Linux - Newbie 12 12-04-2011 01:40 PM
boot loaders 5amYan Linux - General 2 04-25-2002 09:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:13 AM.

Main Menu
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