You are not logged in.

#1 2015-02-02 21:15:16

buffalo
Member
Registered: 2015-02-02
Posts: 8

GRUB with GPT/UEFI confusion. [SOLVED] (or not an issue anymore!)

Hi, I've been trying to install arch and I've been having a lot of trouble with grub. My machine has an EFI system partition, the first one on the hard disk. I started to follow the directions on https://wiki.archlinux.org/index.php/GRUB under the UEFI systems header. (I have been booting the arch iso in UEFI mode by the way) This failed when I got to the command:

# grub-install --target=x86_64-efi --efi-directory=$esp --bootloader-id=grub_uefi --recheck

I don’t remember the output of this command and  I lost my notes. Next I started following the directions on https://wiki.archlinux.org/index.php/GRUB/EFI_examples under the ASUS > M5A97 section. I have an ASUS notebook but I can’t figure out what type of motherboard I have. I went with the M5A97 directions because the other sections did not seem to mesh with what I saw on my setup. The following commands went fine:

# mkdir -p /boot/efi

# mount -t vfat /dev/sdXY /boot/efi

# modprobe dm-mod

# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug

# mkdir -p /boot/grub/locale

# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

# grub-mkconfig -o /boot/grub/grub.cfg


But this next command told me that there was not enough room to copy over the shell script.


# cp ~/Shell2/UefiShellX64.efi /mnt/boot/efi/shellx64.efi


My /dev/sda2 partition was a 900MB windows recovery thing (I plan on dual-booting with windows 8.1). I dd’d the contents of /dev/sda2 onto a usb drive then I tried to expand /dev/sda1. I was using a gparted live usb for this and gparted repeatedly gave an error when it tried to expand /dev/sda1. So I used “cp -r” to move the contents of /dev/sda1 onto a usb, then I erased /dev/sda1, then I made a new, bigger /dev/sda1, then I formatted it FAT32 and flagged it as a boot partition. Then I moved the files back to /dev/sda1. That made room for the UefiShellX64.efi file. Maybe this process messed something up - maybe not I don’t know...

# cp ~/Shell2/UefiShellX64.efi /mnt/boot/efi/shellx64.efi worked then. The next command I really don’t understand though:


Shell> bcfg boot add 3 fs0:\EFI\Arch_Grub\grubx64.efi "Arch_Grub"

"where fs0 is the mapping corresponding to the UEFI System Partition and 3 is the zero based boot entry index. ”

I don’t get what  I should have used in place of fs0 and 3. I think I did fs0=fs0 and I used the number 0 instead of 3.

I entered in the next command too:


Shell> bcfg boot dump -v


In my UEFI settings I see 2 instances of the windows boot manager which will not work anymore. One option says, "Arch_Grub" and the one says "arch_grub (PO: ST1000LM024 HN-M101MBB). Both of the grub options get me to a grub command line.

If you have ideas or suggestions or questions please let me know. I would appreciate any help I can get here! Thanks!



Edit:
Here is the output of lsblk -f:

name   fstype   label    uuid                                mountpoint
sda1     vfat      ...         3371-F56B                        ...
sda3     ...          ...        ...                                      ...
sda4     ntfs      OS        D8DF28D65F05E2            ...
sda5     ntfs      restore  1E0CFB7A0CFB4AF3         ...
sda6     ext4      ...          4b3a...                              ...
sda7     swap    ...          32716.....                            ...

then some stuff for the arch iso.

here is the output of gdisk -l /dev/sda:

partition table scan says gpt: present

Number          Start (sector)         End (sector)       size               code     Name
1                     2048                      2047999            999.0MiB       EF00     EFI system partition
3                     2050048                2312191            128.0 MiB      0C01     Microsoft Reserved
4                     2312192                1653512191       787.4GiB      0700      Basic Data Partition
5                     ...                           ...                        20.0GiB        2700      Basic Data Partition
6                     ...                           ...                        119.1GiB       8300     
7                     ...                          ...                         3.9GiB           8200

Last edited by buffalo (2015-02-12 14:53:42)

Offline

#2 2015-02-02 21:34:45

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,778
Website

Re: GRUB with GPT/UEFI confusion. [SOLVED] (or not an issue anymore!)

First of all, use a Windows rescue disk to get Windows booting again.

You have posted "/dev/sdXY" -- what was the actual command you used?

Do you have an ASUS M5A97?

If not, why are you following the (very idiosyncratic) instructions for that device?

bufallo wrote:

Maybe this process messed something up

I would think so, yes.

Please post the output of:

# parted -l
lsblk -f

Run these commands after you have mounted your partitions and (arch-)chrooted in from the Arch ISO.

Just to note: "boot flags" are meaningless in an EFI system -- the firmware (BIOS) just reads the FAT formatted partitions and searches for EFI/boot/BOOTX64.EFI unless directed otherwise by an NVRAM entry.

You need to read this:
https://www.happyassassin.net/2014/01/2 … work-then/


Jin, Jîyan, Azadî

Offline

#3 2015-02-02 21:37:11

buffalo
Member
Registered: 2015-02-02
Posts: 8

Re: GRUB with GPT/UEFI confusion. [SOLVED] (or not an issue anymore!)

I edited my post before I saw you post. Hold on 1 minute while  I get

# parted -l
lsblk -f

from arch-chroot...

Offline

#4 2015-02-02 21:46:26

buffalo
Member
Registered: 2015-02-02
Posts: 8

Re: GRUB with GPT/UEFI confusion. [SOLVED] (or not an issue anymore!)

lsblk -f

just shows the 7 partitions for /dev/sda with no info except / is listed as the mountpoint for /dev/sda6.

parted: command not found.


but if i run "parted -l" from out of chroot I get a table: 
number                 start         end            size            file system                 name                       flags
1                            1049kb    1049mb     1048mb     fat32                   eFI system partition         boot,esp
3                            1050mb   1184mb      134mb                                  mircosoft reserved         msftres
4                             do you care?             845GB        ntfs                       basic data partition       mfstdata
6                                                               128GB       ext4
7                                                               4194MB     linux-swap(v1)
5                                                               21.5GB       ntfs                      basic data partition         hidden, daig




And for /dev/sdXY I really did:

# mount -t vfat /dev/sdb1 /boot/efi


Note that at the time /dev/sdb was how my hard drive was being listed. Now I rebooted and it appears as /dev/sda.


Do you have an ASUS M5A97?

If not, why are you following the (very idiosyncratic) instructions for that device?

I have an asus and I can't tell what kind of motherboard is in it. When the generic directions on the arch wiki - grub page didn't work I went to https://wiki.archlinux.org/index.php/GRUB/EFI_examples. And I looked in the asus section. The other motherboards had instructions that did not seem compatible with my setup. Now I am seriously questioning that. I'm about to look harder for a way to see what my motherboard is.

Last edited by buffalo (2015-02-02 22:30:19)

Offline

#5 2015-02-02 21:51:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: GRUB with GPT/UEFI confusion. [SOLVED] (or not an issue anymore!)

Please use code tags when pasting to the boards: https://wiki.archlinux.org/index.php/Fo … s_and_Code


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2015-02-02 21:58:28

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,778
Website

Re: GRUB with GPT/UEFI confusion. [SOLVED] (or not an issue anymore!)

buffalo wrote:

lsblk -f just shows the 7 partitions for /dev/sda with no info except / is listed as the mountpoint for /dev/sda6.

Your /boot partition is not mounted so GRUB will not install.

And for /dev/sdXY I really did:

# mount -t vfat /dev/sdb1 /boot/efi


Note that at the time /dev/sdb was how my hard drive was being listed. Now I rebooted and it appears as /dev/sda.

That's not good.

You need to be very sure about which disk is assigned to which block device -- use `lsblk` before you start running commands.

I would appreciate an answer to my other question about your hardware.

I think you need to rescue your Windows system first and then start from scratch following the Beginner's Guide as closely as possible -- this does not advise the use of GRUB unless there are problems with gummiboot (the guide advises mounting your EFI system partition to /boot rather than /boot/efi so that gummiboot can load up the kernel image and initrd).

Last edited by Head_on_a_Stick (2015-02-02 22:00:02)


Jin, Jîyan, Azadî

Offline

#7 2015-02-02 22:11:52

buffalo
Member
Registered: 2015-02-02
Posts: 8

Re: GRUB with GPT/UEFI confusion. [SOLVED] (or not an issue anymore!)

Head_on_a_Stick wrote:

That's not good.

You need to be very sure about which disk is assigned to which block device -- use `lsblk` before you start running commands.

This kind of confuses me.  I think I did use a combination of lsblk and fdisk -f. If lsblk was saying sdb then I should have used sdb, right? Could the label have changed after I chrooted in? Cuz I'm positive that I used those bofore mounting.


Your /boot partition is not mounted so GRUB will not install.

OK, but you know that I did mount the boot partition before I installed grub right? I shut down and rebooted a few times since I tried installing grub. I think you might think that I'm still in the same session as when I tried to install.

At the time /dev/sdb1 was what the boot partition was called and I did mount it with:

# mount -t vfat /dev/sdb1 /boot/efi

I  would appreciate an answer to my other question about your hardware.

long answer:
I have an asus and I can't tell what kind of motherboard is in it. When the generic directions on the arch wiki - grub page didn't work I went to https://wiki.archlinux.org/index.php/GRUB/EFI_examples. And I looked in the asus section. The other motherboards had instructions that did not seem compatible with my setup. Now I am seriously questioning that. I'm about to look harder for a way to see what my motherboard is.

short answer:
I'm a dummy.

thank you Head_on_a_stick.



and to the mod, I hear you and will start using tags.

Last edited by buffalo (2015-02-02 22:15:25)

Offline

#8 2015-02-02 22:35:58

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,778
Website

Re: GRUB with GPT/UEFI confusion. [SOLVED] (or not an issue anymore!)

buffalo wrote:

This kind of confuses me.  I think I did use a combination of lsblk and fdisk -f. If lsblk was saying sdb then I should have used sdb, right? Could the label have changed after I chrooted in? Cuz I'm positive that I used those bofore mounting.

The block devices will not change once you are booted.

OK, but you know that I did mount the boot partition before I installed grub right? I shut down and rebooted a few times since I tried installing grub. I think you might think that I'm still in the same session as when I tried to install.

That's why I asked you to mount your partitions before running the commands.

Don't bother with the special methods until you have tried following the Beginner's Guide (using gummiboot) first.


Jin, Jîyan, Azadî

Offline

#9 2015-02-12 00:39:49

motaito
Member
Registered: 2015-02-07
Posts: 63

Re: GRUB with GPT/UEFI confusion. [SOLVED] (or not an issue anymore!)

I'm a beginner in arch myself so take this with caution. It may not be what you need. But I installed gurb as bootloader as well and had no problem with it. As for the change with sda and sdb, I don't know why this happens, but for me they switched with every reboot as long as the system was not installed (I checked out of curiosity when it happened to me). I just rebooted to get sda because I only have one hard disk on my system and then made the install. The following reasoning works for me. Not sure it is technically accurate though.

The efi partition must be the first partition on the disk. However, the efi directory will reside inside the boot directory which is on the boot partition. So, you must first create the boot directory then mount the boot partition in it. Now, if we create a directory inside the boot directory it will be physically located on the boot partition. Then we can create the efi directory inside the boot directory and finally mount the efi partition inside the efi directory.

E.g. in order

# make partitions (sda1=efi; sda2=boot; sda3=root)
mkfs.vfat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3

# mount root and create boot directory
mount /dev/sda3 /mnt
mkdir /mnt/boot

# mount boot, create directory for efi and mount efi
mount /dev/sda2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi

Note that for grub you also need an efi boot manager. This may be different for other bootloaders. Refer to the specific arch wiki for details. So install:

pacstrap /mnt grub efibootmgr

Also, in your first post I noticed that you first install grub and then make the config. Maybe that's a typo but it should be the other way around. What worked for me was the following (just in case... do not enter the number from a partition, we merely refer to the harddisk itself)

grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda

Confirm that grub has installed properly. You should see an efi file (grubx64.efi).

ls -l /boot/efi/EFI/arch

Hope it helps.

Edit: I just noticed that you have a dualboot with windows. I don't think that will change the general principals but I did not have this. This might help further: https://www.youtube.com/watch?v=METZCp_JCec

Last edited by motaito (2015-02-12 00:49:13)

Offline

#10 2015-02-12 14:52:04

buffalo
Member
Registered: 2015-02-02
Posts: 8

Re: GRUB with GPT/UEFI confusion. [SOLVED] (or not an issue anymore!)

Thats some good info motaito, thanks for the advice! On Monday this week I followed Head_on_a_stick's advice and I redid the installation using gummiboot instead of grub and it worked magnificently.

I really did install grub before I configured it because that was what https://wiki.archlinux.org/index.php/GRUB#UEFI_systems told me to do. If you're sure that it should be the other way around then maybe someone wants to edit that wiki page? I'm glad it warked for you though.

As for /dev/sda vs /dev/sdb, when I re-installed my computer got called sdb the whole time once again and I don't know if theres any help for it. It didn't really matter though until I had to configure a gummiboot file. There I told it my root partition was on /dev/sda6 and that became true once I took out my install USB and rebooted.

Finally, I'm sorry that you posted after my problem was fixed. I didn't want to bump a week old thread just to say that a re-install worked. I appreciate the advice motaito and head_on_a_stick!

Offline

Board footer

Powered by FluxBB