Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Installing GRUB2 in a GPT disk on a partition
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
GSnake
Tux's lil' helper
Tux's lil' helper


Joined: 10 Sep 2012
Posts: 100
Location: Italy

PostPosted: Mon Apr 28, 2014 9:30 am    Post subject: Installing GRUB2 in a GPT disk on a partition Reply with quote

I'm using a MacBook Air 2013 and I'm trying to install Gentoo. I already did it several times but I always used other "workarounds" to this problem such as using directly a EFI-stub kernel image.

What I'm trying to achieve is installing GRUB on a PARTITION so I won't scramble the original disk layout of my Macbook.
(so I won't have problem when I'll sell it)
This is my partition table:
Code:

        GPT fdisk (gdisk) version 0.8.8
   
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
   
    Found valid GPT with protective MBR; using GPT.
    Disk /dev/sda: 236978176 sectors, 113.0 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 9DF6BE23-87E0-4602-B71F-7DAD445D5614
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 236978142
    Partitions will be aligned on 8-sector boundaries
    Total free space is 6 sectors (3.0 KiB)
   
    Number  Start (sector)    End (sector)  Size       Code  Name
       1              40          409639   200.0 MiB   EF00  EFI System Partition
       2          409640       176582599   84.0 GiB    AF00  Customer
       3       176582600       177852135   619.9 MiB   AB00  Recovery HD
       4       177852136       178114279   128.0 MiB   EF00  EFI System
       5       178114280       236978142   28.1 GiB    8300  Linux filesystem

The 1st partition is the original ESP of my Mac (where I installed Refind) and I would like to keep it as it is.
I tried to place GRUB on the 4th partition (which is vfat) but when I try to install it there I get:

Code:
# > grub2-install /dev/sda4   
    /usr/sbin/grub2-bios-setup: warning: File system 'fat' doesnt' support embedding.
    /usr/sbin/grub2-bios-setup: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
    /usr/sbin/grub2-bios-setup: error: will not proceed with blocklists.


I also tried using

Code:
grub2-install --force /dev/sda4

but that did nothing.
How can I solve this thing? Thanks!
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2248

PostPosted: Mon Apr 28, 2014 11:41 am    Post subject: Re: Installing GRUB2 in a GPT disk on a partition Reply with quote

GSnake wrote:
What I'm trying to achieve is installing GRUB on a PARTITION so I won't scramble the original disk layout of my Macbook. (so I won't have problem when I'll sell it)

GSnake ... you don't "install" grub in traditional sense with efi, *.efi are executables, files loaded by the firmware. You've already "installed" rEFInd on the ESP, and nothing was "scrambled" in doing this (simply removing the file and/or updating efivars will have it revert to its previous "unscrambled" state. You seem to be labouring under the impression that grub2.efi is like bios.

GSnake wrote:
Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       176582599   84.0 GiB    AF00  Customer
   3       176582600       177852135   619.9 MiB   AB00  Recovery HD
   4       177852136       178114279   128.0 MiB   EF00  EFI System
   5       178114280       236978142   28.1 GiB    8300  Linux filesystem

The second ESP (partition 4) isn't required, a disk only requires one ESP (as all EFI executables can happily co-exist on the ESP), again, its not bios, there is nothing the bootloader/bootmanager does to the partition as its simply an executable.

GSnake wrote:
The 1st partition is the original ESP of my Mac (where I installed Refind) and I would like to keep it as it is.

That wish, I think, is based on a misunderstanding of what an ESP is, its just a partition with a 'code' of 'EF00'.

GSnake wrote:
I tried to place GRUB on the 4th partition (which is vfat) but when I try to install it there I get:

Code:
# > grub2-install /dev/sda4   
/usr/sbin/grub2-bios-setup: warning: File system 'fat' doesnt' support embedding.
/usr/sbin/grub2-bios-setup: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub2-bios-setup: error: will not proceed with blocklists.

The question really is, why are you using, or why do you want to use, grub2 when rEFInd is installed? You need only place an efi_stub enabled kernel somewhere (I'd suggest the first ESP), suffix it '.efi', and rEFInd will provide it as a boot option. If you must use grub2, then you need to have set GRUB_PLATFORMS="gentoo_platforms_efi-64" (thought, afaik, this may be autodetected) in make.conf and run do the following:

Code:
# emerge =sys-boot/grub-2.00_p5107-r2
# mount /dev/sdaX /boot/efi
# grub2-install --target=x86_64-efi

... see the gentoo grub2 wiki.

Honestly though, you really don't need this, as you already have an efi capable bootloader/boomanager.

best ... khay
Back to top
View user's profile Send private message
GSnake
Tux's lil' helper
Tux's lil' helper


Joined: 10 Sep 2012
Posts: 100
Location: Italy

PostPosted: Mon Apr 28, 2014 8:20 pm    Post subject: Reply with quote

I'd like to avoid the EFI-STUB kernels since I can't append kernel parameters on boot.

I tried to do what you said but I've got no efivars mounted since I do not have a EFI bootable USB disk. How can I create one from Mac OS X?
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2248

PostPosted: Mon Apr 28, 2014 8:49 pm    Post subject: Reply with quote

GSnake wrote:
I'd like to avoid the EFI-STUB kernels since I can't append kernel parameters on boot.

GSnake ... yes you can:

/boot/refind_linux.conf
Code:
"Boot softlevel default"  "ro nopat acpi_backlight=vendor rootfstype=ext4 luks enc_root=/dev/sda2 lvm root=/dev/mapper/vg-root swsusp resume=/dev/mapper/vg-swap"
"Boot softlevel single"   "ro nopat acpi_backlight=vendor rootfstype=ext4 luks enc_root=/dev/sda2 lvm root=/dev/mapper/vg-root swsusp resume=/dev/mapper/vg-swap softlevel=single"

rEFInd also allows you to edit these parameters at boot time ...

GSnake wrote:
I tried to do what you said but I've got no efivars mounted since I do not have a EFI bootable USB disk. How can I create one from Mac OS X?

I wouldn't know, I don't use OSX, just own a macbook. If you have a CD drive then you could use the method provided for sysrescuecd ... sysrescuecd supports 64bit EFI so you will have efivars. Other CD/DVD's, such as Ubuntu, also support this (and can be copied to the USBstick with 'dd').

best ... khay
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 6715
Location: Goose Creek SC

PostPosted: Tue Apr 29, 2014 6:41 am    Post subject: Reply with quote

Quote:
I'd like to avoid the EFI-STUB kernels since I can't append kernel parameters on boot.

My efi stub kernel has:
Quote:
[*] Built-in kernel command line
(initrd=/boot/initramfs root=PARTUUID=92d3d504-9e7e-4c3d-9e56-15e3bd43511b ro init=/usr/lib/systemd/systemd quiet) Built-in kernel command string
[*] Built-in command line overrides boot loader arguments


I build new efi-stub kernels as opportunity presents using make && make modules_install && make install and don't change anything in rEFInd and don't use any grubs or lilo's or syslinux. rEFInd was told last year to boot vmlinuz as default. rEFInd finds the new kernel and boots it unless I select another action. My maintenance is limted to building new kernels and deleting old ones. kernels are kept at /boot.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
GSnake
Tux's lil' helper
Tux's lil' helper


Joined: 10 Sep 2012
Posts: 100
Location: Italy

PostPosted: Wed Apr 30, 2014 12:51 pm    Post subject: Reply with quote

I solved by using a EFI-STUB kernel and then I've created the grubx64.efi while booted with my EFI-STUB kernel. Thanks for you support!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum