Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GIGABYTE GA-F2A88X-D3HP UEFI refind woes [SOLVED]
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
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3100
Location: Illinois, USA

PostPosted: Sat Dec 10, 2016 9:39 pm    Post subject: GIGABYTE GA-F2A88X-D3HP UEFI refind woes [SOLVED] Reply with quote

After I got this mobo working with my old hard drive, I switched to an SSD. I decided to go with UEFI as I believe there will be no choice in the future, so I might as well learn how to set this up.
I despise grub2, so I decided to go with refind.

I partitioned the SSD with gparted from sysrescuecd 4.9.0 booted in UEFI mode. I created a GPT vfat partition and a single ext4 root partition. I copied my old installation using " cp -a"
and changed /etc/fstab to mount partition 1 as /boot/efi, first mounting it as /mnt/gentoo and "cp -a /mnt/gentoo /boot". I then installed refind, following the wiki under "Automatic Install".
The new drive would not boot as UEFI but would boot as MBR and displayed the grub legacy boot menu even though I never ran grub-install. The menu works.
I was upset that UEFI didn't but put it aside.

I built two new kernels over the last few weeks and added them to /boot/grub/grub.conf. Two days ago I noticed that they are not in the menu and that I am still running 4.8.11
(the system is remotely located in the basement). When at the machine I saw that it displays the same old menu. So I made another attempt at refind.
I also ran gdisk and saw that the first partition was coded 0700 not EF00. I used gdisk to change it. Still, it wouldn't boot as UEFI. I reinstalled refind using the sysrescuecd in UEFI mode,
this time following "Manual Configuration" which seemed to be the same as what Automatic did. I ran efibootmgr and it confirmed that I have four UEFI boots.
Unfortunately, when using F12 to select UEFI boot on Crucial MX200, the screen never changes even after several minutes and I have to use the rest button to reboot,
neither F2 or any other key working.

I suppose if I run grub-install the boot menu will resolve itself, but I want to boot in UEFI mode and see the refind menu.
Code:

gentoo ~ # gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk /dev/sda: 488397168 sectors, 232.9 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): B71B8547-F661-4A0E-A610-5FE0BDF75913
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 488397134
Partitions will be aligned on 2048-sector boundaries
Total free space is 6445 sectors (3.1 MiB)
Total free space is 6445 sectors (3.1 MiB)

Number  Start (sector)    End (sector)  Size      Code  Name
   1            2048         2099199   1024.0 MiB  EF00
   2         2099200      488392703   231.9 GiB   8300


The refind.conf is at
https://paste.pound-python.org/show/qUb2lVRzXNYHxyNLvF6p/

The active part is:
Code:

gentoo ~ # grep -v "#" /boot/efi/EFI/refind/refind.conf

timeout 20

fold_linux_kernels true

menuentry Linux {
    icon EFI/refind/icons/os_linux.png
    volume 904404F8-B481-440C-A1E3-11A5A954E601
    loader bzImage-3.3.0-rc7
    initrd initrd-3.3.0.img
    options "ro root=UUID=5f96cafa-e0a7-4057-b18f-fa709db5b837"
    disabled
}

menuentry Ubuntu {
    loader /EFI/ubuntu/grubx64.efi
    icon /EFI/refind/icons/os_linux.png
    disabled
}

menuentry "ELILO" {
    loader \EFI\elilo\elilo.efi
    disabled
}

menuentry "Windows 7" {
    loader \EFI\Microsoft\Boot\bootmgfw.efi
    disabled
}

menuentry "Windows via shell script" {
    icon \EFI\refind\icons\os_win.png
    loader \EFI\tools\shell.efi
    options "fs0:\EFI\tools\launch_windows.nsh"
    disabled
}
menuentry "Gentoo Latest" {
    icon EFI/refind/icons/os_linux.png
    loader /boot/vmlinuz-4.8.13-gentoo
    options "root=/dev/sda3 vga=0x375"
}


I've tried with fold_linux_kernels true and false, no change.


Last edited by Tony0945 on Sun Dec 11, 2016 7:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7094
Location: Saint Amant, Acadiana

PostPosted: Sat Dec 10, 2016 9:57 pm    Post subject: Reply with quote

Check this out: https://bugs.gentoo.org/show_bug.cgi?id=598587#c3
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3100
Location: Illinois, USA

PostPosted: Sat Dec 10, 2016 10:15 pm    Post subject: Reply with quote

Interesting, but I'm not using any custom CFLAGs
Code:
[ebuild   R   ~] sys-boot/refind-0.10.4-r1::gentoo  USE="doc ext2 ext4 iso9660 ntfs -btrfs -custom-cflags -gnuefi -hfs -reiserfs"


Or are you saying the basic ebuild is broken?

Oh, reading forward of your link, I'm reemerging 0.10.2
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7094
Location: Saint Amant, Acadiana

PostPosted: Sat Dec 10, 2016 10:17 pm    Post subject: Reply with quote

The new version will work with USE=gnuefi.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3100
Location: Illinois, USA

PostPosted: Sat Dec 10, 2016 10:25 pm    Post subject: Reply with quote

I did see that the old version required gnuefi. This message from the ebuild is confusing:
Quote:
* You will need to use the command 'refind-install' to install
* the binaries into your EFI System Partition
* Note that this will not update any EFI binaries on your EFI
* System Partition - this needs to be done manually.
If refind-install dies not update the binaries, why run it?
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3100
Location: Illinois, USA

PostPosted: Sat Dec 10, 2016 11:09 pm    Post subject: Reply with quote

OK! 10.2 does indeed boot and shows the refind screen with a bunch of penguin icons and the gentoo icon. Gentoo tries to boot but fails. This is the menuentry:
Code:
menuentry "Gentoo Latest" {
    icon EFI/refind/icons/os_linux.png
    loader /boot/vmlinuz-4.8.13-gentoo
    options "root=/dev/sda3 vga=0x375"
}

Do I have to boot with UUID instead of "root=/dev/sda3"? The kernel (or a kernel) starts to boot.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7094
Location: Saint Amant, Acadiana

PostPosted: Sat Dec 10, 2016 11:23 pm    Post subject: Reply with quote

Starts to boot but fails ... how?
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3100
Location: Illinois, USA

PostPosted: Sat Dec 10, 2016 11:43 pm    Post subject: Reply with quote

Jaglover wrote:
Starts to boot but fails ... how?
I've done some experimentation.

First off, I always get these three messages tnen have to press ENTER to continue:
Code:
Error: Invalid Parameters returned from  ntfs_x64.efi
Error: Invalid Parameters returned from  iso9660_x64.efi
Error: Invalid Parameters returned from  ext2_x64.efi

Then I get the menu items, various kernels from various partitions. I'm confused by the ones on "3 Gib partition" because I don't have such a partition. Maybe the DVD drive's sysrescuecd?

All the kernels fail the same way, regardless of whether they are on the first or second partition.
Code:
Kernel Panic! Not syncing :VFS:
Unable to mount rootfs on unknown - block (0,0)
Which is why I asked if the kernel parameter had to be UUID. Note that these same kernels boot fine in MBR mode.

BTW, many thanks for the help, I never would have gotten this far. So close I can almost taste it!
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7094
Location: Saint Amant, Acadiana

PostPosted: Sun Dec 11, 2016 12:19 am    Post subject: Reply with quote

Kernel will not boot with UUID without initramfs. I have working rEFInd setup, but this does not mean I know how it works. After mounting /boot there is /boot/refind_linux.conf with boot options in it, I did not create this file, it must be written by rEFInd install script. Do you have this file? Also, my kernel is EFI stub kernel, it can be booted directly by UEFI. Theoretically if you use a bootloader then you shouldn't need EFI stub kernel.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 630

PostPosted: Sun Dec 11, 2016 1:27 am    Post subject: Reply with quote

Tony0945,

I also have a working refind but cannot claim to fully understand it all. I relied heavily on rodsmith at : http://www.rodsbooks.com/refind/index.html

I too get this error and need to press Enter:
Code:
Error: Invalid Parameters returned from  ext2_x64.efi

Same as Jaglover, I have the refind.conf file under /boot/EFI/EFI/refind.conf (separate boot and EFI partitions), and I also have 2 identical refind_linux.conf files, one at /boot/refind_linux.conf, and another at /boot/EFI/EFI/gentoo/refind_linux.conf. I think I may have copied the original to the duplicate along the way I don't remember when or why.

This file I believe to be rather crucial because my kernel will not behave properly without some of the cmdline args in the file.

My motherboard is a GIGIBYTE GA-990FXA-UD3 Ultra, I think the BIOS is similar or same as yours so it can be done. Although I spent a few long nights rebooting with sysrescuecd over and over until I got it working satisfactorally and didn't want to mess with it anymore :)

HTH
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Sun Dec 11, 2016 2:18 am    Post subject: Reply with quote

Tony0945 wrote:
First off, I always get these three messages tnen have to press ENTER to continue:
Code:
Error: Invalid Parameters returned from  ntfs_x64.efi
Error: Invalid Parameters returned from  iso9660_x64.efi
Error: Invalid Parameters returned from  ext2_x64.efi

Tony0945 ... those, I suspect, are due to one of two things, compilation of rEFInd, or 64bit on 32bit efi. Please get the zip from the rEFInd website, one which matches your efi (some 64bit machines have 32bit efi). Don't run the installer, use the 'manual' method, you should have something like the following (with with ia32 or x64 dependent on your efi):

Code:
# ls /boot/efi/refind
drivers_ia32/  icons/  refind.conf  refind_ia32.efi

You may have /boot/EFI/efi/refind dependent on how you've decided to use the ESP (ie, mounting the ESP as /boot or mounted as /boot/EFI). You should then check 'efibootmgr -v' shows Boot0000 pointing to \efi\refind\refind_{ia32,x64}.efi (I suspect it is as your getting refind).

Tony0945 wrote:
Code:
Kernel Panic! Not syncing :VFS:
Unable to mount rootfs on unknown - block (0,0)

This shows that rEFInd isn't the issue, its the kernel and/or parameters passed to the kernel.

Note you can simplify your refind.conf by only supplying the basic configuration in refind.conf and using a refind_linux.conf (in /boot ... or wherever it is your keeping your linux kernels), eg:

/boot/efi/refind/refind.conf:
timeout 5
hideui banner
use_graphics_for linux

/boot/efi/linux/refind_linux.conf:
"Boot with standard options"  "quiet ro rootfstype=ext4 root=/dev/sda3 vga=0x375"
"Boot to single-user mode"    "quiet ro rootfstype=ext4 root=/dev/sda3 vga=0x375 single"
"Boot with fsck"  "quiet ro rootfstype=ext4 root=/dev/sda3 vga=0x375 fsck.mode=force"

... these parameters are then accessable for all kernels rEFInd discovers when scanning /boot ... with the first being the "default" (hitting F2 gets the menu). With this there is no need to update refind.conf when adding, or removing, a kernel.

HTH & best ... khay
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3100
Location: Illinois, USA

PostPosted: Sun Dec 11, 2016 7:07 pm    Post subject: Reply with quote

SUCCESS!

The error messages about "Error: Invalid Parameters returned from ntfs_x64.efi " and the like were caused by old and new versions being mixed. I notice there was a seven hour difference in the file dates between the ones with error messages and no error messages. Copying the correct files corrected this.

I still had way too many kernels listed and whatever I selected seemed to fail with the kernel panic. Eventually I erased all kernels except those in /boot and wiped out the whole /boot/efi partition and unmerged and re-merged refind. This latest version had directory /boot/efi/EFI/BOOT instead of /boot/efi/EFI/refind And selecting the latest kernel got it to successfully boot. However there were still a ton of kernels listed including kernels with names ending in .old which I had purged from the disk early yesterday. They were listed on "3 Gib partition". I got a brainstorm. What if it was trying to boot kernels from the wrong disk? The old hard drive GPT partition mounted as /boot still had those kernels. I never thought refind would scan an unmounted volume. I had to add this line to refind.conf (after creating the labels with e2label)
Code:
dont_scan_volumes WD400_PART1,WD400_PART2
Upon reboot, only my three kernels showed with their Gentoo icons, all booted correctly. If I instead select the tool "exit refind", my old grub legacy menu appears. I still don't know why or how. Or whether I have a second backup partition record.

If I have this right, the steps to re-create are:

1. partition with gdisk not gparted. gparted does not put the correct code on the GPT partition or alters it when you format it vfat. Make your partition small, 200 Mib, don't store kernels there, it will cause duplicate menus.

2. make sure you emerge refind with useflag GNUEFI. IMHO this should be a default.

3. run refind-install

4. edit refind.conf. A very important step. The following is my setup:
Code:
grep -v "#" refind.conf

timeout 10

showtools shell, gdisk, memtest, about, reboot, exit, firmware

scanfor internal,manual

dont_scan_volumes WD400_PART1,WD400_PART2

fold_linux_kernels false

menuentry Linux {
    icon EFI/refind/icons/os_linux.png
    volume 904404F8-B481-440C-A1E3-11A5A954E601
    loader bzImage-3.3.0-rc7
    initrd initrd-3.3.0.img
    options "ro root=UUID=5f96cafa-e0a7-4057-b18f-fa709db5b837"
    disabled
}

menuentry Ubuntu {
    loader /EFI/ubuntu/grubx64.efi
    icon /EFI/refind/icons/os_linux.png
    disabled
}
menuentry "ELILO" {
    loader \EFI\elilo\elilo.efi
    disabled
}

menuentry "Windows 7" {
    loader \EFI\Microsoft\Boot\bootmgfw.efi
    disabled
}

menuentry "Windows via shell script" {
    icon \EFI\refind\icons\os_win.png
    loader \EFI\tools\shell.efi
    options "fs0:\EFI\tools\launch_windows.nsh"
    disabled
}

menuentry "My Mac OS X" {
    icon \EFI\refind\icons\os_mac.png
    volume "OS X boot"
    loader \System\Library\CoreServices\boot.efi
    disabled
}
Somehow it knows to apply the Gentoo icon.
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3100
Location: Illinois, USA

PostPosted: Sun Dec 11, 2016 7:09 pm    Post subject: Reply with quote

Many thanks to Jaglover and khayyam. I couldn't have done it without you.

It's MUCH nicer than grub2.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Mon Dec 12, 2016 10:56 am    Post subject: Reply with quote

Tony0945 wrote:
Code:
scanfor internal,manual

Tony0945 ... as you're providing 'manual' stanza's, and have "too many kernels listed" why not remove 'internal'? This way you would only be provided those kernels listed in the manual stanza's. I prefer not to have manual stanza's at all (as using 'internal' scan picks up those kernels I have available, and doesn't require editing refind.conf on kernel updates) but as you're defining them it doesn't make sense to use 'internal' scans also.

WRT grub2 showing up I expect it is called as the next in 'BootOrder', there is nothing you can do about that other than by removing grub2 from the ESP (and using efibootmgr's '--delete-bootnum'). BTW, you can block it showing in rEFInd via refind.conf, ie:

refind.conf:
dont_scan_dirs efi/grub2

best & you're welcome ... khay
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3100
Location: Illinois, USA

PostPosted: Tue Dec 13, 2016 1:05 am    Post subject: Reply with quote

The manual stanzas are all disabled. Too many kernels were listed because the second unmounted drive was being scanned. I also disabled booting from the DVD drive in UEFI mode because it's redundant. I can already do that by hitting F12 while the BIOS is coming up.

It's actually grub legacy, not grub 2, which is why I don't understand why it's working because I never ran grub-install on this disk, just cloned the partitions. Don't both grubs rely on code between the partitions?

Reading around on http://www.rodsbooks.com/refind/, it sounds like refind stores the last successful boot kernel as a default and otherwise boots the newest kernel. This is ideal in that my build script doesn't have to do anything except delete that file location. If the boot of the newest kernel fails, I'll have to physically go to the machine and boot an alternate which will become the default until I build another kernel or "touch" an existing kernel. Is this how you use it, khay?

Refind has many many options and they are described in detail. So much detail that it's hard to get a gestalt. But I think it beats the "standard" of making grub 2 the sole boot agent.

It's time for me to make a donation to the author in payment of this large and detailed software.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Tue Dec 13, 2016 8:28 am    Post subject: Reply with quote

Tony0945 wrote:
The manual stanzas are all disabled [...]

Tony0945 ... sorry, I missed that, having only scanned. That being the case you can remove 'manual', and the stanzas, as they are effectively unused.

Tony0945 wrote:
It's actually grub legacy, not grub 2, which is why I don't understand why it's working because I never ran grub-install on this disk, just cloned the partitions. Don't both grubs rely on code between the partitions?

Not something I've encountered before, your firmware, and rEFInd, are prior to reading of a master boot record so I don't think it matters, why it is executed is another question, and I couldn't really say.

Tony0945 wrote:
Reading around on http://www.rodsbooks.com/refind/, it sounds like refind stores the last successful boot kernel as a default and otherwise boots the newest kernel. This is ideal in that my build script doesn't have to do anything except delete that file location. If the boot of the newest kernel fails, I'll have to physically go to the machine and boot an alternate which will become the default until I build another kernel or "touch" an existing kernel. Is this how you use it, khay?

I'm fairly sure it boots the newest regardless, and least that is my experience. If I update the kernel then this is used, and the 'last' is skipped. So, when updating I need only place the kernel in /boot/efi/linux ... and should there be an issue I 'touch' the known working, or 'last', kernel (and so alter the modification time).

best ... khay
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3100
Location: Illinois, USA

PostPosted: Tue Dec 13, 2016 4:46 pm    Post subject: Reply with quote

Khay, it didn't boot the latest by default, but it did after I added "default_selection vmlinuz" to refind.conf as suggested by Rod Smith in http://askubuntu.com/questions/348463/refind-configuration-change-boot-order-and-default-boot. Now, as you say, I don't have to edit anything when I build a new kernel and I can manipulate which kernel boots by using "touch". I have verified this by experiment. If a new kernel fails to boot, as sometimes happens, I can always manually select another at the machine at make it the default with touch. Very very satisfactory.
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