Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] potential grub2 i386-pc problems ???
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
dpaddy
Tux's lil' helper
Tux's lil' helper


Joined: 25 Jun 2008
Posts: 129

PostPosted: Thu Sep 03, 2020 6:56 pm    Post subject: [SOLVED] potential grub2 i386-pc problems ??? Reply with quote

I am trying to build a new system (AB350M Pro4 motherboard) using a disk which I do not want to reformat, but would like to install GRUB2.
Code:
livecd ~ # parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit mib                                                         
unit mib
(parted) print                                                           
print
Model: ATA WDC WD1005FBYZ-0 (scsi)
Disk /dev/sda: 953870MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start     End        Size       File system     Name    Flags
 1      1.00MiB   9.00MiB    8.00MiB                    grub    bios_grub
 2      9.00MiB   1027MiB    1018MiB    ext2            boot    boot, esp
 3      1027MiB   33795MiB   32768MiB   linux-swap(v1)  swap
 4      33795MiB  953869MiB  920074MiB  ext4            rootfs

I have a number of issues...

First, whereas I think there are both "PC BIOS" and "64-bit UEFI" options for the "GRUB_PLATFORM" (I am x86_64 AMD Ryzen 7 1800X) my muddled understanding is that "64-bit UEFI" is not an option for my scenario because dev/sda1 is too small and /dev/sda2 is ext2. Am I correct???

Second, assuming that "PC BIOS" was my only option, I put 'GRUB_PLATFORMS="pc"' in /etc/portage/make.conf and then -- after the usual mounting and chroot -- I proceeded with
Code:
(chroot) livecd / # emerge  sys-boot/grub:2
and then
Code:
(chroot) livecd / # grub-install /dev/sda
grub-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory.

I suppose the error is not unsurprising because
Code:
(chroot) livecd / # ls /usr/lib/grub/
i386-pc
Comparing with an old system I get a different result,
Code:
dpaddy # ls /usr/lib/grub/
i386-pc  x86_64-efi
so it looks like /usr/lib/grub/x86_64-efi is missing hence the error messge. Moreover, the old system I compare with boots fine and
Code:
dpaddy # parted /dev/sdb
GNU Parted 3.2
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit mib                                                         
(parted) print                                                           
Model: ATA WDC WD1005FBYZ-0 (scsi)
Disk /dev/sdb: 953870MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start     End        Size       File system     Name    Flags
 1      1.00MiB   9.00MiB    8.00MiB                    grub    bios_grub
 2      9.00MiB   1027MiB    1018MiB    ext2            boot    boot, esp
 3      1027MiB   33795MiB   32768MiB   linux-swap(v1)  swap
 4      33795MiB  953869MiB  920074MiB  ext4            rootfs
so the partitioning scheme on the old system seems the same... After reading the man page for grub-install I proceeded with
Code:
(chroot) livecd / # grub-install --target=i386-pc /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
My question here is: is there a miss-match between "Installing for i386-pc platform" and "x86_64 AMD Ryzen 7 1800X", and if so what consequences (performance, future software install/upgrade headaches,...) might I suffer and so should be aware of if I proceed from here???

Third, if I don't get potential problems sorted out here, then when I later attempt to upgrade/update the old system (X370 taichi motherboard) and if I follow the same path am I headed for trouble???

I suppose a summary would be that I feel ignorant and unconfident at this point and would appreciate guidance from someone who really knows what is going on :oops:


Last edited by dpaddy on Fri Sep 04, 2020 7:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 46279
Location: 56N 3W

PostPosted: Thu Sep 03, 2020 8:23 pm    Post subject: Reply with quote

dpaddy,

You have a number of choices. I'll try to explain a little.

Mixing BIOS Booting and GPT is getting harder as the legacy BIOS option is not well tested and BIOS vendors are not interested in fixing it.
Use UEFI mode if at all possible. Starting with your partition table.

Code:
Partition Table: gpt
Disk Flags:

Number  Start     End        Size       File system     Name    Flags
 1      1.00MiB   9.00MiB    8.00MiB                    grub    bios_grub
 2      9.00MiB   1027MiB    1018MiB    ext2            boot    boot, esp
 3      1027MiB   33795MiB   32768MiB   linux-swap(v1)  swap
 4      33795MiB  953869MiB  920074MiB  ext4            rootfs
Its GPT, not DOS. Good. UEFI booting only works with GPT.

Code:
Number  Start     End        Size       File system     Name    Flags
 1      1.00MiB   9.00MiB    8.00MiB                    grub    bios_grub
The bios_grub partition is used by grub. Its not yours, it does not appear in /etc/fstab.
Further, grub only uses it when you BIOS boot an a HDD that uses GPT. For you its going to be wasted space.

Code:
Number  Start     End        Size       File system     Name    Flags
 2      9.00MiB   1027MiB    1018MiB    ext2            boot    boot, esp
This is your /boot, if you have a separate /boot partition and your esp too.
Regardless of the filesystem type in the partition table, it must actually be formatted vfat. That's the only filesystem that EFI can read and its going to load grub for here.

If its not already vfat, save the contents somwhere, reformat it then restore the content.
vfat does not support symbolic links.

Code:
Number  Start     End        Size       File system     Name    Flags
 3      1027MiB   33795MiB   32768MiB   linux-swap(v1)  swap
 4      33795MiB  953869MiB  920074MiB  ext4            rootfs
That's conventional.

dpaddy wrote:
First, whereas I think there are both "PC BIOS" and "64-bit UEFI" options for the "GRUB_PLATFORM" (I am x86_64 AMD Ryzen 7 1800X) my muddled understanding is that "64-bit UEFI" is not an option for my scenario because dev/sda1 is too small and /dev/sda2 is ext2. Am I correct???

That's correct if its true. The partition type in the partition table need not reflect reality.

What does
Code:
mount
or
Code:
df -T
say it is?

Proceed on the basis that you will use 64-bit UEFI.

Code:
(chroot) livecd / # grub-install --target=i386-pc /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
Has installed grub for BIOS booting.

Does your motherboard firmware support that?
It will be called something like Legacy Mode.
If it does, it may just boot. If not, you need to go down the 64-bit UEFI path.

dpaddy wrote:
I suppose a summary would be that I feel ignorant and unconfident at this point and would appreciate guidance from someone who really knows what is going on

Welcome to the club. That feeling never goes away. I've been playing with computers for well over 50 years. It gets replaced by the confidence to try things and back out those that don't work.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
dpaddy
Tux's lil' helper
Tux's lil' helper


Joined: 25 Jun 2008
Posts: 129

PostPosted: Fri Sep 04, 2020 7:45 pm    Post subject: Reply with quote

O.K. so I've tried to go UEFI but I can't boot... after showing the uuid of the correct disk i see "not a valid root device".
Assuming that I've botched the kernel I will crawl through make menuconfig and rebuild.
I've never made UEFI boot before so am less than confident (not quite true, the rescue usb -- which I did not build -- boots UEFI).
I'll mark this "SOLVED" and open a new thread with details asking for advice when I inevitably fail.
Back to top
View user's profile Send private message
dpaddy
Tux's lil' helper
Tux's lil' helper


Joined: 25 Jun 2008
Posts: 129

PostPosted: Fri Sep 04, 2020 9:32 pm    Post subject: woot Reply with quote

The kernel was my problem; useful in that regard (when booted from rescue USB) was
Code:
# lspci -v | sed -n -e '/Kernel driver in use:/p'

All good now :D
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