PDA

View Full Version : [SOLVED] 13.10 Grub install on EFI USB stick: configfile must be specified on every boot



ronniepinsky
December 1st, 2013, 10:47 PM
My grub install cannot find my grub.cfg automatically for some reason. This leaves me to do


configfile(hd0,gpt1)=/boot/grub/grub.cfg

which finds my grub.cfg and boots normally.

I mounted the USB EFI partition at /media/test and I installed grub with


sudo grub-install --target=x86_64-efi --efi-directory=/media/test --bootloader-id=grub --removable --recheck --debug


This is mount


/dev/sdb1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /sys/firmware/efi/efivars type efivarfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)


This is the stub grub.cfg on the USB EFI partition. The full grub.cfg is on the OS partition.


search.fs_uuid a60289d6-c308-44f1-9ce6-85db3482ff32 root hd1,gpt1
set prefix=($root)/boot/grub
configfile $prefix/grub.cfg


This is parted


Model: ATA SAMSUNG MZMTD128 (scsi)
Disk /dev/sda: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt


Number Start End Size File system Name Flags
1 1049kB 420MB 419MB ntfs Basic data partition hidden, diag
2 420MB 693MB 273MB fat32 EFI system partition boot
3 693MB 827MB 134MB Microsoft reserved partition msftres
4 827MB 111GB 110GB ntfs Basic data partition msftdata
5 111GB 128GB 16.9GB ntfs Basic data partition hidden, msftdata




Model: SanDisk Cruzer Fit (scsi)
Disk /dev/sdb: 8004MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt


Number Start End Size File system Name Flags
1 1049kB 7800MB 7799MB ext4 msftdata
2 7800MB 7925MB 125MB fat32 EFI boot


This is fstab


# / was on /dev/sdb1 during installation
UUID=a60289d6-c308-44f1-9ce6-85db3482ff32 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/mmcblk0p1 during installation
UUID=245F-F0BE /boot/efi vfat defaults 0 1


The USB EFI partition is not automatically mounted. Should it be? I prefer not to touch the internal SSD at all.

oldfred
December 2nd, 2013, 02:40 AM
Is the UUID in fstab from the sda drive. If so I would change to the UUID of the flash drive.

Is it otherwise booting directly from sdb/flash drive?

With BIOS the boot drive is always hd0 as that is the drive set in BIOS. If you are setting internal first and then chainloading to flash drive that may be why you need hd1?

Is ubuntu folder in efi partition on hard drive or flash drive?

ronniepinsky
December 3rd, 2013, 04:21 PM
Is the UUID in fstab from the sda drive. If so I would change to the UUID of the flash drive.

Is it otherwise booting directly from sdb/flash drive?

With BIOS the boot drive is always hd0 as that is the drive set in BIOS. If you are setting internal first and then chainloading to flash drive that may be why you need hd1?

Is ubuntu folder in efi partition on hard drive or flash drive?

I'm not sure what you mean about the UUIDs. I am thinking the problem is more low level than with the fstab file.

I have set EFI to boot from the flash drive first.

I'm not sure what you mean about chainloading.

I have installed grub in the recommended way as you can see by the line I included in the first post. This installs some grub files on the EFI partition and some files on the OS partition. I do not like the way this works so I tried first to install all grub files to the EFI partition but that would not complete without errors. I did not see any clear Ubuntu documentation on installing grub on EFI so I used:
https://wiki.archlinux.org/index.php/grub

oldfred
December 3rd, 2013, 05:13 PM
I am not sure that this shows you grub in the efi partition, but it will show lots of detail.

Post the link to the BootInfo report that this creates. Is part of Boot-Repair:
https://help.ubuntu.com/community/Boot-Info

ronniepinsky
December 3rd, 2013, 06:39 PM
http://paste.ubuntu.com/6515594/

I am not sure why it shows grub is installed to the MBR. I shouldn't be using MBR if I am using EFI. I guess I need to somehow remove grub from the MBR?

oldfred
December 3rd, 2013, 07:08 PM
At some point you did install grub when booted in BIOS mode. While you can delete the grub in the MBR, with UEFI the MBR is not used except for one partition entry to show it is gpt, so old partition tools like fdisk will not automatically think drive is empty and offer to partition it.

You how show grub in sdb2's efi partition. Does UEFI menu now show it? Or one time boot key?

I think all the drive numbers are reversed, but search should override that and let you boot.
Run this to update grub.
sudo update-grub

All you Ubuntu entries for grub menu show hd1 and chain to Windows shows hd0.
With BIOS the boot drive is always hd0, not sure with UEFI.
If booted in your install in the sdb drive the update-grub will reset everything.

ronniepinsky
December 3rd, 2013, 08:37 PM
What seems to be happening is that even though I have set UEFI only mode in the UEFI setup, it finds grub installed to the MBR of the drive and boots in legacy mode. Because grub is installed in UEFI mode it cannot find the configuration for some reason.

I just tried update-grub again with no change.

I suppose I should dd grub away from the MBR and hope that it boots into UEFI mode next time? I am obviously hesitant to try that.

oldfred
December 3rd, 2013, 09:42 PM
Most UEFI that auto switch or boot BIOS & UEFI, try booting from efi partition and if not found then boot from MBR. So is it still not finding efi partition?

I do not like suggesting dd either. Change sdX to correct drive.
Backup MBR
https://help.ubuntu.com/community/WindowsDualBoot#Master Boot Record backup and re-replacement
Backup the MBR e.g.
sudo dd if=/dev/sdX of=mbr.bin bs=446 count=1
Zero out MBR only of sdX Use 440 if windows as serial number is between 440 & 446.
dd if=/dev/zero of=/dev/sdX bs=446 count=1
Erase - Make double sure you have correct drive


Powerful command, but often misused and then nicknamed "dd" Data Destroyer
http://www.linuxquestions.org/questions/linux-newbie-8/learn-the-dd-command-362506/

ronniepinsky
December 4th, 2013, 07:08 AM
I just tried zeroing the MBR with no change. I also tried changing hd1 to hd0 in the stub grub.cfg in the EFI partition with no change. Before the failed boot and being dumped to the grub console, it quickly flashes and says something about could not open efi/boot/something and says something about a fallback but I can't read it fast enough.

Edit: I also tried changing the first set root= in the grub.cfg on the OS partition from hd1 to hd0 with no change.

oldfred
December 4th, 2013, 04:19 PM
Is something still missing in /efi/boot? That might be the error?

ronniepinsky
January 6th, 2014, 01:25 PM
I was finally able to fix this. I ran boot-repair again and chose advanced options, but didn't change much except I checked disable secureboot, and all the options under other options were unchecked. I found it created a new folder in the EFI partition named ubuntu. There was also a folder in the EFI partition called BOOT with another grubx64.efi. I deleted the BOOT folder and reran boot-repair and it did not recreate the folder so that was fixed. Finally I added acpi_osi=Linux and acpi_backlight=vendor to the grub.cfg. Remember, there should be NO grub.cfg on the EFI partition, only on the system partition. I don't like how boot-repair messed with the EFI boot options and labeling but no big deal. Thanks for trying to help anyway.

oldfred
January 6th, 2014, 06:26 PM
The /boot folder is standard in efi partitions, both Windows and ubuntu create that folder with bootx64.efi.efi which is supposed to bring up the efibootmgr for UEFI. Not sure of differences between the Windows version and grub versions of bootx64.efi.

Boot-Repair mostly runs grub updates and installs what is needed. It has work arounds for several grub bugs and does the "buggy" rename for those systems that have hard coded UEFI to only boot Windows. But it seems to offer that rename fix when not required. Only some systems need that fix but many users are accepting it when they should not. If a system can boot an ubuntu entry in UEFI the rename is not required.

Some other users have had issues with finding grub.cfg from a UEFI boot. They then have added a grub.cfg in the ubuntu folder in the efi partition with just the one configfile entry to the full grub.cfg in the install and then gotten systems to boot.