Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub-install failed
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
freke
l33t
l33t


Joined: 23 Jan 2003
Posts: 975
Location: Somewhere in Denmark

PostPosted: Wed Jun 23, 2021 11:54 am    Post subject: Reply with quote

Are you sure that laptop supports EFI?
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Wed Jun 23, 2021 12:27 pm    Post subject: Reply with quote

Hi,
According to the grub - yes.

Thank you.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


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

PostPosted: Wed Jun 23, 2021 12:48 pm    Post subject: Reply with quote

ONEEYEMAN wrote:
According to the grub - yes.
No, GRUB cannot know that. Have you read previous answers? All that GRUB knows is that EFI variables are not supported. That's because:
  • The laptop supports UEFI but has been booted in "CSM mode" / "legacy mode" instead of "UEFI mode". In that case, it should be possible to change that using the firmware's user interface. Or
  • The laptop does not support UEFI at all, and a BIOS / MBR installation is your only option (i.e you can't use grub-install --target=x86_64-efi). In that case you might have to make changes to some of your current partitions in order to be able to install GRUB or Syslinux.
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Wed Jun 23, 2021 12:57 pm    Post subject: Reply with quote

Hi,
1. Is there a way to check for EFI support? And what can I do to make it boot into EFI?
2. Does this mean - start over?
Thank you.
Back to top
View user's profile Send private message
freke
l33t
l33t


Joined: 23 Jan 2003
Posts: 975
Location: Somewhere in Denmark

PostPosted: Wed Jun 23, 2021 1:27 pm    Post subject: Reply with quote

You might be able to see if EFI is supported by the motherboard with
Code:
dmidecode -t 0

Sample output from my small headless server
Code:
binhost ~ # dmidecode -t 0
# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.

Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
        Vendor: coreboot
        Version: v4.11.0.3
        Release Date: 01/29/2020
        ROM Size: 8 MB
        Characteristics:
                PCI is supported
                PC Card (PCMCIA) is supported
                BIOS is upgradeable
                Selectable boot is supported
                ACPI is supported
                Targeted content distribution is supported
        BIOS Revision: 4.11
        Firmware Revision: 0.0

Sample output from a system supporting UEFI
Code:
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
        Vendor: Acer
        Version: V1.05
        Release Date: 06/08/2011
        ROM Size: 2560 kB
        Characteristics:
                PCI is supported
                BIOS is upgradeable
                BIOS shadowing is allowed
                Boot from CD is supported
                Selectable boot is supported
                EDD is supported
                Japanese floppy for NEC 9800 1.2 MB is supported
                8042 keyboard services are supported (int 9h)
                CGA/mono video services are supported (int 10h)
                ACPI is supported
                USB legacy is supported
                BIOS boot specification is supported
                Targeted content distribution is supported
                UEFI is supported
        BIOS Revision: 5.240
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Wed Jun 23, 2021 2:21 pm    Post subject: Reply with quote

Hi,
This is my output: https://dpaste.com/FYFZ72YJR
Does this mean I should start over?

Thank you.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


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

PostPosted: Wed Jun 23, 2021 4:26 pm    Post subject: Reply with quote

ONEEYEMAN wrote:
Does this mean I should start over?

Not necessarily. Post the output of fdisk -l /dev/sda so that we can see the current GPT.
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Thu Jun 24, 2021 12:31 am    Post subject: Reply with quote

Hi,
This is the result of running fdisk: https://imgur.com/a/qj2mPNh.

Thank you.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


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

PostPosted: Thu Jun 24, 2021 2:22 am    Post subject: Reply with quote

The link seems broken. But why an image? fdisk -l prints text and exits...
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Thu Jun 24, 2021 3:15 am    Post subject: Reply with quote

Hi,
And now it worked. Didn't before, hence the image.

The output: https://dpaste.com/FW43MYT7R

Thank you.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


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

PostPosted: Thu Jun 24, 2021 1:58 pm    Post subject: Reply with quote

ONEEYEMAN wrote:
https://dpaste.com/FW43MYT7R
Code:
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
...
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
...

Device        Start       End   Sectors   Size Type
/dev/sda1      2048    526335    524288   256M EFI System
/dev/sda2    526336  17303551  16777216     8G Linux swap
/dev/sda3  17303552 976773134 959469583 457.5G Linux filesystem

And /dev/sda1 was supposed to be mounted at /boot? If yes, and if the laptop's BIOS firmware cooperates, one way to reuse all previous work with minimal changes could be:

1) Copy all kernel-related files from /dev/sda1 to /dev/sda3, i.e. have /boot be part of the root filesystem instead of getting its own partition. No need to do the same with GRUB-related files, because the bootloader part has to be redone.
2) Reuse /dev/sda1 for GRUB, removing it from /etc/fstab. That requires only a partition type change that can be done with fdisk.
3) Rerun grub-install, but for target i386-pc this time. That will destroy the FAT filesystem and its contents, but you would have already moved the important parts.
4) Rebuild GRUB's configuration file with grub-mkconfig (because GRUB's support files will have changed their location).
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Thu Jun 24, 2021 4:17 pm    Post subject: Reply with quote

GDH-gentoo wrote:

ONEEYEMAN wrote:

https://dpaste.com/FW43MYT7R

Code:

Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
...
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
...

Device        Start       End   Sectors   Size Type
/dev/sda1      2048    526335    524288   256M EFI System
/dev/sda2    526336  17303551  16777216     8G Linux swap
/dev/sda3  17303552 976773134 959469583 457.5G Linux filesystem

And /dev/sda1 was supposed to be mounted at /boot?

Yes.

GDH-gentoo wrote:

If yes, and if the laptop's BIOS firmware cooperates, one way to reuse all previous work with minimal changes could be:

1) Copy all kernel-related files from /dev/sda1 to /dev/sda3, i.e. have /boot be part of the root filesystem instead of getting its own partition. No need to do the same with GRUB-related files, because the bootloader part has to be redone.

So copy all kernel-related stuff to /dev/sda3/boot, right?

GDH-gentoo wrote:

2) Reuse /dev/sda1 for GRUB, removing it from /etc/fstab. That requires only a partition type change that can be done with fdisk.

What do I change it to? And will it kill the partition table or just change this type when I write it to disk?

GDH-gentoo wrote:

3) Rerun grub-install, but for target i386-pc this time. That will destroy the FAT filesystem and its contents, but you would have already moved the important parts.
4) Rebuild GRUB's configuration file with grub-mkconfig (because GRUB's support files will have changed their location).


Thank you.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


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

PostPosted: Thu Jun 24, 2021 11:01 pm    Post subject: Reply with quote

ONEEYEMAN wrote:
So copy all kernel-related stuff to /dev/sda3/boot, right?
To the /boot directory in /dev/sda3, yes. Which should be currently empty if you unmount /dev/sda1.

Temporarily mount /dev/sda1 somewhere else (e.g. /mnt) to access its contents and copy what you need.

ONEEYEMAN wrote:
What do I change it to?
To "BIOS boot" (4 I think).

ONEEYEMAN wrote:
And will it kill the partition table or just change this type when I write it to disk?
If you only change the partition type (with t) nothing should be killed. You are not changing partition sizes or something destructive like that. To be sure, use p to print the table before and after the change, and check that only the partition type has been modified.

But if something goes wrong, at worst you start over. You were already considering the possibility :wink:
Back to top
View user's profile Send private message
ian.au
Guru
Guru


Joined: 07 Apr 2011
Posts: 591
Location: Australia

PostPosted: Fri Jun 25, 2021 2:02 pm    Post subject: Reply with quote

Quote:
Hi,
1. Is there a way to check for EFI support? And what can I do to make it boot into EFI?
2. Does this mean - start over?
Thank you.

I don't see why you'd start over. Just finish your original install.

You get EFI support in the first instance by booting in EFI mode. It's not always straightforward to get there, but the key is to use the correct boot media.
On my last bare-metal install I used a knoppix9 USB for the convenience of having a graphical environment / internet for my install, and I had a copy lying around.
Despite knoppix booting in EFI mode, something prevented efivars being made available within the gentoo chroot - and when it came time to set up efibootmgr no efivars available on system.

So clearly the install media makes a difference - I made up a bootable USB Stick booted into the system with that, reloaded the chroot and was all good to roll.
You don't say what media you're using. Make one of these up if you haven't already.

When you want to boot from the gentoo {usb,cd} to do the install, [F2]-mash your way in to the bios settings and;
    1. disable secure boot
    2. ensure uefi boot is enabled
    3. disable legacy boot
Point the first boot device at your {usb,cd} and [F10] and finish booting into the minimal environment.

In there, you should now have access to efivars, and you are a chance of moving a UEFI boot forward. Until you successfully make that first efi boot, you won't get anywhere.

Reading through this thread, I think you have an install ready to go, but you've never been able to boot into it for lack of the correct EFI boot environment.

I don't use grub with my UEFI install, just keep everything very simple. All you really need to get booting is to cp your built bzImage over into an EFI folder on /Boot and use efibootmgr to tell the NVRAM where to find it.

To give you an idea what you are heading for, once booted in EFI mode, check presence of efivars and ensure you are able to write them ie.
Code:
gw-01 ~ # mount |grep efivars
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
If not in rw mode that will be a gotcha when you try to write the boot entry, so
Code:
root #mount -o remount,rw -t efivarfs efivarfs /sys/firmware/efi/efivars
like it says in https://wiki.gentoo.org/wiki/Efibootmgr#EFI_vars

Edit to add (as fat-fingered submit in the preview window before done)
My install procedure for EFI is basically per https://wiki.gentoo.org/wiki/EFI_stub

I'm reluctant to put the next bit in, because I know you'll try and cut paste to taste rather than understand how this works, try not to do that.

On my system I have a couple of ssd, each has an EFI partition in the event I want it. My partition layouts are as follows (you don't need these, what you have will be fine but it will make sense of the next bit if you know this):
Code:
gw-01 ~ # fdisk -l
Disk /dev/nvme0n1: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 970 EVO Plus 500GB         
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: 979E1ED5-6A46-9C40-8108-C43D9EF648FD

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048    526335    524288   256M EFI System
/dev/nvme0n1p2    526336 134744063 134217728    64G Linux swap
/dev/nvme0n1p3 134744064 976773134 842029071 401.5G Linux filesystem


Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: CT1000MX500SSD4
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: A3A22D4C-E24F-8648-B8F1-64243AE6F016

Device      Start        End    Sectors   Size Type
/dev/sda1    2048     526335     524288   256M EFI System
/dev/sda2  526336 1953525134 1952998799 931.3G Linux filesystem

In this system, then:
Code:
gw-01 ~ # blkid
/dev/nvme0n1p1: LABEL_FATBOOT="efi-boot" LABEL="efi-boot" UUID="0CB2-C3A2" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="37f8ebe1-4158-5248-a6ba-53fd782b2bf5"
/dev/nvme0n1p2: UUID="347274cb-80f5-4597-b63c-a1b235b2fee5" TYPE="swap" PARTUUID="a776c8df-b03e-2941-84d9-641b35b8d729"
/dev/nvme0n1p3: UUID="d4029a6a-f7ff-45b3-89ec-ad720614edcb" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="5af196a2-46a6-0249-9dc3-a608daa21e67"
/dev/sda1: UUID="DBA6-0716" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="301ad43e-285b-dc4c-b4cd-d378204ef7b6"
/dev/sda2: UUID="1147f6cc-f863-4124-999e-ac593187a432" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="2dfd2008-dad9-e042-9eb2-5dce4700f9dc"

In this case I'm booting from sda1 with root on nvme0n1p3 - refer PARTUUID in
Code:
gw-01 ~ # cat /etc/fstab
# <fs>                                          <mountpoint>    <type>  <opts>          <dump/pass>
PARTUUID=301ad43e-285b-dc4c-b4cd-d378204ef7b6   /boot/efi       vfat    noatime                 1 2
PARTUUID=5af196a2-46a6-0249-9dc3-a608daa21e67   /               ext4    defaults,noatime        0 1
PARTUUID=a776c8df-b03e-2941-84d9-641b35b8d729   swap            swap    sw                      0 0

# Portage TMPFS
tmpfs   /var/tmp/portage        tmpfs   size=16G,uid=portage,gid=portage,mode=775,nosuid,noatime,nodev 0 0


Install app-text/tree within your chroot, mount up /boot and
Code:
tree /boot -L 3
so you can see everything clearly
Code:
gw-01 ~ # mount /dev/sda1 /boot
gw-01 ~ # tree /boot -L 3
/boot
├── EFI
│   ├── early_ucode.cpio
│   └── Gentoo
│       ├── bzImage-5.10.27.efi
│       ├── bzImage-5.10.27.efi.bak
│       ├── bzImage-5.4.97.efi
│       └── bzImage-5.4.97-i.efi
└── tools

3 directories, 5 files

So make sure you have created a directory /boot/EFI/Gentoo and copy the kernel you cooked in you chroot over there ie.
Code:
cp /usr/src/linux/arch/x86/boot/bzImage /boot/EFI/Gentoo/bzImage-5.10.27.efi

Tell the NVRAM about it
Code:
efibootmgr -c -d /dev/sda -p 1 -L "Gentoo-5.10.27" -l '\EFI\Gentoo\bzImage-5.10.27.efi'


There really isn't much more to it than that, I don't need grub to boot these systems.

Hopefully some pointers there.
Edit 2 fix typo
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4125
Location: Bavaria

PostPosted: Fri Jun 25, 2021 5:13 pm    Post subject: Reply with quote

ian.au,

your post is very instructive ... but will not help @ONEEYEMAN, because he did a "dmidecode -t 0" which told him he has NO UEFI-capable system. So the instructions of @GDH-gentoo will do the right things for him. (I wrote this only to not confuse @ONEEYEMAN)
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Fri Jun 25, 2021 5:14 pm    Post subject: Reply with quote

ian.au,
Yes, I have an install ready. All I need is to set the GRUB up.
And despite the fact that my minimal CD successfully booted up (I presume by default in EFI mode), installing GRUB failed to read it.

Also, my BIOS doesn't support switching modes - it doesn't have such options. However, it did have Winblows 7 originally, so I was hoping to do EFI install.

I will check the links you posted later.

Thank you.
Back to top
View user's profile Send private message
ian.au
Guru
Guru


Joined: 07 Apr 2011
Posts: 591
Location: Australia

PostPosted: Fri Jun 25, 2021 10:32 pm    Post subject: Reply with quote

Ah I missed that, I read the dmidecode output of freke and missed Igor's dpaste

If you don't have a uefi bios, indeed GDH-Gentoo has the solution.
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Sun Jul 25, 2021 2:41 am    Post subject: Reply with quote

GDH-gentoo,
First, sorry for the long delay.
I had to do some stuff with my program and then g home for funeral.

Second - the way you suggested worked. Kind of.

I did all 4 steps, then rebooted and got the following screenshot.

Thank you.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


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

PostPosted: Sun Jul 25, 2021 3:37 pm    Post subject: Reply with quote

ONEEYEMAN wrote:
I did all 4 steps, then rebooted and got the following screenshot.

Code:
sd 0:0:0:0: [sda] Attached SCSI removable disk
...
VFS: Cannot open root device "sda3" or unknown-block(8,3): error -123
Please append a correct "root=" boot option: Here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,3)

Removable disk? OK, so the bootloader worked and now it's a kernel problem, or wrong kernel command line. Just to check, boot again with an installation medium, chroot to Gentoo, and post the outputs of fdisk -l (without specifying a disk) and blkid, and the contents of /boot/grub/grub.cfg.
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Sun Jul 25, 2021 5:12 pm    Post subject: Reply with quote

Hi,
1st command - here.
2nd command - here.
3rd command - here.

Thank you.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


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

PostPosted: Sun Jul 25, 2021 7:00 pm    Post subject: Reply with quote

OK, next question, which kernel did you use for your Gentoo system? sys-kernel/gentoo-sources and a manual build? If yes, can you also put the kernel's .config file in a pastebin site?
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Sun Jul 25, 2021 7:16 pm    Post subject: Reply with quote

Hi,
Yes, it is gentoo-sources and the config is here.

Thank you.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


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

PostPosted: Sun Jul 25, 2021 8:27 pm    Post subject: Reply with quote

Can you also post the output of lspci -nnk? I'm surprised that the output of the failed boot says that /dev/sda is a removable disk, and that the Gentoo kernel apparently can't see the partition table, or, at least, partition 3 ("error=-123", i.e. "No medium found"), even though I can't see any obvious error in the kernel's configuration.
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Sun Jul 25, 2021 8:39 pm    Post subject: Reply with quote

Hi,
I got the following:

Code:

lspci -nnk | wgetpaste
Unable to load libknode resources: error 2
Paste can be seen here: http://dpaste.com/3JWPLNA7B


Thank you.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


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

PostPosted: Sun Jul 25, 2021 9:12 pm    Post subject: Reply with quote

ONEEYEMAN wrote:
Yes, it is gentoo-sources and the config is here.

Code:
# CONFIG_SATA_AHCI is not set

ONEEYEMAN wrote:
Paste can be seen here: http://dpaste.com/3JWPLNA7B

Code:
00:1f.2 SATA controller [0106]: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 4 port SATA Controller [AHCI mode] [8086:2929] (rev 03)
   Subsystem: Dell 82801IBM/IEM (ICH9M/ICH9M-E) 4 port SATA Controller [AHCI mode] [1028:02aa]
   Kernel driver in use: ahci

Add this to your kernel configuration:
Code:
Device Drivers  --->
   <*> Serial ATA and Parallel ATA Drivers (libata)  --->
   <*>   AHCI SATA Support

Then rebuild and reinstall the kernel, rebuild GRUB's configuration file if needed, and try booting again.
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
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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