You are not logged in.

#1 2016-02-08 21:20:16

bmalex
Member
Registered: 2016-02-08
Posts: 9

[SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

I am not new to the Linux system (altough I have not used it very much, either) but I am new to ArchLinux and trying hard to learn about it. I am not trying to take the easy way. I have googled the heck aut of it, actually learning a lot and posting this is my last resort.

I have created my Virtual Box machine, with EFI enabled, trying as much as I can to simulate my real computer. Here I want to try several things and then, after I feel like I get the hang of it, install everything for real.
So, I have a 32GB VDI and I installed Windows 10 on it (UEFI mode). I also turned off the Fast startup option. I have 16GB unallocated space for ArchLinux, i restart and boot into the installation DVD (UEFI mode).

Now, what I want to try first is installING the most basic things then a boot manager that should show up at startup, with both Arch and Windows 10 options. I would like to install rEFInd boot manager and make it load the EFISTUB kernel when the option is selected or the Windows 10 boot manager. I have tried more than 10 times but I never reached it completely. I know this is because of some little things that I don't get or misunderstand so I hope I can get a little help here. I will describe all the steps I take.

  1. I create a new ext4 primary partition with the free space

  2. I mount the new partition (/dev/sda5) to /mnt

  3. I install the base

    pacstrap -i /mnt base

    and generate an fstab file

  4. I change root

    arch-chroot /mnt /bin/bash
  5. I install refind-efi with

    pacman -S refind-efi
  6. I exit root and run

    refind-install
  7. I get an error related to efibootmgr. It says I should rename the refind_x64.efi to the default name (EFI/boot/bootx64.efi), which I do (what I see is that the real path is /boot/efi/EFI/refind/refind_x64.efi and I move it to /boot/efi/EFI/Boot/bootx64.efi

  8. Then I add the entry manually with

    efibootmgr -c -g -d /dev/sda -p 2 -w -L "rEFInd" -l '/EFI/refind/refind_x64.efi'
  9. I umount and reboot to see what happens. Windows 10 boots directly. I shut down the machine and start it again. I can see the textual rEFInd menu but no entry for Arch Linux

I guess this is not how you do it so I start again (I created a backup point previously), this time trying to install it into the EFI partition created by Windows (dev/ext2). So, after installing the base:

  1. I mount /dev/sda2 to /boot

  2. Run

    refind-install

    and there is a /boot/EFI/refind/refind_x64.efi file. No errors and I can see a new entry in efibootmgr

  3. Umount and reboot

  4. Again, the Windows boot loader kicks in and I see no rEFInd menu

Last edited by bmalex (2016-02-09 11:04:43)

Offline

#2 2016-02-08 21:35:19

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

I think you need to mount /boot to the ESP rather than /boot/efi

EDIT2: This crossed with your edit.

This is certainly true for systemd-boot but I've never used rEFInd so that may be different.

Also, the VM EFI shell may not be capable of booting a kernel masquerading as a PE/COFF image.

EDIT: Which is to say: EFI_STUB booting may not work in a VM.

Last edited by Head_on_a_Stick (2016-02-08 21:39:41)

Offline

#3 2016-02-08 22:09:21

bmalex
Member
Registered: 2016-02-08
Posts: 9

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

Thanks. I read about that, too.
What I have just tried is:

  1. I copied the boot files to the different EFI partition I use

    # mkdir -p $esp/EFI/arch
    # cp /mnt/boot/vmlinuz-linux /boot/EFI/arch/vmlinuz-linux
    # cp /mnt/boot/initramfs-linux.img /boot/EFI/arch/initramfs-linux.img
    # cp /mnt/boot/initramfs-linux-fallback.img /boot/EFI/arch/initramfs-linux-fallback.img
  2. Installed rEFInd sucessfully with refind-install

  3. Wrote a startup.nsh file containing the \EFI\refind\refind_x64.efi route, hoping VirtualBox will load that

Still the same result

Last edited by bmalex (2016-02-08 22:09:53)

Offline

#4 2016-02-08 22:23:42

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

FWIW, I have used EFI_STUB booting on several machines and have never had any problems with it.

Notwithstanding any rEFInd configuration peccadilloes (about which I know nothing), your set up looks good to me.

I would say go ahead and try it on the bare metal, just be sure to share the Windows-generated EFI system partition and leave the $ESP/EFI/Microsoft/Boot folder intact and unmolested.

I would also recommend using systemd-boot rather than rEFInd as it is part of the base system and you will find it easier to get assistance with any problems simply because more Archers use that bootmanager.

Offline

#5 2016-02-08 22:39:10

bmalex
Member
Registered: 2016-02-08
Posts: 9

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

I just saw that /boot/refind_linux.conf doesn't contain any PARTUUID as specified in the wiki. I wonder if that has something to do with it. I migth give it a try on the real computer to see what happens

Offline

#6 2016-02-08 23:15:07

bmalex
Member
Registered: 2016-02-08
Posts: 9

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

Yep. I tried on the real machine and even if efibootmgr clearly states that the first in line is refind, Windows 10 is still the one bootloading first

Offline

#7 2016-02-08 23:24:23

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

That's probably your motherboard firmware trying to "help" you.

You may have to set the default .efi loader from Windows.
yikes

You can use:

bcdedit /set {bootmgr} path \EFI\refind\refind_x64.efi

You will have to run that command with Administrator privileges and make sure you use the correct full path to refind_x64.efi (relative to the EFI system partition).

Offline

#8 2016-02-08 23:34:00

bmalex
Member
Registered: 2016-02-08
Posts: 9

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

O.K. That got me a little bit closer (now I know why GRUB wasn't working either). Yet, the problem I have now is that when refind opens up I only see Windows 10 as option. I will look more into it tomorrow. I am getting used to this linuxmasochism life and even begin to like it

Last edited by bmalex (2016-02-09 00:35:21)

Offline

#9 2016-02-09 07:55:12

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

If you try systemd-boot instead I could help you better.

See https://wiki.archlinux.org/index.php/Systemd-boot

I don't know much about rEFInd hmm

Offline

#10 2016-02-09 08:46:56

bmalex
Member
Registered: 2016-02-08
Posts: 9

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

I know that systemd-boot is what the Wiki also recommends but I like rEFInd due to its customizable graphic interface (I have seen some beautiful themes I want to use). I don't know if systemd-boot has that. Then, why use Linux if you don't wanna try hack it a little bit?
In any case, now I saw that I had to edit 2 configuration files for rEFInd, in order to see my Linux entry, which I did. The rEFInd related issues are gone.

First, I copied /mnt//boot/vmlinuz-linux to $esp/vmlinuz-linux, /mnt/boot/initramfs-linux.img to $esp/initramfs-linux.img and /mnt/boot/initramfs-linux-fallback.img to $esp/initramfs-linux-fallback.img, $esp being my EFI partition (/dev/sda2), where the Windows boot manager is stored, too. Somewhere I read that they must lay on the EFI partition but I don't remember where and why. It looks like necessary, tough.

After that, I edited $esp/refind_linux.conf:

"Boot with standard options"        "ro root=PARTUUID={UUID of my ext4 root partition /dev/sda5} rw add_efi_memmap"
"Boot using fallback initramfs"      "ro root=PARTUUID={UUID of my ext4 root partition /dev/sda5} rw add_efi_memmap initrd=initramfs-linux-fallback.img"

and $esp/EFI/refind/refind.conf, where I added a new menu entry at the end

menuentry "Arch Linux" {
    icon    /EFI/refind/icons/os_arch.png
    volume    "Arch Linux"
    loader    /vmlinuz-linux
    initrd    /initramfs-linux.img
    options    "root-PARTUUID={UUID of my ext4 root partition /dev/sda5}" rw add_efi_memmap
    submenuentry {
        initrd /initramfs-linux-fallback.img
    }
}

A first problem I have now is that sometimes efibootmgr configuration gets overwritten at boot and my rEFInd entry disappears. When that happens (and I don't know what triggers it) I also see two Windows Boot Manager entries. I have to run refind-install again and remove the last Windows boot entry from the two. Then rEFInd is again set as the default boot manager. Sometimes, the Windows repairing tool initiates so I don't know if this piece of junk computer (a HP Pavilion G6 2305SQ) does this from the hardware or some firmware I know nothing about. Anyway, I will attend that later

Secondly, when rEFInd menu decides to show up, I see that it auto detects the files I copied to the $esp and adds a new entry for them. It also takes the menu entry I added and creates a entry called Arch Linux. So, it creates a duplicate. I would stick with the entry I added, not the automatically detected one. The real problem is that when I choose either one I end up seeing this message

ERROR: device 'PARTUUID=68ffe37a-2d22-49c9-808f-d3fac428de6a' not found. Skipping fsck.
ERROR: Unable to find root device 'PARTUUID=68ffe37a-2d22-49c9-808f-d3fac428de6a'.
You are being dropped to a recovery shell
    Type 'exit' to try and continue booting
sh: can't access tty; job control turned off

I ran

mkinitcpio -p linux

from

arch-chroot

and my /mnt/etc/fstab file only contains a line for the ext4 extension

Last edited by bmalex (2016-02-09 10:01:01)

Offline

#11 2016-02-09 10:06:00

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

bmalex wrote:

First, I copied /mnt//boot/vmlinuz-linux to $esp/vmlinuz-linux, /mnt/boot/initramfs-linux.img to $esp/initramfs-linux.img and /mnt/boot/initramfs-linux-fallback.img to $esp/initramfs-linux-fallback.img, $esp being my EFI partition (/dev/sda2), where the Windows boot manager is stored, too.

If you have mounted /boot to /dev/sda2 then that is entirely unnecessary.

If you have mounted a different directory to /dev/sda2 then see https://wiki.archlinux.org/index.php/EF … unt_Points

I cannot comment on the rEFInd configuration, sorry.

Hopefully somebody else will be able to help with that.

Offline

#12 2016-02-09 10:12:55

bmalex
Member
Registered: 2016-02-08
Posts: 9

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

The problem is not related to rEFInd anymore, only to the linux images and the booting process itself. Like I said, I have an EFI partition already created by Windows (/dev/sda2), and I can only have one for Windows to boot properly. That is why I copied those files. I will do this once more and I will install rEFInd without copying them

Last edited by bmalex (2016-02-09 10:13:56)

Offline

#13 2016-02-09 10:33:43

bmalex
Member
Registered: 2016-02-08
Posts: 9

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

Well I just did that. I didn't copy any file from /mnt/boot but now, when I choose to open Arch Linux from rEFInd I get this:

Starting vmlinuz'linux
Using load options 'root=PARTUUID=68ffe37a-2d22-49c9-808f-d3fac428de6a rw add_efi_memmap initrd=\boot\initramfs-linux.img'
Invalid loader file!
Error: not found while loading vmlinuz-linux

So, it looks like these files must be copied to the EFI partitions or there's some missing configuration. From what I understand, at boot-time the EFI partition (/dev/sda2, where Windows loader is also placed) is mounted to /boot, yet the place where our linux boot loader files are located is /dev/sda7, which is not mounted, so they are not found. So, I either copy those files to the EFI one (and I will get the errors about the PARTUUID, because, again, it is not found from the EFI) or there must be a way to help the boot-loader detect the ext4 /dev/sda7 partition, too. I don't even know if this make sense and I am sorry for my newbie way of describing it

Last edited by bmalex (2016-02-09 10:40:39)

Offline

#14 2016-02-09 10:45:10

bmalex
Member
Registered: 2016-02-08
Posts: 9

Re: [SOLVED] Install rEFInd to dual boot EFISTUB and Windows 10

O.K. Inded, I had to copy a driver for the ext4 partition type to the EFI location of rEFInd. Now it detects the ext4 partition. That was the problem. Well, time to do this again properly
Thanks so much for every enlightening reply. 3 days of struggling have finally paid off

Last edited by bmalex (2016-02-09 10:57:11)

Offline

Board footer

Powered by FluxBB