[SOLVED] Adapting to the new world of EFI/GPT

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
leehach
Level 1
Level 1
Posts: 47
Joined: Tue Jun 26, 2012 1:42 am

[SOLVED] Adapting to the new world of EFI/GPT

Post by leehach »

I know a lot of people have been asking questions about EFI and GPT. I've read several questions and my head is spinning. I've installed Ubuntu or Linux Mint on several computers in the last few years, but I can't wrap my head around this change.

I have a new HP Pavilion g4 with Win8. I want to blow away the Win8 partition and install Linux Mint 13 in its place, *but* I would like to preserve the WinRE partition and the HP Recovery partition, so that I can recreate a factory-new computer. I don't know if this is possible or worth the effort. The current Win8 installation is Secure Boot and EFI on a GPT HDD. I've already configured BIOS to disable secure boot and to allow Legacy boot. Now I can at least boot from my Linux Mint USB. Questions:

1) I read that Linux and Windows must either both be EFI or both be BIOS. But if I'm getting rid of Win8 (just preserving the recovery partitions), do I have to install Linux Mint in EFI mode?

2) Is there any advantage to using EFI (other than secure boot, which I have already disabled)?

3) Do I need a specific version or remix of Linux Mint (or Ubuntu) to install using EFI?

4) If I am *not* using EFI, can I install Linux Mint to the GPT hard drive, or do I have to convert the hard drive to MBR first? (http://commandlinewani.blogspot.com/201 ... -vaio.html)

5) Does installing to the GPT hard drive require a specific version or remix of Linux Mint?

Pointers to a solid guide would be invaluable. I have found some of this information out there--hopefully enough to format intelligent questions--but am having trouble assimilating it.

Best,
--Lee
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
srs5694
Level 6
Level 6
Posts: 1386
Joined: Mon Feb 27, 2012 1:42 pm

Re: Adapting to the new world of EFI/GPT

Post by srs5694 »

leehach wrote:I have a new HP Pavilion g4 with Win8. I want to blow away the Win8 partition and install Linux Mint 13 in its place, *but* I would like to preserve the WinRE partition and the HP Recovery partition, so that I can recreate a factory-new computer. I don't know if this is possible or worth the effort.
I have no direct experience with this setup, but you might look for an application in Windows to create a set of recovery discs. Such tools were common on Windows 7 PCs, and I imagine they'd keep the feature for Windows 8. (I still think they're cheap jerks for not including physical DVDs with the computer, but that's another matter....) Alternatively, if you lack a DVD drive, you could try backing up the partitions to a USB flash drive. I make no promises that the second option would work (or the first, really), but it's worth a try....
1) I read that Linux and Windows must either both be EFI or both be BIOS. But if I'm getting rid of Win8 (just preserving the recovery partitions), do I have to install Linux Mint in EFI mode?
No, but if you want to keep the ability to boot those Windows recovery/restoration tools, you might want to install in EFI mode.

Note also that it's possible to switch Linux's boot mode; you need only install a new boot loader to do the job. Thus, you can install in BIOS mode and then switch to EFI mode if you like.
2) Is there any advantage to using EFI (other than secure boot, which I have already disabled)?
At the moment, such advantages are very minor and/or theoretical. For instance, you can store variables in the firmware in EFI, which can include things like kernel crash data that might be useful to a kernel developer.

As a practical matter, the biggest plus to EFI is that the boot time can be cut down by a few seconds. IMHO, this is pretty minor, but some people get worked up about a 10-second boot-time reduction.

Another difference (advantage or disadvantage, depending on your preferences) is that EFI offers a different mix of boot loaders. GRUB 2 is available for both, and is used by default by Mint on both, but you might conceivably prefer some other EFI boot loader. See my Web page on the topic for a rundown of what's available.
3) Do I need a specific version or remix of Linux Mint (or Ubuntu) to install using EFI?
Yes. The original 14 release was broken, so you need either 13 (for LTS) or 14.1.
4) If I am *not* using EFI, can I install Linux Mint to the GPT hard drive, or do I have to convert the hard drive to MBR first? (http://commandlinewani.blogspot.com/201 ... -vaio.html)
You can usually install to GPT in BIOS mode. Unfortunately, some BIOSes have bugs that prevent them from booting from GPT disks, at least until you take steps to work around those bugs. Such bugs are rare, so I wouldn't worry too much about them, but be prepared to deal with them if you do run into them.
5) Does installing to the GPT hard drive require a specific version or remix of Linux Mint?
No, except when installing in EFI mode, in which case the EFI caveats come into play. Also, I'm assuming you'd want something recent; old versions might have limitations, but I've not looked into the issue.
Pointers to a solid guide would be invaluable. I have found some of this information out there--hopefully enough to format intelligent questions--but am having trouble assimilating it.
My EFI Boot Loaders for Linux page (referenced earlier) covers that topic. I've also got some information on booting from GPT disks under BIOS as part of my gdisk documentation. Neither of these is a "guide" in the sense of something that provides step-by-step instructions, though.
leehach
Level 1
Level 1
Posts: 47
Joined: Tue Jun 26, 2012 1:42 am

Re: Adapting to the new world of EFI/GPT

Post by leehach »

Rod,

Thanks for the clear answers. I've also been looking through your EFI boot loader page, and thanks for that, too, it's helping me understand what exactly this is about.

I did burn backup media, but based on your answers, I want to at least try EFI/GPT install. Now trying to install Linux Mint in EFI mode. Here's what happens when I boot the Live USB.

* When I boot the USB in Legacy (BIOS) mode, it boots successfully.
* When I disable Legacy boot in the BIOS, and try to boot the USB, I get

Code: Select all

Failed to start the X server (your graphical interface). It is likely that it is not set up correctly. Would you like to view the X server output to diagnose the problem? Yes/No
* When I enable Legacy boot, boot manager lists the USB twice, once as UEFI and once with no additional specification, implying Legacy. I choose UEFI and it boots successfully. Is it really UEFI? I have a suspicion, since UEFI boot fails when Legacy is disabled, that the boot is silently falling back to Legacy mode.

I am assuming that what determines whether LInux Mint installs as EFI or BIOS is how it is running on the Live USB. I'm assuming this, because the last time I installed Mint (on a non-EFI computer) I don't remember an option for EFI or BIOS. But can't tell whether option 3 above is *really* loading EFI. Should I just install, then check to see whether it installed as EFI, and convert to EFI if necessary? Also, it seems that my BIOS supports both EFI and BIOS booting using CSM. Maybe I install Linux Mint using BIOS and see whether I can still boot to the recovery partition?

Thanks again,
--Lee
srs5694
Level 6
Level 6
Posts: 1386
Joined: Mon Feb 27, 2012 1:42 pm

Re: Adapting to the new world of EFI/GPT

Post by srs5694 »

Once you're booted, you can check for the presence of a directory called /sys/firmware/efi. If it's present, you're booted in EFI mode. If not, you're probably booted in BIOS/legacy mode (although there are ways to boot in EFI mode and wind up without a /sys/firmware/efi directory).
leehach
Level 1
Level 1
Posts: 47
Joined: Tue Jun 26, 2012 1:42 am

Re: Adapting to the new world of EFI/GPT

Post by leehach »

/sys/firmware/efi was present. Don't know why the installer would load as EFI when Legacy boot was enabled, but not when it was disabled. Anyway, went ahead with install. For laughs I tried to install as Win8 dual boot. Boot goes right to Win8 unless I hit F9 (HPs key to call up boot menu), then I can choose to boot to Linux Mint.

Win8 booted once successfully, then I booted to Linux Mint a couple of times, tried booting to Win8 again and it wouldn't boot. It went into repair mode, tried to "diagnose" the problem, rebooted a few times, but stopped being able to boot Win8. Oh well, don't want to use it anyway. Also, in Linux Mint, when I open the Disk Utility, the Linux Mint partition and the swap partition report "The partition is misaligned by 2560 bytes. This may result in very poor performance. Repartitioning is suggested." The resized Win8 partition and the recovery partitions are fine. I think I'll try reinstalling Linux Mint and completely overwrite the Win8 partition, which is what I was intending to do in the first place.
leehach
Level 1
Level 1
Posts: 47
Joined: Tue Jun 26, 2012 1:42 am

Re: Adapting to the new world of EFI/GPT

Post by leehach »

OK, reinstalling Linux Mint, and I'm at a loss at choosing "Device for boot loader installation". Normally I would install to sda, that is, the MBR of the first hard disk. But what's the correct choice in an EFI setup?
androidrom

Re: Adapting to the new world of EFI/GPT

Post by androidrom »

I don't know if this will help you.

https://help.ubuntu.com/community/UEFI

GUIDE: (U)EFI installation
http://ubuntuforums.org/showthread.php?t=1958383
mcoumans

Re: Adapting to the new world of EFI/GPT

Post by mcoumans »

I was stupid again, updated BIOS and now a perfectly working system is gone again. It boots and get stuck in a black screen (no input possible, monitor goes to sleep, as it gets no input). Flasing the previous BIOS does not help, nor does resetting (on the MB) the bios.

Prior to this, I could get a Boot option "linuxmint", now I only get the choice of HDD, CDROM or EFI shell. When selecting the HDD, I get the message "Reboot and Select proper Boot device or Instert Boot Media in selected Boot device and press a key".

No dual boot, just Linux Mint 14, nicely updated.

What to do??
srs5694
Level 6
Level 6
Posts: 1386
Joined: Mon Feb 27, 2012 1:42 pm

Re: Adapting to the new world of EFI/GPT

Post by srs5694 »

mcoumans wrote:I was stupid again, updated BIOS and now a perfectly working system is gone again. It boots and get stuck in a black screen (no input possible, monitor goes to sleep, as it gets no input). Flasing the previous BIOS does not help, nor does resetting (on the MB) the bios.
One of the unfortunate quirks of EFI is that, when you update your firmware, all your NVRAM settings get lost. Since the boot loader list is stored in NVRAM, the result is that updating your firmware renders your system unbootable unless you've got a boot loader installed at the default location (EFI/BOOT/bootx64.efi on the ESP). There are at least two ways to resolve this problem:
  • Copy your boot loader to the ESP's EFI/BOOT/bootx64.efi. You'll need to use an emergency disc to do this (the Mint installer in "try before installing" mode should work fine). Your normal boot loader is probably EFI/linuxmint/grubx64.efi, so just create a new EFI/BOOT directory and copy the file. You'll need to mount your ESP first, of course, and cd to the mount point to do the work. You can do this from a BIOS/legacy-mode boot or from an EFI-mode boot. In a way it's a hack of a solution, but it should provide some protection in the event that your NVRAM entries get trashed again.
  • Use the "efibootmgr" program to create a fresh NVRAM entry for your boot loader. Again, you can use the Mint installer in "try before installing" mode, but you may need to install efibootmgr by typing "sudo apt-get install efibootmgr". The details of the command to type vary depending on where your ESP is and the exact name of your boot loader. See this page of mine for details, and in particular the "Announcing the Boot Loader to the EFI" section. This is the "purest" solution in the sense that it adheres best to the spirit of EFI, but it must be done using an EFI-mode boot, and if your NVRAM gets wiped again, you'll have to perform this repair again.
To help with such problems, you might want to prepare an external medium with a copy of my rEFInd boot manager. With that in hand, you can boot from the external medium and get a menu of boot loaders, since rEFInd scans your disks for boot loaders and gives you a menu of what it finds, even if your NVRAM has been wiped clean. The downloads page for rEFInd includes a link to a CD-R image; or you can download that or the binary and run the install.sh script with its --usedefault {esp-device-name} option (as in "./install.sh --usedefault /dev/sdb1") to create a USB flash drive with a copy of rEFInd. Using rEFInd in this way isn't a good permanent fix, but it will enable you to quickly boot into any OS you've got on your system, so as to use its tools to perform a more permanent recovery. If you like, you can use another computer (even a BIOS-based one) to prepare a rEFInd boot medium now and use it to boot your normal installation to perform either of the preceding two repairs. In fact, if you like rEFInd, you could install it as your primary boot program on your hard disk -- just use the install.sh script once you're booted normally.
Oyabunbaba

Re: Adapting to the new world of EFI/GPT

Post by Oyabunbaba »

Ouch this topis is similar to my problem, any you guys seems know a bit about it.
I have problem with double items in the bios boot order http://forums.linuxmint.com/viewtopic.php?f=46&t=119292
mcoumans

Re: Adapting to the new world of EFI/GPT

Post by mcoumans »

Thanks srs5694, thanks Rod,

Will give it a go tomorrow, first digest your information!

Mark
leehach
Level 1
Level 1
Posts: 47
Joined: Tue Jun 26, 2012 1:42 am

Re: Adapting to the new world of EFI/GPT

Post by leehach »

Rod,

Still not sure what this means about where to install GRUB2 during Linux Mint installation ("Device for boot loader installation"). Based on your web page, I think one option is to install GRUB2 to the Linux Mint partition (sda6 in my case), in which case the disk still needs a boot manager to pass control to GRUB2, like your reFIND package. The other option is to use GRUB2 itself as the boot manager, but in that case, where does it go? Does it go on the EFI partition (sda2 in my case)? I know you recommend against using GRUB2 as the boot manager, but in my case I'm not intending on installing any additional OSes, so it might be easiest.

For that matter, what would happen if GRUB2 gets installed to the hard disk (sda) on an EFI system? In BIOS mode, this writes to the MBR, but since EFI doesn't use MBR…

Thanks,
--Lee
srs5694
Level 6
Level 6
Posts: 1386
Joined: Mon Feb 27, 2012 1:42 pm

Re: Adapting to the new world of EFI/GPT

Post by srs5694 »

The prompt for an installation location for GRUB 2 really needs to be updated (probably eliminated) for EFI systems. It makes little sense to install GRUB anywhere but to the ESP on such systems (although there can technically be multiple ESPs). I have no idea what the Mint installer does with that information in the EFI case, so I don't know what an appropriate response would be, or if it even matters. My best guess would be to point it to your ESP, but it's conceivable that the Mint installer requires something weird like /dev/sda instead. Also, if you've accidentally booted the installer in BIOS/legacy mode instead of in EFI mode, or if the installer malfunctions, then the BIOS version of GRUB will be installed instead of the EFI version.
mcoumans

Re: Adapting to the new world of EFI/GPT

Post by mcoumans »

I did create a USB flashdrive with Refind, but to no avail. It booted well, gave the choice between an empty Windows and Linux Mint. Choosing the latter gave a short text (unable to read) and then turned me over to Grub 2. But after choosing to start my Linux Mint, nothing but a black screen.

So, after some more digging, I decided to reinstall Linux Mint 14.1

There is however a noticeable difference regarding EFI between Linux Mint and Ubuntu. Ubuntu gives the possibility during the install to prepare an EFI partition. Linux Mint however does not.

So, I formatted a GPT-disk, used Gparted to create an boot partition, a / partition and swap. Than started the installation, just todo it all again (while trying to get that EFI partition), but this time I could at least mount the 200Mb partition to /boot/efi (and flag it).

I will have to check more to see if it all works well, but at least I could get into my new Linux Mint again. Updating as we speak.
mcoumans

Re: Adapting to the new world of EFI/GPT

Post by mcoumans »

srs5694 wrote:Also, if you've accidentally booted the installer in BIOS/legacy mode instead of in EFI mode, or if the installer malfunctions, then the BIOS version of GRUB will be installed instead of the EFI version.
It looks like the DVD only boots in BIOS/Legay mode. With USB or Hard drives my ASROCK boot options lists them double: as " UEFI ..." and " USB/SATA... ". The DVD is only listed as " SATA: iHOS 104 "
leehach
Level 1
Level 1
Posts: 47
Joined: Tue Jun 26, 2012 1:42 am

Re: Adapting to the new world of EFI/GPT

Post by leehach »

srs5694 wrote:The prompt for an installation location for GRUB 2 really needs to be updated (probably eliminated) for EFI systems. It makes little sense to install GRUB anywhere but to the ESP on such systems (although there can technically be multiple ESPs). I have no idea what the Mint installer does with that information in the EFI case, so I don't know what an appropriate response would be, or if it even matters. My best guess would be to point it to your ESP, but it's conceivable that the Mint installer requires something weird like /dev/sda instead.
Good to know I'm not the only one confused by this. This guide http://sdnalloh.com/installing-ubuntu-1 ... -computer/, which is based on Ubuntu, claims that the installer should point to your Ubuntu installation partition, and that the installer will put the necessary files on the ESP. So I tried it this way. It *did* create a linuxmint subfolder in ESP, *but* it didn't actually set up GRUB2 as the boot manager, so the factory installed boot manager still took over (and was very confused since Windows was now missing) unless I intervened to tell it to direct to boot the Linux Mint partition.

At this point I referred to your guide on EFI Boot Loader Installation http://www.rodsbooks.com/efi-bootloader ... ation.html, specifically the section "Copying Boot Loader Files". First I replaced /boot/efi/EFI/BOOT/bootx64.efi with the EFI file created by the Mint installer, but that didn't do anything. Then I replaced /boot/efi/EFI/Microsoft/BOOT/bootmgfw.efi with the EFI file created by the Mint installer (the new laptop I'm installing on *is* an HP, which you refer to), and that worked. GRUB2 is now taking over as boot manager, with entries for the Windows Recover partition, the nonexistent Windows installation (I guess since the Windows EFI folders are still there?), and Linux Mint.

I can definitely see how EFI/ESP boot management promises to be easier than BIOS/MBR boot management, and using GPT so as to not have to deal with the 4 physical partition limit of MSDOS partitioning, but the transition is a little painful.

Thanks very much for your help. Your EFI web pages were really useful, and if I do end up setting up a multi-boot, I'll give reFIND a try.

--Lee
srs5694
Level 6
Level 6
Posts: 1386
Joined: Mon Feb 27, 2012 1:42 pm

Re: Adapting to the new world of EFI/GPT

Post by srs5694 »

mcoumans wrote:I did create a USB flashdrive with Refind, but to no avail. It booted well, gave the choice between an empty Windows and Linux Mint. Choosing the latter gave a short text (unable to read) and then turned me over to Grub 2. But after choosing to start my Linux Mint, nothing but a black screen.
I'm afraid this thread is starting to get confusing, what with both you and leehach posting your own unique problems. Since leehack started the thread, I recommend you start another one.

I will say this, though: When doing an EFI installation, I strongly recommend creating a separate FAT, ext2fs, ext3fs, or ReiserFS /boot partition. Doing so will give you additional options when it comes to boot loader configuration. FAT works best from an EFI perspective, but most distribution installers won't permit it, so you may need to use one of the others.
leehach
Level 1
Level 1
Posts: 47
Joined: Tue Jun 26, 2012 1:42 am

Re: Adapting to the new world of EFI/GPT

Post by leehach »

srs5694 wrote:I'm afraid this thread is starting to get confusing, what with both you and leehach posting your own unique problems. Since leehack started the thread, I recommend you start another one.
I've marked the thread SOLVED. Thanks for your help.

--Lee
Locked

Return to “Installation & Boot”