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

 

 

 

[solved]problems with grub and efi

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

[solved]problems with grub and efi

#1 Post by milomak »

So i am pretty sure i installed this system using uefi but on another computer

I have since moved the hard drive to another compuetr. The first inkling that things weren’t right was when I booted into the BIOS to find the drive is not seen in UEFI but only when Legacy mode is also included. It boots in Legacy mode.

The disk is partitioned as

Code: Select all

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sda1  *      2048    206847    204800   100M  b W95 FAT32
/dev/sda2       206848 468860927 468654080 223.5G 83 Linux
/dev/sda1 is mounted on /boot/efi

But when I try run
# grub-install /dev/sda

Code: Select all

grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist. Please specify --target or --directory.
The installed grub packages
# dpkg -l | grep grub

Code: Select all

ii  grub-common                                                 2.02+dfsg1-20+deb10u2                 amd64        GRand Unified Bootloader (common files)
ii  grub-customizer                                             5.1.0-3                               amd64        GUI to configure GRUB2 and BURG
ii  grub-efi                                                    2.02+dfsg1-20+deb10u2                 amd64        GRand Unified Bootloader, version 2 (dummy package)
ii  grub-efi-amd64                                              2.02+dfsg1-20+deb10u2                 amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 version)
ii  grub-efi-amd64-bin                                          2.02+dfsg1-20+deb10u2                 amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 modules)
ii  grub-efi-amd64-signed                                       1+2.02+dfsg1+20+deb10u2               amd64        GRand Unified Bootloader, version 2 (amd64 UEFI signed by Debian)
hi  grub2-common                                                2.02+dfsg1-20+deb10u2                 amd64        GRand Unified Bootloader (common files for version 2)
I installed the signed and customizer packages after the problems

So to try and resolve this I picked up what is believed should work. Using the debian 10 live dvd, I chroot into the system

Code: Select all

# mount /dev/sda2 /mnt
# mount /dev/sda1 /mnt/boot/efi
# for name in proc sys dev; do mount --bind /$name /mnt/$name; done
# chroot /mnt /bin/bash
# mount -t efivarfs efivarfs /sys/firmware/efi/efivars
# grub-install /dev/sda
Grub reports no errors. I can see there are files in /sys/firmware/efi/efivars

But of course when I reboot I get the error above

Some other things I have looked at
# modprobe efivars

Code: Select all

modprobe: ERROR: could not insert 'efivars': No such device
# efivar -l

Code: Select all

efivar: error listing variables: Function not implemented
# efibootmgr

Code: Select all

 
EFI variables are not supported on this system.
Is there anything else I can do to get efivars onto the system? I assume that copying the efivar folder in /sys won't help.
Last edited by milomak on 2020-10-29 19:03, edited 1 time in total.
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

sgosnell
Posts: 975
Joined: 2011-03-14 01:49

Re: problems with grub and efi

#2 Post by sgosnell »

I tend to doubt that you installed efi the first time. For that, you need two FAT32 partitions, one for /boot and one for /boot/efi. You show only a boot partition. I'm far from expert on this, but I think you need to repartition to get efi to work.
Take my advice, I'm not using it.

milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

Re: problems with grub and efi

#3 Post by milomak »

sgosnell wrote:I tend to doubt that you installed efi the first time. For that, you need two FAT32 partitions, one for /boot and one for /boot/efi. You show only a boot partition. I'm far from expert on this, but I think you need to repartition to get efi to work.
/boot is on the root partition and /boot/efi is on the vfat partition
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

Re: problems with grub and efi

#4 Post by milomak »

right so the issue is partially solved.

when in uefi mode, the drive with my debian is not picked up by the boot order. it is when in legacy mode. my preferred route is that the debian disk is the primary disk so that if a reboot happens, then debian will be the os loaded.

however when in uefi mode, if i open the boot options the seen (not via bios) but whatever they call the secondary one; the debian install is there picked up from the drive and boots.

i can see the uefi related stuff when i run efivar -l and efibootmgr

i'll be heading over to the manufacturer sites to see what is happening
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

sgosnell
Posts: 975
Joined: 2011-03-14 01:49

Re: [solved]problems with grub and efi

#5 Post by sgosnell »

/boot should be on a separate vfat partition if you use efi. It works fine from the root partition with legacy boot, but I don't think it will work properly that way using UEFI.
Take my advice, I'm not using it.

milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

Re: [solved]problems with grub and efi

#6 Post by milomak »

sgosnell wrote:/boot should be on a separate vfat partition if you use efi. It works fine from the root partition with legacy boot, but I don't think it will work properly that way using UEFI.
this is not true

you can mount /boot in the root partition

and then mount the efi directory afterwards in /boot/efi from a vfat (this will replace the /boot/efi directory that is the root partition)

i have done the same on my laptop which is picked up by uefi. debian needs the directory /boot/efi on a vfat. i don't it really cares where /boot itself is.
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

User avatar
sunrat
Administrator
Administrator
Posts: 6495
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 118 times
Been thanked: 476 times

Re: [solved]problems with grub and efi

#7 Post by sunrat »

sgosnell wrote:/boot should be on a separate vfat partition if you use efi. It works fine from the root partition with legacy boot, but I don't think it will work properly that way using UEFI.
That is incorrect but maybe you're just misusing the terms. The EFI system partition (ESP) must be a separate FAT32 partition but that can be mounted to a boot directory inside the main root partition "/" as /boot/efi . There is no need for a separate /boot partition.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

sgosnell
Posts: 975
Joined: 2011-03-14 01:49

Re: [solved]problems with grub and efi

#8 Post by sgosnell »

As I said, I'm no expert on UEFI. Every installer I've used makes a separate /boot partition, but perhaps that's just convention, not a requirement.
Take my advice, I'm not using it.

milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

Re: [solved]problems with grub and efi

#9 Post by milomak »

sgosnell wrote:As I said, I'm no expert on UEFI. Every installer I've used makes a separate /boot partition, but perhaps that's just convention, not a requirement.
if that is the case, it would be a convention much like installers tend to create a seperate /home partition. all that matters for uefi from a partitioning point of view is that /boot/efi is on a vfat/fat32 partition
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

Dai_trying
Posts: 1101
Joined: 2016-01-07 12:25
Has thanked: 6 times
Been thanked: 16 times

Re: [solved]problems with grub and efi

#10 Post by Dai_trying »

milomak wrote:all that matters for uefi from a partitioning point of view is that /boot/efi is on a vfat/fat32 partition
Not quite right, the ESP partition needs to be fat32, /boot/efi can be in your root partition and the ESP partition mounted there at startup (as is the default setting when using the "all on one drive" {recommended for new users} option in the installer).

milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

Re: [solved]problems with grub and efi

#11 Post by milomak »

Dai_trying wrote:
milomak wrote:all that matters for uefi from a partitioning point of view is that /boot/efi is on a vfat/fat32 partition
Not quite right, the ESP partition needs to be fat32, /boot/efi can be in your root partition and the ESP partition mounted there at startup (as is the default setting when using the "all on one drive" {recommended for new users} option in the installer).
as i said /boot can be mounted in the root partition. and you further mount /boot/efi which is on a vfat
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

Post Reply