[solved]problems with grub and efi

Kernels & Hardware, configuring network, installing services

[solved]problems with grub and efi

Postby milomak » 2020-10-28 21:50

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
Laptop: Lenovo ideapad Y700-15ISK [nVidia Optimus] (64-bit) - Sid, Win10, Solus
Kodi Box: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid
milomak
 
Posts: 2074
Joined: 2009-06-09 22:20

Re: problems with grub and efi

Postby sgosnell » 2020-10-28 22:14

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.
sgosnell
 
Posts: 906
Joined: 2011-03-14 01:49

Re: problems with grub and efi

Postby milomak » 2020-10-29 10:02

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
Laptop: Lenovo ideapad Y700-15ISK [nVidia Optimus] (64-bit) - Sid, Win10, Solus
Kodi Box: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid
milomak
 
Posts: 2074
Joined: 2009-06-09 22:20

Re: problems with grub and efi

Postby milomak » 2020-10-29 19:02

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
Laptop: Lenovo ideapad Y700-15ISK [nVidia Optimus] (64-bit) - Sid, Win10, Solus
Kodi Box: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid
milomak
 
Posts: 2074
Joined: 2009-06-09 22:20

Re: [solved]problems with grub and efi

Postby sgosnell » 2020-10-29 19:47

/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.
sgosnell
 
Posts: 906
Joined: 2011-03-14 01:49

Re: [solved]problems with grub and efi

Postby milomak » 2020-10-29 19:52

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
Laptop: Lenovo ideapad Y700-15ISK [nVidia Optimus] (64-bit) - Sid, Win10, Solus
Kodi Box: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid
milomak
 
Posts: 2074
Joined: 2009-06-09 22:20

Re: [solved]problems with grub and efi

Postby sunrat » 2020-10-29 22:13

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!
User avatar
sunrat
 
Posts: 3316
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: [solved]problems with grub and efi

Postby sgosnell » 2020-10-30 00:50

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.
sgosnell
 
Posts: 906
Joined: 2011-03-14 01:49

Re: [solved]problems with grub and efi

Postby milomak » 2020-10-30 09:52

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
Laptop: Lenovo ideapad Y700-15ISK [nVidia Optimus] (64-bit) - Sid, Win10, Solus
Kodi Box: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid
milomak
 
Posts: 2074
Joined: 2009-06-09 22:20

Re: [solved]problems with grub and efi

Postby Dai_trying » 2020-10-30 19:46

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).
Dai_trying
 
Posts: 943
Joined: 2016-01-07 12:25

Re: [solved]problems with grub and efi

Postby milomak » 2020-11-01 10:24

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
Laptop: Lenovo ideapad Y700-15ISK [nVidia Optimus] (64-bit) - Sid, Win10, Solus
Kodi Box: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid
milomak
 
Posts: 2074
Joined: 2009-06-09 22:20


Return to System configuration

Who is online

Users browsing this forum: trinidad and 23 guests

fashionable