Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub-install help bios boot
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
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1381
Location: Tri-Cities, WA USA

PostPosted: Wed Nov 13, 2024 7:16 pm    Post subject: grub-install help bios boot Reply with quote

I've chrooted back into this new system that will not boot
openrc

please throw me a bone

three partitions
/boot ext4 <- this might be a mistake /boot ext4
swap
/ ext4


livecd /boot # grub-install /dev/sda
Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install: 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..
grub-install: error: will not proceed with blocklists.


livecd /boot # grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.6.58-gentoo-r1-gentoo-dist
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

fdisk -l
Code:

Device        Start       End   Sectors   Size Type
/dev/sda1      2048   2099199   2097152     1G Linux filesystem
/dev/sda2   2099200  69208063  67108864    32G Linux filesystem
/dev/sda3  69208064 500117503 430909440 205.5G Linux filesystem





livecd /boot #
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1699
Location: South America

PostPosted: Wed Nov 13, 2024 7:26 pm    Post subject: Re: grub-install help bios boot Reply with quote

cwc wrote:
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.

Did you make a GPT on /dev/sda? Full output of fdisk should tell. If yes, and you are planning to use GRUB, then you are missing a BIOS boot partition for it, as seen in the "Type" column of your output.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 373

PostPosted: Wed Nov 13, 2024 7:30 pm    Post subject: Reply with quote

cvc wrote:
/boot ext4 <- this might be a mistake /boot ext4

/boot being ext4 is fine, but where's your "EFI system partition"? ESP has to be FAT32.
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 373

PostPosted: Wed Nov 13, 2024 7:32 pm    Post subject: Re: grub-install help bios boot Reply with quote

GDH-gentoo wrote:
cwc wrote:
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.

Did you make a GPT on /dev/sda? Full output of fdisk should tell. If yes, and you are planning to use GRUB, then you are missing a BIOS boot partition for it, as seen in the "Type" column of your output.


BIOS boot partition is only needed if booting GPT/legacy BIOS. For GPT/UEFI OP is missing EFI system partition instead.
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1381
Location: Tri-Cities, WA USA

PostPosted: Wed Nov 13, 2024 7:33 pm    Post subject: Re: grub-install help bios boot Reply with quote

GDH-gentoo wrote:
cwc wrote:
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.

Did you make a GPT on /dev/sda? Full output of fdisk should tell. If yes, and you are planning to use GRUB, then you are missing a BIOS boot partition for it, as seen in the "Type" column of your output.

Thank you. I'm setting up a bios boot.

I created the partitions with fdisk. I did not perform the following option:
Code:

Command (m for help):g

Created a new GPT disklabel (GUID: 3E56EE74-0571-462B-A992-9872E3855D75).



I'm not sure how to make /dev/sda1 /boot GPT. Did I miss a step? partitioning?
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1699
Location: South America

PostPosted: Wed Nov 13, 2024 7:46 pm    Post subject: Re: grub-install help bios boot Reply with quote

cwc wrote:
I created the partitions with fdisk. I did not perform the following option:
Code:

Command (m for help):g

And what did you do with fdisk, then? Did /dev/sda already have partitions before, and you are repartitioning it now, or what?

bstaletic wrote:
BIOS boot partition is only needed if booting GPT/legacy BIOS.

Which seems to be this case (perhaps unintentionally?), but I'd like cwc's confirmation.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1381
Location: Tri-Cities, WA USA

PostPosted: Wed Nov 13, 2024 7:57 pm    Post subject: Reply with quote

I'm bios booting.

All I did with fdisk was create the partitions then I formatted then with mkfs.ext4 /dev/sda1 and /dev/sda3

https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks#GUID_Partition_Table_.28GPT.29

Device Start End Sectors Size Type
/dev/sda1 2048 2099199 2097152 1G Linux filesystem
/dev/sda2 2099200 69208063 67108864 32G Linux filesystem
/dev/sda3 69208064 500117503 430909440 205.5G Linux filesystem


fdisk /dev/sda

Welcome to fdisk (util-linux 2.39.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.


Command (m for help): p

Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: FTM56N325H
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 000CD5C5-21DA-4446-AA17-0B0E72DE8BC1

Device Start End Sectors Size Type
/dev/sda1 2048 2099199 2097152 1G Linux filesystem
/dev/sda2 2099200 69208063 67108864 32G Linux filesystem
/dev/sda3 69208064 500117503 430909440 205.5G Linux filesystem

I just noticed this in the docs:

Code:

Creating a new disklabel / removing all partitions

Pressing the g key will instantly remove all existing disk partitions and create a new GPT disklabel:
Command (m for help):g

Created a new GPT disklabel (GUID: 3E56EE74-0571-462B-A992-9872E3855D75).

Alternatively, to keep an existing GPT disklabel (see the output of p above), consider removing the existing partitions one by one from the disk. Press d to delete a partition. For instance, to delete an existing /dev/sda1:





Also:

Code:


gdisk /dev/sda1
GPT fdisk (gdisk) version 1.0.10

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

Creating new GPT entries in memory.



_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 373

PostPosted: Wed Nov 13, 2024 8:11 pm    Post subject: Reply with quote

Like @GDH-gentoo said, you're missing the "BIOS boot partition".
See:
https://wiki.gentoo.org/wiki/Grub#BIOS_with_GPT
https://wiki.gentoo.org/wiki/Handbook:X86/Blocks/Disks#What_is_the_BIOS_boot_partition.3F
https://wiki.archlinux.org/title/GRUB#GUID_Partition_Table_(GPT)_specific_instructions

Why does the handbook not mention the label for this thing, I have no idea.
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1381
Location: Tri-Cities, WA USA

PostPosted: Wed Nov 13, 2024 8:14 pm    Post subject: Reply with quote

when using fdisk which option should I use to create the boot partition? {I'm going for a walk :( }
M or g ( I want a bios boot)
Code:

GPT
   M   enter protective/hybrid MBR

  Generic
   d   delete a partition
   F   list free unpartitioned space
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
   i   print information about a partition

  Misc
   m   print this menu
   x   extra functionality (experts only)

  Script
   I   load disk layout from sfdisk script file
   O   dump disk layout to sfdisk script file

  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty MBR (DOS) partition table
   s   create a new empty Sun partition table




_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1699
Location: South America

PostPosted: Wed Nov 13, 2024 8:29 pm    Post subject: Reply with quote

cwc wrote:
I'm bios booting.

Noted.

cwc wrote:
Disklabel type: gpt

And you have a GPT. So you need to make a choice now.

cwc wrote:
Device Start End Sectors Size Type
/dev/sda1 2048 2099199 2097152 1G Linux filesystem
/dev/sda2 2099200 69208063 67108864 32G Linux filesystem
/dev/sda3 69208064 500117503 430909440 205.5G Linux filesystem

First remark: If you are going to use GRUB, you don't need to have a separate partition for /boot, but can if you want to.

Second remark: If you are going to use GRUB in this scenario, as the Handbook says, you need a BIOS boot partition. This is a small partition of 1 or 2 MB (compared to that, your existing 1GB /dev/sda1 is huge), doesn't have a filesystem, and is never mounted. And must not be confused with "the partition that will be mounted at /boot", which might be none.

So, you can repurpose /dev/sda1 as the BIOS boot partition for GRUB, even though it is huge, and leave /boot as part of your future rootfs (/dev/sda3 I suppose), or repartition.

What do you want to do?
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)


Last edited by GDH-gentoo on Wed Nov 13, 2024 8:34 pm; edited 1 time in total
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1918

PostPosted: Wed Nov 13, 2024 8:33 pm    Post subject: Reply with quote

Alternate option, use gdisk (from gptfdisk package) to convert GPT -> MBR
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1699
Location: South America

PostPosted: Wed Nov 13, 2024 8:38 pm    Post subject: Reply with quote

grknight wrote:
Alternate option, use gdisk (from gptfdisk package) to convert GPT -> MBR

Will that preserve existing partitions?
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 373

PostPosted: Wed Nov 13, 2024 8:42 pm    Post subject: Reply with quote

Could the BIOS boot partition fit inside those 2048 sectors at the start of the disk?
2048*512B == 1MiB
I know that the 1st sector is the boot sector, but I seem to remember myself creating the BIOS boot partition inside those first 2048 sectors and booting fine.
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1918

PostPosted: Wed Nov 13, 2024 8:48 pm    Post subject: Reply with quote

GDH-gentoo wrote:
grknight wrote:
Alternate option, use gdisk (from gptfdisk package) to convert GPT -> MBR

Will that preserve existing partitions?

In most cases, yes. Very rarely it might fail but never seen it before.
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1381
Location: Tri-Cities, WA USA

PostPosted: Wed Nov 13, 2024 10:17 pm    Post subject: Reply with quote

I'm going to start over from scratch. It will be good for me.

Now when partitioning to a bios boot (simple) with grub

What is a good method to make sure the disk/partition is GPT?
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1699
Location: South America

PostPosted: Wed Nov 13, 2024 11:02 pm    Post subject: Reply with quote

cwc wrote:
What is a good method to make sure the disk/partition is GPT?

To create a GUID Partition Table with fdisk? What the Habdbook says:

cwc wrote:
Code:
Creating a new disklabel / removing all partitions

Pressing the g key will instantly remove all existing disk partitions and create a new GPT disklabel:
Command (m for help):g

Created a new GPT disklabel (GUID: 3E56EE74-0571-462B-A992-9872E3855D75).

If you meant to ask how do you make a BIOS boot partition, then you do the same as with any other partition, but then mark it using fdisk's 't' command. The Handbook shows how to mark a partition as the EFI System Partition; this is the same, but with another number I don't recall. You can search that number in the output of the 'l' command:

cwc wrote:
Code:
   l   list known partition types

_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1246
Location: Richmond Hill, Canada

PostPosted: Thu Nov 14, 2024 12:13 am    Post subject: Reply with quote

cwc wrote:
I'm going to start over from scratch. It will be good for me.

Now when partitioning to a bios boot (simple) with grub

What is a good method to make sure the disk/partition is GPT?
Being idle, I want to refresh my sgdisk skill, so I come up following script
Code:
sgdisk -a 1 --new=1:34:2047 --change-name=1:"boot" --typecode=1:ef02 --partition-guid=1:21686148-6449-6E6F-744E-656564454649 /dev/sda
sgdisk --new=2:0:+32G --change-name=2:"linux" --typecode=2:8300 /dev/sda
sgdisk --new=3:0:+210432M --change-name=3:"root" --typecode=3:8300 /dev/sda
sgdisk -p /dev/sda


I cannot guarantee the correctness of this code for Grub, I don't use Grub. I just follow that Archlinux article.

NOTE:
  • The BIOS Boot Partition size is 1007.0 KiB, if your "core.img" somehow larger than that you will need to adjust the command.
  • You can try use "grub-mkimage -o /tmp/core.img <list of modules used in your grub.cfg> to check its size. (this is not installation. it is just for checking)
  • The partition guid is follow Archlinux GUID Partition Table (GPT) specific instructions
  • Partition name, i.e "boot", "linux" or "root" is just my guess you are welcome to change it anything you want it does not affect how grub discover where is BIOS Boot Partition.
  • typecode for BIOS Boot Partition is important, it should be "ef02"
  • Other typecode can be obtain from command sgdisk -L /dev/sda
  • The "-a 1" in the first sgdisk is because the default alignment is 2048, with it sgdisk will realignment first partition to 2048 sector
  • You most likely need root privilege to run these sgdisk command.
  • You can use sgdisk -i 1 -i 2 -i 3 for more detail information.
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