Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub partition(flagged as bios_grub) for UEFI/GPT
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
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Fri Mar 22, 2019 8:48 am    Post subject: grub partition(flagged as bios_grub) for UEFI/GPT Reply with quote

I installed Gentoo like 3 times today but can't get it to boot...

I have several questions about installing Gentoo in UEFI/GPT:

here is a list of my partitions:

/dev/sda1 Boot partition
/dev/sda2 Swap partition
/dev/sda3 Root partition

I am installing Gentoo on Virtualbox with the "Enable EFI" option ticked.

(1) Do I need the 3MB grub partition for UEFI/GPT ?

(2) I use this command for setting the boot partition : "mkfs.fat -F 32 /dev/sda1" is this correct ?

(3) Mounting the boot partition : "mount /dev/sda1 /boot" is this correct ?

(4) Here is how my /etc/fstab looks like:

/dev/sda1 /boot vfat noauto,noatime 0 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / ext4 noatime 0 1

is this correct ?

(5) Here are the steps I use to install GRUB2:

"echo 'GRUB_PLATFORMS="efi-64"' >> /etc/portage/make.conf"

"emerge --ask sys-boot/grub:2"

"grub-install --target=x86_64-efi --efi-directory=/boot"

"grub-mkconfig -o /boot/grub/grub.cfg"

is this correct ?

----------------

If all the above steps are correct, why doesn't my system boot ?

after rebooting, it gets booted into "EFI Interactive Shell V2.1" ... I can't figure out the problem...HELP!!


Last edited by LegionOfHell on Fri Mar 22, 2019 7:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
Verdazil
n00b
n00b


Joined: 14 Feb 2019
Posts: 47
Location: One small country ...

PostPosted: Fri Mar 22, 2019 9:28 am    Post subject: Reply with quote

Quote:
Do I need the 3MB grub partition for UEFI/GPT ?
Usually, this is not necessary. Three specified partitions are enough.
All steps and commands are correct - because they are taken from the guide.
Important questions: grub-install and grub-mkconfig can write in /boot? /boot is mounted?
_________________
GA-Z170X-UD3 / i7-6700K / DDR4 32GB / Radeon RX 570 / TL-WDN4800 / Samsung SSD 850 EVO 250 Gb + WD Green WDC 2 Tb / BenQ BL2711U + LG TV 42LF650V
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Fri Mar 22, 2019 7:28 pm    Post subject: Reply with quote

/boot is mounted and grub-install and grub-mkconfig run successfully.
Back to top
View user's profile Send private message
nick_gentoo
n00b
n00b


Joined: 07 Jan 2019
Posts: 64

PostPosted: Fri Mar 22, 2019 7:52 pm    Post subject: Reply with quote

I do not know what kind of configuration Virtualbox makes visible for a virtual machine, but can you run the following on it and post the output?
Code:
efibootmgr -v
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Fri Mar 22, 2019 7:59 pm    Post subject: Reply with quote

I managed to fix this by doing this at the EFI shell :

fs0:

edit startup.nsh

Entered this:
\EFI\gentoo\grubx64.efi

ctrl+s to save

prressed ENTER

ctrl+q

reset

Now it boots, however I see the EFI interactive shell screen for like 3 seconds before the system boots...

is this because virtualbox has compatibility issues or will I encounter the same problem if I installed Gentoo on a laptop ?
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Fri Mar 22, 2019 8:32 pm    Post subject: Reply with quote

Should I have used "--removable" with grub-install ?
Back to top
View user's profile Send private message
nick_gentoo
n00b
n00b


Joined: 07 Jan 2019
Posts: 64

PostPosted: Fri Mar 22, 2019 8:35 pm    Post subject: Reply with quote

You were probably writing your last post at the same time as I was writing mine, so maybe you did not see it - I had there a proposal.
Also, does Virtualbox has a kind of "BIOS menu" were you can select a boot device, boot order, etc.?
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Fri Mar 22, 2019 8:45 pm    Post subject: Reply with quote

yes it does have a boot sequence setting ... check out this photo: https://ibb.co/JkqBHmf


Also, I didn't quite understand , you are saying that I should use the "--removable" option ?


Here is the output of the "efibootmgr -v": https://ibb.co/PrM0XKq
Back to top
View user's profile Send private message
nick_gentoo
n00b
n00b


Joined: 07 Jan 2019
Posts: 64

PostPosted: Fri Mar 22, 2019 8:56 pm    Post subject: Reply with quote

The output of efibootmgr shows that grub is not actually installed; there should be another entry pointing to the path you mentioned, \EFI\gentoo\grubx64.efi. The '--removable' option does not matter here yet, as it only changes the path where the booloader is installed.

The handbook at https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader#Install has a warning about efivars - did you mount that before running grub-install?
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Fri Mar 22, 2019 9:06 pm    Post subject: Reply with quote

I ran: "grub-install --target=x86_64-efi --efi-directory=/boot"

then i got the "Could not prepare Boot variable: Read-only file system" error

so i ran: "mount -o remount,rw /sys/firmware/efi/efivars"

and then : "grub-install --target=x86_64-efi --efi-directory=/boot"

and it said that grub was installed successfully without errors


Now that I can get past the EFI shell , grub menu shows up so it was installed...
Back to top
View user's profile Send private message
nick_gentoo
n00b
n00b


Joined: 07 Jan 2019
Posts: 64

PostPosted: Fri Mar 22, 2019 9:14 pm    Post subject: Reply with quote

Nice!
Could you post again the output of efibootmgr -v? I think that grub should now be the default boot option and you should not go through the EFI shell anymore.
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Fri Mar 22, 2019 9:28 pm    Post subject: Reply with quote

when i said I ran,I meant I ran the commands during the installation, so the output of the "efibootmgr -v" was for after the installation ... the "efibootmgr -v" outputs the same thing i posted...I still have the EFI shell nag screen which lasts for 5 seconds...

Are you saying that I should install grub again ?
Back to top
View user's profile Send private message
nick_gentoo
n00b
n00b


Joined: 07 Jan 2019
Posts: 64

PostPosted: Fri Mar 22, 2019 9:34 pm    Post subject: Reply with quote

Oh, I misunderstood your last post then.
I have one more idea for the moment, to look at the list of partitions and make sure that /dev/sda1 is marked as EFI System Partition (ESP). With parted this can be done by
Code:
parted /dev/sda print

(I don't know right now the equivalent command for fdisk)
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Fri Mar 22, 2019 9:52 pm    Post subject: Reply with quote

here is the output of "print" in parted:


https://ibb.co/tH3K0Sn
Back to top
View user's profile Send private message
nick_gentoo
n00b
n00b


Joined: 07 Jan 2019
Posts: 64

PostPosted: Fri Mar 22, 2019 10:08 pm    Post subject: Reply with quote

Well, it looks like your boot, swap and root partitions are actually sda2, sda3 and sda4.
Which partition do you have mounted as /boot: /dev/sda1 or /dev/sda2?

By the way, you could copy the output from your commands directly here, as text, by using the 'code' tags.
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Fri Mar 22, 2019 10:16 pm    Post subject: Reply with quote

this is what I did during the installation:


mkdir /boot
mount /dev/sda2 /boot


could it be because of the sda1 ? since it is not needed in UEFI/GPT installs ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Fri Mar 22, 2019 10:50 pm    Post subject: Reply with quote

LegionOfHell,

The unused bios_grub partition won't make any difference.

Does your Virtual Machine have Enable EFI (special OSes only) checked?
Its in Settings System | Motherboard
Its off by default, which is use BIOS mode.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Fri Mar 22, 2019 10:53 pm    Post subject: Reply with quote

I turned it on in the beginning ...


here is how it looks like : https://ibb.co/jr4c706

I guess I have to do a reinstall, maybe I made an error during the install
Back to top
View user's profile Send private message
nick_gentoo
n00b
n00b


Joined: 07 Jan 2019
Posts: 64

PostPosted: Sat Mar 23, 2019 7:40 am    Post subject: Reply with quote

LegionOfHell wrote:
mkdir /boot
mount /dev/sda2 /boot

This is different from what you wrote in the first post, could you please post the contents of /etc/fstab and the output of df? This is only for doublecheck, as the fact that the EFI shell can launch grub probably means that it is installed where it should be.
But no boot entry was created for it on the virtual machine. Before trying to reinstall, you could try to create a boot entry as shown here: https://wiki.gentoo.org/wiki/Efibootmgr.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Sat Mar 23, 2019 10:25 am    Post subject: Reply with quote

LegionOfHell,

Don't guess
Don't reinstall.

Its your EFI setup thats not correct, not your complete Gentoo install.

What boot media are you using?
You must boot in EFI mode, using EFI boot media to manipulate your EFIVARS.
Not all boot media support EFI mode. Its quite possible to boot in BIOS mode, complete your Gentoo install and get to where you are now because you are actually starting the VM in BIOS mode. Reinstalling won't change that.

The differences between EFI and BIOS mode only affect what happens before your kernel and optionally, your initrd, are loaded. At that point, the kernel is in control and its the same for both boot mode.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Sat Mar 23, 2019 11:00 pm    Post subject: Reply with quote

It is confirmed now: VirtualBox needs the --removable option in grub-install for UEFI/GPT installs

Last edited by LegionOfHell on Sun Mar 24, 2019 8:44 pm; edited 3 times in total
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Sun Mar 24, 2019 12:58 am    Post subject: Reply with quote

It is confirmed now: VirtualBox needs the --removable option in grub-install for UEFI/GPT installs

Last edited by LegionOfHell on Sun Mar 24, 2019 8:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
nick_gentoo
n00b
n00b


Joined: 07 Jan 2019
Posts: 64

PostPosted: Sun Mar 24, 2019 6:42 am    Post subject: Reply with quote

Good to hear it's working!

I think this makes sense, because the "--removable" option places the bootloader in a standard place, at /efi/boot/bootx64.efi, so it can be found even without a boot entry - that's how the drive becomes removable.

Does anybody know if this works even without booting in EFI mode? (based on the earlier question of NeddySeagoon)
Back to top
View user's profile Send private message
LegionOfHell
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2019
Posts: 86
Location: Toronto, Canada

PostPosted: Sun Mar 24, 2019 6:35 pm    Post subject: Reply with quote

what does removable mean here ? I don't quite get it..

Should I use --removable for Gentoo installs on my laptops ?
Back to top
View user's profile Send private message
nick_gentoo
n00b
n00b


Joined: 07 Jan 2019
Posts: 64

PostPosted: Mon Mar 25, 2019 6:37 pm    Post subject: Reply with quote

My understanding about "--removable" is as follows.
You could have several operating systems installed on a drive, e.g. Linux and Windows, and each of them might come with it's own bootloader (like grub or the Windows bootloader). So each bootloader has to be installed in a specific location, like your \EFI\gentoo\grubx64.efi, and a corresponding boot entry that points to the correct file is created in the system firmware.
Now, if you remove this drive and attach it to a different computer, it is very likely that the boot entries there won't match to the bootloader files on the drive (nothing will point to the \EFI\gentoo folder if Gentoo is not installed there).

But, there is also a default location for a boot program, where the firmware is looking if it does not find anything else: \EFI\boot\bootx64.efi (at least on x64, maybe there are other defaults on other platforms). Grub is installed with this name when using the "--removable" option. Then, the drive will be also bootable on other computers, as every x64 system will know to look for that file at boot.

I hope this is correct; if not, maybe somebody who knows better could reply here.
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