Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Fresh install with GPT, UEFI and GRUB2
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
lesha_n
n00b
n00b


Joined: 15 Nov 2007
Posts: 61

PostPosted: Tue Sep 27, 2016 7:09 pm    Post subject: Fresh install with GPT, UEFI and GRUB2 Reply with quote

Hi, I am having a problem with a fresh install on a new disk /dev/sdb using GPT, UEFI and GRUB2. I am following the installation guide closely (https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks), but getting confused with GPT, UEFI and GRUB2. Never used GPT/UEFI before, but this is a fresh install, GPT is the recommended way in the manual, and my system should support UEFI, so I figured I'd try.

Here is my partition scheme:

Code:

# parted -a optimal /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 Samsung SSD 850 (scsi)
Disk /dev/sdb: 238475MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start     End        Size       File system     Name    Flags
 1      1.00MiB   3.00MiB    2.00MiB                    grub    bios_grub
 2      3.00MiB   131MiB     128MiB     fat16           boot    boot, esp
 3      131MiB    34947MiB   34816MiB   linux-swap(v1)  swap
 4      34947MiB  38019MiB   3072MiB    ext4            rootfs
 5      38019MiB  238474MiB  200455MiB                  lvmfs   lvm


It breaks when trying to install GRUB2:

Code:

grub-install --target=x86_64-efi --efi-directory=/boot

    Installing for x86_64-efi platform.
    grub-install: error: /boot doesn't look like an EFI partition.
    .


I am obviously doing something wrong with the BIOS boot and boot partitions. Am I using the right flags and file system types for those? Do the BIOS boot partition has to have a file system, and which?

Thank you,
Aleksey
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7553
Location: Goose Creek SC

PostPosted: Tue Sep 27, 2016 10:24 pm    Post subject: Reply with quote

Handbook is sketchy for UEFI. https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide is better for linux OS's only. https://wiki.gentoo.org/wiki/UEFI_Dual_boot_with_Windows_7/8 if win7/8/10 involved.
UEFI does not need /dev/sdb1 as grub will install its files on the ESP (/dev/sdb2)(not a problem). If /dev/sdb2 is formatted FAT32(VFAT) and mounted at /boot at the time the command grub-install --target=x86_64-efi --efi-directory=/boot is issued it should succeed.
Backup /boot directory somewhere, unmount and format boot partition as FAT32, mount boot partition at /boot, restore it from the backup, emerge grub again, run grub-install --target=x86_64-efi --efi-directory=/boot, run grub-mkconfig -o /boot/grub/grub.cfg
As you are using /dev/sdb, there is presumably a /dev/sda, leading to the questions: Is there another OS on the machine? If so, is it UEFI? If so, is it also with its own ESP? Having more than one ESP on a machine can be problematic.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
lesha_n
n00b
n00b


Joined: 15 Nov 2007
Posts: 61

PostPosted: Wed Sep 28, 2016 5:44 pm    Post subject: Reply with quote

DONAHUE, thank you for your help. Sakaki's EFI tutorial is very detailed, I may be able to gain some bits and pieces from it, even though much of it is above and beyond my needs and understanding at the moment (e.g. cryptography, LUKS). You nailed the problem -- I forgot to mount the boot partition, so it was going to / instead, which of course is not vfat. With /boot mounted and some cleanup, install completed with no problems.

However, I am not able to boot into the new system. My mobo (Gigabyte Z77X-UD3H) has dual BIOS/UEFI boot. I can select the entry for the new disk, it is in fact boot option #1 ("UEFI: Samsung SSD 850 EVO 250 GB"), but if I pick it, the system instead goes to the next option, bringing up the GRUB2 menu on my first disk (/dev/sda). If I disable all boot options except the new UEFI option, I get an error message:

Quote:
Reboot and Select proper boot device or Insert Boot Media in selected Boot Device and press a key


It looks to me like UEFI does not find anything suitable on /dev/sdb and so proceeds to other boot options, if available.

As far as /dev/sda -- it contains my current Gentoo installation, using MBR, so no UEFI or ESP. It's working fine, just old(ish) and the disk is almost full. I need to be able to boot into it for a while, either through the BIOS setup menu, or (better) via GRUB2 on the new /dev/sdb (once I get it to work). There is no Windows or any other OS on /dev/sda.

Many thanks,
Aleksey
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7553
Location: Goose Creek SC

PostPosted: Wed Sep 28, 2016 9:16 pm    Post subject: Reply with quote

you did not mention going to FAT32 vice FAT16 for the ESP(boot) partition? Most uefi implementations will not read FAT16.
did you install from a uefi cd/usb or from the installed gentoo on /dev/sda? Takes UEFI to install UEFI
suggest boot a uefi cd/usb in uefi mode, mount the gentoo partitions, enter the chroot,
Code:
emerge wgetpaste efibootmgr
and run
Code:
ls -lR /boot | wgetpaste -t
fdisk -l | wgetpaste -t
/boot/grub/grub.cfg | wgetpaste -t
mount | wgetpaste -t
efibootmgr | wgetpaste -t
Post the url's returned.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
lesha_n
n00b
n00b


Joined: 15 Nov 2007
Posts: 61

PostPosted: Thu Sep 29, 2016 3:55 pm    Post subject: Reply with quote

DONAHUE, thanks for your help. I did not realize that it takes UEFI to install UEFI! I will definitely do that and post the URLs for you as soon as I can boot with a UEFI system and have wifi.

I have the latest LiveDVD and I see that I can boot into it in the UEFI mode (via BIOS menu when booting). The problem I have with the LiveDVD is that I could not get my wifi to work in it, so no connection; that's why I did the install from my working Gentoo system on /dev/sda. I'll give it another shot, try to copy over my config files (net and wpa_supplicant in /etc/conf.d), perhaps I could get it to connect.

Maybe I should try a USB approach too. I think I've tried creating a LiveUSB before, but could't get it to work. Instructions I found (https://wiki.gentoo.org/wiki/LiveUSB/Guide) are a little unclear on whether a simple dd command will do, or one has to follow through the manual installation. Do you know if a USB created in this way will support UEFI?

Regards,
Aleksey
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7553
Location: Goose Creek SC

PostPosted: Thu Sep 29, 2016 5:04 pm    Post subject: Reply with quote

I think you can use efibootmgr from a uefi install medium to add grub to the boot options without doing a total reinstall.
https://www.system-rescue-cd.org/Sysresccd-manual-en_How_to_install_SystemRescueCd_on_an_USB-stick and you get wifi and you can boot to to an xfce4 GUI with a browser.
filling the pastebins suggested above will help
_________________
Defund the FCC.
Back to top
View user's profile Send private message
lesha_n
n00b
n00b


Joined: 15 Nov 2007
Posts: 61

PostPosted: Sun Oct 02, 2016 12:33 am    Post subject: Reply with quote

DONAHUE,

I was able to fix networking in the Gentoo LiveDVD boot (via UEFI as you suggested). Here are the results after redoing steps on the "Configuring the bootloader" installation page:

ls -lR /boot | wgetpaste -t
https://paste.pound-python.org/show/zlBVPXN8ZFG2iKHlEMWm/

fdisk -l | wgetpaste -t
https://paste.pound-python.org/show/YMdsN4zpf1VCyPUSVsCi/

/boot/grub/grub.cfg | wgetpaste -t
https://paste.pound-python.org/show/yIie2eRTyQNCCyWn3Y7s/

mount | wgetpaste -t
https://paste.pound-python.org/show/uULw8N7BCuKcB1Ng96xC/

efibootmgr | wgetpaste -t
https://paste.pound-python.org/show/jTp1lvPPU00LzDNdSEyN/


For /boot/grub/grub.cfg, did you want to see the actual file (so perhaps cat /boot/grub/grub.cfg | wgetpaste -t)?

Thank you for your help!

UPDATE: I can boot into the new system, but I do nof see my wifi interface anymore (onlg lo), and loading the module for it does not help. Do I need to do a complete reinstall, i.e. kernel, initramfs, emerge world, ...?
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7553
Location: Goose Creek SC

PostPosted: Sun Oct 02, 2016 12:35 pm    Post subject: Reply with quote

are you seeing the grub boot menu during the boot process?
should only need to fix wifi. boot the install media or the previous linux and run lspci -k (adapter builtin), lsusb (usb adapter), or lshw | grep -i -A20 "*-network" (either onboard or usb adapter) What is the name of the wireless adapter? If wireless is working what driver is used?
boot the new gentoo system, run
Code:
emerge linux-firmware wpa_supplicant lspci lsusb lshw iw wireless-tools netifrc dhcpcd
ifconfig -a
does the wireless interface appear in response to ifconfig -a? if so the kernel contains the appropriate driver. If not the kernel configuration needs modification.
If ifconfig -a shows the wireless interface: what name does it have?
_________________
Defund the FCC.
Back to top
View user's profile Send private message
lesha_n
n00b
n00b


Joined: 15 Nov 2007
Posts: 61

PostPosted: Fri Oct 07, 2016 5:39 pm    Post subject: Reply with quote

DONAHUE,

Sorry for a long delay. The problem was that my /usr is on LVM, do the dolvm option needed to be added to the kernel boot line, otherwise all /usr was simply missing. Once that was fixed the wifi interface came up and I got it to work.

Strangely though, as far as the grub boot menu, once I reinstalled the bootloader (from within a UEFI live DVD as you suggested), my BIOS does not by default go to the UEFI install, even though it is set as the first boot option. If there are other boot options in BIOS, it skips right to those (e.g. my old non-UEFI Gentoo install), and if all other boot options are disabled, it just hangs. I have to go through the BIOS setup (F12) every time I boot, and then I am able to see the UEFI option (named "gentoo") and run it. Perhaps I should reset my BIOS setup to defaults, or upgrade BIOS firmware, or reinstall the bootloader again?

Thank you,
Aleksey

P.S. Regarding what you mentioned before -- that the handbook is not clear on UEFI install -- perhaps I'll drop a line to the handbook maintainers...
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7553
Location: Goose Creek SC

PostPosted: Fri Oct 07, 2016 6:18 pm    Post subject: Reply with quote

in your original post you had:
Quote:
2 3.00MiB 131MiB 128MiB fat16 boot boot, esp
Did you ever reformat /dev/sdb2 to FAT32?
_________________
Defund the FCC.
Back to top
View user's profile Send private message
lesha_n
n00b
n00b


Joined: 15 Nov 2007
Posts: 61

PostPosted: Fri Oct 07, 2016 7:38 pm    Post subject: Reply with quote

I am not sure if I reformatted it, but if I did I still used:

Code:
mkfs.vtab /dev/sdb2


I thought that mkfs.vtab always creates FAT32, but I am realizing now from reading the man page that it picks from 12,16 or 32, so I should have used:

Code:
mkfs.vtab -F 32 /dev/sdb2


You mentioned FAT32 a few times, my apologies for overlooking this bit. I think this is probably the problem, I'll verify once I get home and make sure /dev/sdb2 is recreated as FAT32.

Best regards,
Aleksey
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