LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo
User Name
Password
Gentoo This forum is for the discussion of Gentoo Linux.

Notices


Reply
  Search this Thread
Old 12-29-2014, 09:50 PM   #1
CollieJim
Member
 
Registered: Mar 2005
Distribution: Gentoo, Kubuntu
Posts: 582

Rep: Reputation: 28
GPT - grub2 wants BIOS partition


I'm building a fresh system, and have decided to use GPT. The guide I read, and the Gentoo wiki indicate that a BIOS partition is optional so I omitted it. Silly me.

I now have 12 partitions defined, with the first starting at sector 2048, /boot on sda1 and Linux Mint 17.1 installed on sda4.
Code:
grub2-install /dev/sda
fails, saying it wants a BIOS partition.

Can I add a BIOS partition in sectors 32-2047 without losing everything?

I assume that all of the partition numbers will be increased by 1, and that Mint 17.1 will not boot until I get grub installed and configured in the new Gentoo system.

Will UUIDs survive the change?

Thanks
Jim
 
Old 12-30-2014, 03:02 AM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Hello.

My knowledge about anything non-BIOS is, at best, limited. However and since no one has answered I can point out a few things that might put you in the right track.

First of them being that one of the arguments to use GRUB2 instead of legacy has always been that it is supposed to support UEFI and all that new stuff I know nothing about (not that my machines support that, so...)

Quote:
Originally Posted by CollieJim View Post
I'm building a fresh system, and have decided to use GPT. The guide I read, and the Gentoo wiki indicate that a BIOS partition is optional so I omitted it. Silly me.

I now have 12 partitions defined, with the first starting at sector 2048, /boot on sda1 and Linux Mint 17.1 installed on sda4.
Code:
grub2-install /dev/sda
fails, saying it wants a BIOS partition.
I am sure that you, by now, know that Gentoo can enable and disable code paths in individual packages via USE flags, there are some special sets of USE flags that can be controlled with special variables in your make.conf file (such as VIDEO_CARDS, INPUT_DEVICES...). Grub2 makes use of one of those to control some architecture specific features. This is the output for "eix grub" in my machine,

Code:
[I] sys-boot/grub
     Available versions:  
     (0)    0.97-r12 ~0.97-r13 ~0.97-r14
     (2)    2.00_p5107-r2^t 2.02_beta2-r3^t ~2.02_beta2-r6^t **9999-r1^t
       {custom-cflags debug device-mapper doc efiemu libzfs mount +multislot ncurses netboot nls sdl static test truetype GRUB_PLATFORMS="coreboot efi-32 efi-64 emu ieee1275 loongson multiboot pc qemu qemu-mips xen yeeloong"}
     Installed versions:  2.02_beta2-r3(2)^t(13:56:32 04/12/14)(multislot nls truetype -debug -device-mapper -doc -efiemu -libzfs -mount -sdl -static -test GRUB_PLATFORMS="-coreboot -efi-32 -efi-64 -emu -ieee1275 -loongson -multiboot -pc -qemu -qemu-mips -xen")
     Homepage:            http://www.gnu.org/software/grub/
     Description:         GNU GRUB boot loader
As you see, there's a variable named GRUB_PLATFORMS which can be used to enable things such as efi support. You probably want GRUB_PLATFORMS="efi-64 pc", or GRUB_PLATFORMS="efi-64".

"equery u grub" will provide more info on the different flags for this package.

Quote:
Will UUIDs survive the change?

Thanks
Jim
Unless you undo and then re-do the partitions, UUIDs shouldn't change. That's what they are all about after all, otherwise they wouldn't be any good.

Last edited by i92guboj; 12-30-2014 at 03:04 AM. Reason: forgot eix output
 
Old 12-30-2014, 05:52 AM   #3
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
I think what the grub message says it needs a BIOS partition to install. But you have instead have GPT type partitions. I would say use grub 2.00 which supports UEFI (GPT partitions). Please read accompanying manual for how to setup EFI (GPT) partitions. Also you would need a pc which supports UEFI based booting ( the newer secure boot ones).

Code:
info grub
 
Old 12-30-2014, 06:18 AM   #4
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by CollieJim View Post
Can I add a BIOS partition in sectors 32-2047 without losing everything?
Yes -- I do this in my EFI system to enable non-EFI booting; it will be added as partition number 13 in your system.
Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1       233394176       234441614   511.4 MiB   EF00  EFI System
   2            2048       201326579   96.0 GiB    8300  Linux filesystem
   3              34            2047   1007.0 KiB  EF02  BIOS boot partition
   4       209712510       233394175   11.3 GiB    8300  Linux filesystem
   5       201326592       209711103   4.0 GiB     8200
I would recommend using gdisk -- press "n" to make a new partition & it should offer sectors 34 & 2047 as the default start & end sectors, then use type "ef02" to make a BIOS boot partition.

It should be noted, however, that you may not be able to boot a GPT disk in non-EFI mode at all; it works with my system but it is entirely firmware-dependent.
https://wiki.archlinux.org/index.php/GPT#BIOS_systems

I would strongly recommend using EFI-mode booting (if Gentoo supports this).
 
Old 12-30-2014, 06:36 AM   #5
CollieJim
Member
 
Registered: Mar 2005
Distribution: Gentoo, Kubuntu
Posts: 582

Original Poster
Rep: Reputation: 28
I think I'm having fun, but not really sure...

I added GRUB_PLATFORMS_EFI-x64 to USE and got past the initial problem. Thanks for the pointer.

The latest issue is that grub2-install wants to access efivars and cannot find it. It occurred to me that even though I've installed a kernel that provides it, I'm still using the one on the installation disc. I will check to see if there is a boot option on the disc that can be more efi-friendly.

Failing success there, I may remove GRUB_PLATFORMS from USE, create the BIOS partition, re-emerge grub, and try again. I was concerned that partitions' numbers represented their physical order.
 
Old 01-05-2015, 12:52 AM   #6
CollieJim
Member
 
Registered: Mar 2005
Distribution: Gentoo, Kubuntu
Posts: 582

Original Poster
Rep: Reputation: 28
I've added a BIOS boot partition, but still cannot get grub2 to work.

Linux Mint 17.1 was installed first in sda4. It boots OK, with sda1 mounted at /boot/efi, and has stuff in /boot/efi/EFI.
Gentoo's efforts are ignored. In order to use a new kernel I have to boot Mint, update-grub, and then boot Gentoo again.

I'm using an HP Pavilion dv6 notebook. When the initial splash screen appears I press ESC and get a menu which includes "BIOS SETUP." Selecting that gives me the usual abbreviated BIOS menus, with "Secure boot" permanently disabled. I have Legacy mode enabled so I can boot from DVD.

I'm trying to follow the instructions at wiki.gentoo.org/wiki/GRUB2.
Code:
/ # gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sda: 1465149168 sectors, 698.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 47B630FC-BE27-414E-BC50-6AED591BB1B6
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1465149134
Partitions will be aligned on 8-sector boundaries
Total free space is 168752847 sectors (80.5 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          391167   190.0 MiB   EF00  
   2          391168        16392191   7.6 GiB     8200  
   3        16392192        96393215   38.1 GiB    8300  
   4        96393216       176394239   38.1 GiB    8300  
   5       176394240       236394495   28.6 GiB    8300  
   6       236394496       296394751   28.6 GiB    8300  
   7       296394752       316395519   9.5 GiB     8300  
   8       316395520       396396543   38.1 GiB    8300  
   9       396396544       436396031   19.1 GiB    8300  
  10       436396032      1236396031   381.5 GiB   8300  
  11      1236396032      1276395519   19.1 GiB    8300  
  12      1276395520      1296396287   9.5 GiB     8300  
  13              34            2047   1007.0 KiB  EF02  BIOS boot partition
Code:
/boot # ls -al
total 7988
drwxr-xr-x  5 root root    4096 Jan  4 22:08 .
drwxr-xr-x 22 root root    4096 Jan  1 16:55 ..
-rw-r--r--  1 root root   97283 Jan  4 22:08 config-3.17.7-gentoo-print-G10
drwxr-xr-x  2 root root    4096 Jan  2 16:24 efi
drwxr-xr-x  7 root root    4096 Jan  5 11:33 grub
-rwxr-xr-x  1 root root       0 Jan  2 16:12 .keep
drwxr-xr-x  2 root root    4096 Jan  4 22:08 OldKernels
-rw-r--r--  1 root root 2835493 Jan  4 22:08 System.map-3.17.7-gentoo-print-G10
-rw-r--r--  1 root root 5219568 Jan  4 22:08 vmlinuz-3.17.7-gentoo-print-G10

/boot # mount /dev/sda1 efi
/boot # ls efi
EFI
/boot # ls grub
fonts  #grub.cfg#  grub.cfg  grubenv  i386-pc  locale  themes  x86_64-efi

/boot # grub2-install /dev/sda
Installing for x86_64-efi platform.
Installation finished. No error reported.

/boot # grub2-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.17.7-gentoo-print-G10
Found Linux Mint 17.1 Rebecca (17.1) on /dev/sda4
done

/boot # efibootmgr -v
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 3001,3002,3003,2001,2002,2003
Boot0000* Notebook Hard Drive	BIOS(2,0,18).......................................................................
Boot0001* ubuntu	HD(1,800,5f000,97e014e7-562b-4802-ae88-6650c69785a1)File(\EFI\ubuntu\shimx64.efi)
Boot0002* Ubuntu	HD(1,800,5f000,97e014e7-562b-4802-ae88-6650c69785a1)File(\EFI\ubuntu\grubx64.efi)RC
Boot0003* gentoo	HD(1,800,5f000,97e014e7-562b-4802-ae88-6650c69785a1)File(\EFI\gentoo\grubx64.efi)
Boot0004* USB Hard Drive - ChipsBnk  Multi-Reader	BIOS(7,500,18).......................................................................
Boot2001* USB Drive (UEFI)	RC
Boot2002* Internal CD/DVD ROM Drive (UEFI)	RC
Boot3001* Internal Hard Disk or Solid State Disk	RC
Boot3002* Internal Hard Disk or Solid State Disk	RC
Boot3003* Internal Hard Disk or Solid State Disk	RC
481 14:38:28 /boot # efibootmgr -c
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0005,3001,3002,3003,2001,2002,2003
Boot0000* Notebook Hard Drive
Boot0001* ubuntu
Boot0002* Ubuntu
Boot0003* gentoo
Boot0004* USB Hard Drive - ChipsBnk  Multi-Reader
Boot2001* USB Drive (UEFI)
Boot2002* Internal CD/DVD ROM Drive (UEFI)
Boot3001* Internal Hard Disk or Solid State Disk
Boot3002* Internal Hard Disk or Solid State Disk
Boot3003* Internal Hard Disk or Solid State Disk
Boot0005* Linux
No error, but no work either. A reboot shows the menu created by Mint's update-grub.
 
  


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
Revert grub2-efi to grub2-bios Atmchicago Fedora 1 03-24-2014 01:24 AM
Grub2 Installation on GPT partition Emrod Slackware 5 06-24-2013 08:59 PM
[SOLVED] BIOS won't load Grub2 with GPT -- Troubleshooting Advise?? useless_s_grant Linux - General 2 09-24-2012 12:36 PM
[SOLVED] Grub2 does not boot with GPT gldearman Linux - Software 1 07-02-2012 07:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo

All times are GMT -5. The time now is 09:21 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