Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

no grub menu after fresh install of debian testing (GPT/BIOS)

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
linux001
Posts: 122
Joined: 2011-11-04 10:09

no grub menu after fresh install of debian testing (GPT/BIOS)

#1 Post by linux001 »

I installed debian testing on a GPT-formatted disk intended to be booted on a non-UEFI machine. A 10 MiB BIOS boot partition (fdisk type 4, GUID 21686148-6449-6E6F-744E-656564454649) was included at the beginning of the partition table; following that, there is a 1 GiB /boot ext2 partition, a 499 GiB LUKS-encrypted ext4 partition, and finally another ext4 partition. The LUKS-encrypted partition contains LVM logical volumes for root (/), home (/home), and swap. Debian testing was installed on root using debootstrap and grub2 (grub-pc package) was installed on /boot. No errors were encountered at any point during installation. The output of grub-install was "Installing for i386-pc platform. Installation finished. No error reported." The output of `update-initramfs -u -k all` was "update-initramfs: Generating /boot/initrd.img-5.15.0-2-amd64". However, the device is not recognized as bootable media and no grub2 menu appears.

Attempting to boot just drops to the BIOS, requesting selection of a boot device. Selecting the device in question produces a black screen for about a second and then it returns to the BIOS screen, requesting again selection of a boot device. Since there are no error messages of any kind, it's difficult to troubleshoot. Is there a simple method for confirming that grub installed core.img on /dev/sdb1? Any pointers greatly appreciated.

Details:

Code: Select all

# fdisk -l
Disk /dev/sdb: 3.7 TiB, 4096805658624 bytes, 8001573552 sectors
Disk model: 2105
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: [snip]

Device          Start        End    Sectors  Size Type
/dev/sdb1        2048      22527      20480   10M BIOS boot
/dev/sdb2       22528    2119679    2097152    1G Linux filesystem
/dev/sdb3     2119680 1048598527 1046478848  499G Linux filesystem
/dev/sdb4  1048598528 8001573518 6952974991  3.2T Linux filesystem

# lvs
  LV   VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home vg0 -wi-ao---- 282.98g
  root vg0 -wi-ao---- 200.00g
  swap vg0 -wi-a-----  16.00g

# cat /etc/fstab
UUID=[snip]  /boot    ext2    rw,nosuid,nodev    0       2
UUID=[snip]  /        ext4    defaults    0       1
UUID=[snip]  /home    ext4    defaults    0       1
UUID=[snip]  none     swap    defaults    0       0
tmpfs        /tmp     tmpfs   rw,nosuid,nodev,noexec,size=4G    0       0

# cat /etc/crypttab
crypt  UUID=[snip]       none    luks

Victor Brand
Posts: 26
Joined: 2021-09-10 16:35
Location: St. Petersburg, Russia
Been thanked: 4 times

Re: no grub menu after fresh install of debian testing (GPT/BIOS)

#2 Post by Victor Brand »

Have you run

Code: Select all

grub-install /dev/sdb
after installing the grub package? You need to run this command from inside the chroot environment during bootstrapping.

Also, you need to enable bootable flag to (IIRC) /dev/sdb2 partition.

Also, assure yourself that your BIOS allows booting from the GPT table. If not, you'll need to repartition your disk into MBR table.

linux001
Posts: 122
Joined: 2011-11-04 10:09

Re: no grub menu after fresh install of debian testing (GPT/BIOS)

#3 Post by linux001 »

Yes, that's the command I used to install grub. Good point --- I do think I neglected to set a bootable flag on /dev/sdb2. I will try that when I'm next at the machine.

All sources I've read indicate that GPT disks are supported by BIOS, but I'm not sure whether that applies to all BIOS versions.

Thanks.

Victor Brand
Posts: 26
Joined: 2021-09-10 16:35
Location: St. Petersburg, Russia
Been thanked: 4 times

Re: no grub menu after fresh install of debian testing (GPT/BIOS)

#4 Post by Victor Brand »

Ah, and you need to run update-grub after installing it, this command generates grub menu (actually, it creates/modifies the grub configuration file /boot/grub/grub.cfg; check if it exists). Regenerating initramfs has nothing to do with the grub menu.

linux001
Posts: 122
Joined: 2011-11-04 10:09

Re: no grub menu after fresh install of debian testing (GPT/BIOS)

#5 Post by linux001 »

Yeah, I ran update-grub afterwards to generate /boot/grub/grub.cfg. Thanks again.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: no grub menu after fresh install of debian testing (GPT/BIOS)

#6 Post by p.H »

linux001 wrote: 2022-01-23 02:43 A 10 MiB BIOS boot partition
This is a waste. 100 kB is plenty enough. 1 MB is the usual recommended size for alignment.
linux001 wrote: 2022-01-23 02:43 grub2 (grub-pc package) was installed on /boot
What do you mean exactly by "installed on /boot" ?
If you mean that you selected /dev/sdb2 as the location to install GRUB when configuring the package, then it is the wrong location. GRUB must be installed in /dev/sdb (the drive MBR). Run

Code: Select all

dpkg-reconfigure grub-pc
And select /dev/sdb instead. In addition to executing grub-install with the selected location, it will also record it for future updates.
linux001 wrote: 2022-01-23 02:43 Is there a simple method for confirming that grub installed core.img on /dev/sdb1?
Install boot-info-script and run bootinfoscript. Or examine the first sector of the partition with

Code: Select all

hexdump -Cn 512 /dev/sdb1
It should print typical strings such as "loading", "Geom", "Read", "Error". You can do the same with /dev/sdb to check that GRUB boot image is present.
Victor Brand wrote: 2022-01-23 03:00 Also, you need to enable bootable flag to (IIRC) /dev/sdb2 partition.
Some broken BIOS require that an MBR partition entry has the boot flag set. I have never seen a BIOS or UEFI firmware which requires that a GPT partition entry has the legacy boot flag set. However GPT partitioning tools usually show only the main GPT partition table, not the protective MBR.
To set the boot flag in the protective MBR, you can either use parted

Code: Select all

parted /dev/sdb disk_set pmbr_boot on
or fdisk

Code: Select all

fdisk -t dos /dev/sdb
a (activate boot flag)
w (write and quit)
or sfdisk

Code: Select all

sfdisk -Y dos -A /dev/sdb 1
PS : You could use LVM devices names /dev/mapper/* instead of UUIDs in /etc/fstab as the Debian installer does. Unlike /dev/sd* devices names, LVM devices names are stable (based on internal LVM UUIDs). And unlike UUIDs, they are nice.

linux001
Posts: 122
Joined: 2011-11-04 10:09

Re: no grub menu after fresh install of debian testing (GPT/BIOS)

#7 Post by linux001 »

p.H wrote: 2022-01-23 08:37 This is a waste. 100 kB is plenty enough. 1 MB is the usual recommended size for alignment.
Yeah, I agree. I wanted some empty space at the beginning for flexibility, which I ended up merging into the first partition.
p.H wrote: 2022-01-23 08:37 What do you mean exactly by "installed on /boot" ?
Sorry, that was unclear. I meant the modules in /boot/grub. However, the command used to install grub was

Code: Select all

grub-install --boot-dir=/boot /dev/sdb
p.H wrote: 2022-01-23 08:37 Or examine the first sector of the partition with

Code: Select all

hexdump -Cn 512 /dev/sdb1
It should print typical strings such as "loading", "Geom", "Read", "Error". You can do the same with /dev/sdb to check that GRUB boot image is present.
Hexdump of /dev/sdb1 confirms the presence of the strings you mentioned. And hexdump of /dev/sdb shows strings "GRUB", "geom", "hard disk", "read", and "error".
p.H wrote: 2022-01-23 08:37 Some broken BIOS require that an MBR partition entry has the boot flag set. I have never seen a BIOS or UEFI firmware which requires that a GPT partition entry has the legacy boot flag set. However GPT partitioning tools usually show only the main GPT partition table, not the protective MBR.
To set the boot flag in the protective MBR, you can either use parted

Code: Select all

parted /dev/sdb disk_set pmbr_boot on
or fdisk

Code: Select all

fdisk -t dos /dev/sdb
a (activate boot flag)
w (write and quit)
or sfdisk

Code: Select all

sfdisk -Y dos -A /dev/sdb 1
Thanks, I came across similar advice here (https://www.rodsbooks.com/gdisk/bios.html) and was planning to try it. I'll report back once I have done so. My BIOS is from 2011, and I've read that incompatibility with GPT mainly pertains to pre-2010 kernels (source: https://wiki.archlinux.org/title/Partit ... leshooting).
p.H wrote: 2022-01-23 08:37 PS : You could use LVM devices names /dev/mapper/* instead of UUIDs in /etc/fstab as the Debian installer does. Unlike /dev/sd* devices names, LVM devices names are stable (based on internal LVM UUIDs). And unlike UUIDs, they are nice.
Thanks, that's good to know. I wasn't aware that /dev/mapper IDs were considered stable. I'll do that going forward.

linux001
Posts: 122
Joined: 2011-11-04 10:09

Re: no grub menu after fresh install of debian testing (GPT/BIOS)

#8 Post by linux001 »

Unfortunately, setting the boot flag on the protective MBR did not solve the problem. Anything else worth trying or checking?

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: no grub menu after fresh install of debian testing (GPT/BIOS)

#9 Post by p.H »

You can try to set the "legacy boot" flag on GPT partition 1.
You can also try to create a hybrid MBR with gdisk.
But I doubt it helps.

Post Reply