LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-29-2017, 07:35 AM   #1
thinkpadboi
LQ Newbie
 
Registered: Jun 2017
Location: USA
Distribution: Fedora
Posts: 23

Rep: Reputation: Disabled
Better bootloader options for a UEFI based system?


I've been using GRUB for years and it's always worked fine for what I wanted to do (dual boot one install of linux and Windows on a BIOS based system.) However, with my new computer I've run into some issues managing my bootloader. I'm dealing with some issues related to a recent kernel upgrade, so I've been compiling a lot of kernels lately and switching between 3 distros plus a Windows 10 install. Every time I install a new kernel on a distro that doesn't "own" GRUB, I have to boot into the other distro and run 'sudo update-grub' to add it to the list.

I have heard about systemd-boot/gummiboot and rEFInd but I haven't been able to find much info about how they manage this. It would be ideal if my bootloader could either a. auto detect the kernels and generate a boot list on every startup, or b. at least be able to be updated from any linux OS I'm running so I don't have to boot into my other install and reboot again. Is anyone running these bootloaders? Is it worth it?

Last edited by thinkpadboi; 06-29-2017 at 07:36 AM.
 
Old 06-29-2017, 11:09 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,499
Blog Entries: 19

Rep: Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410
A lot depends on whether your UEFI gives you a nice boot menu. If it does, you don't need rEFind. You might not even need grub. Linux kernels are self-booting in UEFI if you put them on the efi system partition and have efi stubs set.

Here's something I found on the Arch wiki.

Last edited by hazel; 06-29-2017 at 11:16 AM.
 
Old 06-29-2017, 03:13 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,937

Rep: Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619
Guess you could chain load and put each loader in with each distro.

There have been all sorts of multiboot manangers but haven't seen but a few for uefi. As I understand it you could create a special uefi setting for your system. I suspect that will be next big thing if uefi ever gets settled.
 
Old 06-30-2017, 06:59 AM   #4
thinkpadboi
LQ Newbie
 
Registered: Jun 2017
Location: USA
Distribution: Fedora
Posts: 23

Original Poster
Rep: Reputation: Disabled
My laptop does give a basic menu for EFI booting, but I sometimes like to mess with kernel parameters, etc. so I would really like to go with a proper bootloader that's designed for linux. If I went with rEFInd, it will only automatically find the kernels if I keep them all in the EFI system partition then? If so, would I have to add something to /etc/kernel/postinst.d/ to automatically copy them there? And, currently, that partition on my computer is only 200MB, so I assume I would have to expand it a lot. Will Windows 10 freak out if I do that?
 
Old 07-02-2017, 08:31 AM   #5
penguin404
LQ Newbie
 
Registered: Jul 2017
Posts: 8

Rep: Reputation: Disabled
who needs chainloding or customization of bootloder in a uefi-bios? you can just simply boot the partition from bios...simple as that
 
Old 07-05-2017, 08:48 PM   #6
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
Quote:
Every time I install a new kernel on a distro that doesn't "own" GRUB, I have to boot into the other distro and run 'sudo update-grub' to add it to the list.
No you don't need to do anything like this at all. You only need to load the config files of the other two distros that don't 'own' grub from the grub installation that controls the booting. Each distro has its own config file and list of kernels. Each of these config files is simply referred to by a custom target in the 40-custom file.

I have a dual boot Centos 7/ Fedora 24 system. The Centos 7 grub loads the config file of the Fedora 24 installation.

In /etc/grub.d/40-custom

Code:
menuentry "Fedora 24 using grub2 configfile" {
   insmod ext2
   insmod part_gpt
   search --no-floppy --fs-uuid --set=root e52b5567-e0eb-4ac6-93d3-6fd86d8043b1
   configfile /grub2/grub.cfg
}
You would just add targets for the other two distros in the distro that controls the booting and then disable os-prober. When you select one of those targets the config file for that distro will appear. If you press Esc before the timer expires you will be back in the original config at the top level.

Your maintenance problem could be solved in an hour or so.

You don't need a better bootloader at all. You just need to understand and use the power of the one you are already using.
 
1 members found this post helpful.
Old 07-05-2017, 08:57 PM   #7
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
Quote:
who needs chainloding or customization of bootloder in a uefi-bios? you can just simply boot the partition from bios...simple as that
First some corrections:

chainloding -> chainloading
bootloder -> bootloader
uefi-bios -> UEFI firmware, if you have UEFI firmware you don't have a BIOS

Who the hell would want to go into their firmware every time they wanted to boot a different OS ? Lazy but not simple as it gets quite tiring.
 
1 members found this post helpful.
Old 07-06-2017, 03:02 AM   #8
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Quote:
Originally Posted by thinkpadboi View Post
... It would be ideal if my bootloader could either a. auto detect the kernels and generate a boot list on every startup, or b. at least be able to be updated from any linux OS I'm running so I don't have to boot into my other install and reboot again ...
To be honest, rEFInd does work like this. It will detect the kernels on your drive. But it quickly becomes a bit messy. You see, rEFInd displays an icon for every instance it can boot, whether it is an efi binary or a kernel on the EFI partition or kernels somewhere on the drive. If it does not know the system it will display a Tux icon for any Linux or if it detects 3 different kernels on a partition it will probably display the same icon for all three of them.

I personally tried rEFInd and configured it manually so that I can control the number of icons displayed per system and the boot options, etc.

You can try it if you wish and see for yourself. This is the advantage of UEFI. You have a large enough EFI partition and you can experiment with many bootloaders and boot managers.

So check these out:
http://www.rodsbooks.com/refind/
https://docs.slackware.com/howtos:sl...d_on_slackware
 
1 members found this post helpful.
Old 07-06-2017, 05:07 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
Quote:
Originally Posted by tofino_surfer View Post
Who the hell would want to go into their firmware every time they wanted to boot a different OS ? Lazy but not simple as it gets quite tiring.
Might not have an option.
I have a EFI system that has Win10 on MBR and (several) Linux on gpt. Cannot be accessed from the same menu. Period.
 
Old 07-06-2017, 05:31 AM   #10
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,330

Rep: Reputation: 1579Reputation: 1579Reputation: 1579Reputation: 1579Reputation: 1579Reputation: 1579Reputation: 1579Reputation: 1579Reputation: 1579Reputation: 1579Reputation: 1579
I use rEFind, but as aragorn2101 posted it can get messy.
 
Old 07-06-2017, 05:49 PM   #11
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
Quote:
Might not have an option.
I have a EFI system that has Win10 on MBR and (several) Linux on gpt. Cannot be accessed from the same menu. Period.
Even is such cases you still do have other options. It just requires a little bit of work. There is no need to have all OSs be in the same menu. What you need to do is install a dedicated Linux bootloader on the MBR disk. You can create a dedicated grub partition on the MBR disk that has the grub2 system in an ext4 filesystem and a config file that points to all of the Linux installations on other disks. You can also use syslinux (extlinux) for this purpose as it may be easier to install to a partition.

If I understand the issue correctly it is in order to boot Win10 on MBR the UEFI firmware must be in CSM mode during which it can't recognize GPT partitions. Having a Linux bootloader on the same MBR disk will solve this problem. The top level menu possibly created with BCDEdit will have two options, Win 10 and Linux Grub2. Once Grub2 is loaded in memory and running it controls the hardware. It has modules for GPT partitions and extn filesystems among many other things. The capabilities of the firmware wouldn't matter at this point.

You would manually create 5-6 line targets as I have shown by using the filesystem UUIDs of the /boot or / root partitions of the various Linux installations on the GPT disk and load their config files using the configfile command .

You would only need to create about 50 MB of space on the MBR disk as there wouldn't be any kernels or initrds on this dedicated Grub2 partition, just the Grub2 system and the config file. I would create two partitions, one small 1 MiB and one about 50MiB. The small one may be needed for the grub2 core.img second stage.
 
Old 07-07-2017, 07:47 PM   #12
thinkpadboi
LQ Newbie
 
Registered: Jun 2017
Location: USA
Distribution: Fedora
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thank you tofino_surfer for the detailed answers. I did end up trying rEFInd, but I'm not entirely sure I like it enough to replace GRUB. It automatically found all my kernels in their respective partitions which was nice though. I will probably keep it as #2 in efibootmgr in case I irreparably mess up GRUB, then I can still boot into rEFInd from my UEFI menu. I was able to get the custom entries working (I'll post about that shortly) but I have another question about the long term feasibility of this setup.

Originally, my Mint install was in charge of GRUB. Then I installed rEFInd and messed around with that. A few days ago I installed updates in Xubuntu and GRUB updated. Xubuntu's GRUB took over the bootloader AND put itself in front of rEFInd in the efibootmgr list. So:
  • Is that something related to post installation triggers, and can I do anything about it? I don't really want to have 3 linux installs playing tug of war with the bootloader every time something changes.
  • I noticed /boot/efi/EFI/ubuntu/grub.cfg now points to the Xubuntu partition to look for its grub.cfg. Is it possible that it overwrote Mint's information here because they are both "Ubuntu"?
    Code:
    search.fs_uuid b20dee12-e836-4b2b-9fb0-f70f0d13ef3e root hd1,gpt5
    set prefix=($root)'/boot/grub'
    configfile $prefix/grub.cfg
 
Old 07-07-2017, 08:53 PM   #13
thinkpadboi
LQ Newbie
 
Registered: Jun 2017
Location: USA
Distribution: Fedora
Posts: 23

Original Poster
Rep: Reputation: Disabled
Ok, here's what I did in case it helps anyone. This is the annotated output of sudo blkid on my system. /dev/sdb is all my operating systems and ESP, and /dev/sda is swap and data.

Code:
Data
/dev/sda1: UUID="2dd6259a-60eb-44e1-be31-4d9e6aba1aa4" TYPE="ext4" PARTUUID="19cbe00f-afbd-474c-ad12-94e6ab4df810"

swap
/dev/sda2: UUID="ac78e303-682d-4118-b049-80c895fbf89f" TYPE="swap" PARTUUID="82a60f39-10e1-4842-9a03-8886bd5240ff"

Mint
/dev/sdb1: UUID="58580ed6-ec85-4ecd-9596-a08daea18aac" TYPE="ext4" PARTUUID="253d58dd-4931-41aa-a2a7-48b633e2094d"

"Microsoft Reserved Partition" 16MB 
/dev/sdb2: UUID="58580ed6-ec85-4ecd-9596-a08daea18aac" TYPE="ext4" PARTLABEL="Microsoft reserved partition" PARTUUID="2c9d33c6-70a9-429c-9721-d0a4507c0a53"

ESP
/dev/sdb3: UUID="30CA-5233" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="fc337c64-afc1-4c88-b944-b5deaf91b801"

Windows 10 (bitlocker)
/dev/sdb4: PARTUUID="3c7434ea-1188-4177-affa-2cdb9b4e6bee"

Xubuntu
/dev/sdb5: UUID="b20dee12-e836-4b2b-9fb0-f70f0d13ef3e" TYPE="ext4" PARTUUID="da68f643-0d66-441c-b386-aa0f11ed3432"

Fedora
/dev/sdb6: UUID="3deef125-9d40-49ec-a5f7-8a32fc8e755e" TYPE="ext4" PARTUUID="dc45f0cf-72e0-41a6-96c8-7662829deaee"

Here's what I added to /etc/grub.d/40-custom. I had to copy the various hints from the autogenerated entries from os-prober (in Xubuntu's /boot/grub/grub.cfg file) to get it to work. I don't really know why, but I'm sure the reasons will be demystified after I check out the GRUB manual. It seems weird to me that this works with "insmod ext2" when they are all ext4 partitions, but at least it works. Fedora keeps its grub.cfg in the EFI system partition instead of its /boot directory for some annoying reason. Luckily I had the example from the Windows 10 entry where it mounts the ESP, so I modeled it after that. Note that the Win10 entry is a chainloader to the actual Windows bootloader.

Code:
menuentry "Linux Mint config" {
   insmod part_gpt 
   insmod ext2 
   set root='hd1,gpt1' 
   search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt1 --hint-efi=hd1,gpt1 --hint-baremetal=ahci1,gpt1  58580ed6-ec85-4ecd-9596-a08daea18aac
   configfile /boot/grub/grub.cfg
}

menuentry "Fedora 25 config" {
        insmod part_gpt
        insmod fat
        set root='hd1,gpt3'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  30CA-5233
        else
          search --no-floppy --fs-uuid --set=root 30CA-5233
        fi
        configfile /EFI/fedora/grub.cfg
}

menuentry "Windows 10" {
        insmod part_gpt
        insmod fat
        set root='hd1,gpt3'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  30CA-5233
        else
          search --no-floppy --fs-uuid --set=root 30CA-5233
        fi
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

Last edited by thinkpadboi; 07-07-2017 at 09:07 PM.
 
Old 07-09-2017, 03:34 PM   #14
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
Quote:
Might not have an option.
I have a EFI system that has Win10 on MBR and (several) Linux on gpt. Cannot be accessed from the same menu. Period.
Even though I posted a fairly complex solution in post #11 (but perhaps unnecessary) to the undescribed problem by syg00 in post #9 the above comment makes no sense with Linux. There is absolutely no issue with using legacy BIOS together with GPT partitioning on Linux. This is called a BIOS/GPT boot. I have been doing this for over five years. My Gigabyte MB has a legacy BIOS. Both my old and new SSDs are formatted GPT. My newer SSD is a dual boot arrangement with Centos 7 and Fedora 24. It is actually easier to set up multiple boot with GPT and legacy BIOS using grub2 than with ancient MBR due to newer versions of grub2 having issues with installing to a partition.

All GPT formatted drives have a protective MBR to prevent older tools from seeing the drive as empty. The first 440 bytes of this protective MBR can be used to point to the second stage of a legacy BIOS bootloader. This can even be done even if there is an ESP partition as well. There is no problem having both UEFI and legacy BIOS bootloaders on the same disk. In fact all newer live ISOs are dual mode. They have both an /EFI directory for UEFI systems and typically use syslinux (isolinux) for supporting legacy BIOS systems.

The major difference between BIOS/GPT and BIOS/MBR is that with BIOS/GPT a 1 MiB partition called a BIOS Boot partition is required as a place for the core.img grub2 second stage. This is due to the fact that there is no "MBR gap" in which to place the core.img grub2 second stage with GPT formatting. However this requirement makes it easier to set up multi-boot systems than with MBR partitions.

Therefore since you can install legacy BIOS bootloaders on GPT formatted disks if you had a Win10 installation on an MBR disk they should both be visible in legacy CSM mode.
 
Old 07-09-2017, 07:56 PM   #15
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
Quote:
A few days ago I installed updates in Xubuntu and GRUB updated. Xubuntu's GRUB took over the bootloader AND put itself in front of rEFInd in the efibootmgr list. Is that something related to post installation triggers, and can I do anything about it? I don't really want to have 3 linux installs playing tug of war with the bootloader every time something changes.
You need to update the grub.cfg config file each time a new kernel is added without updating or reinstalling the grub bootloader itself. Try running grub2-mkconfig by itself. If you don't want a distro to control grub then you only need to update the config file which is referenced.

Quote:
I noticed /boot/efi/EFI/ubuntu/grub.cfg now points to the Xubuntu partition to look for its grub.cfg. Is it possible that it overwrote Mint's information here because they are both "Ubuntu"?
Yes it is possible. It happens with Fedora all the time. It doesn't matter if its Fedora 22 or 23 or 24 or 25 the installer always names the EFI directory Fedora. This of course causes problems with users who want a multiple boot system and keep the previous installation around.

If the Mint installation was also installed in directory ubuntu this could have happened. If this is happening you may need to create unique subdirectories manually and copy files.

Quote:
It seems weird to me that this works with "insmod ext2" when they are all ext4 partitions, but at least it works
The grub boot process is totally read-only. No files are modified. The main difference between ext2 and ext3/ext4 is that ext3/4 are journaling filesystems. When simply reading ext3/4 files no journaling needs to be done so the ext2 module with a few modifications (presumably to skip over the journaling info and not be confused by it) also supports ext3 and 4.

The original grub now called grub-legacy only supported reading ext2. Grub2 supports ext[234].

Last edited by tofino_surfer; 07-10-2017 at 03:10 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
CLFS UEFI bootloader, updating, and changing kernel to linux-libre Z4kW0lf Linux From Scratch 11 12-19-2012 02:47 PM
bootloader options ieuuk Mandriva 2 08-17-2004 11:09 AM
Mandrake 10. Bootloader options joshy Mandriva 2 08-05-2004 08:16 AM
bootloader options rcerrillo Linux - Software 2 03-07-2004 05:16 PM
RH 8.0 Grub bootloader options VioLaToR Linux - Distributions 1 11-21-2002 04:32 PM

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

All times are GMT -5. The time now is 03:15 PM.

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