You are not logged in.

#1 2021-08-01 13:09:12

Senderman
Member
Registered: 2021-08-01
Posts: 7

[SOLVED] rEFInd Ignores volume token in manual boot stanza

I'm trying to create a manual entry for Arch in rEFInd, and it doesn't boot because rEFInd ignores volume token.

refind.conf:

scanfor manual,optical,external
...
menuentry "Arch Linux (Zen Kernel)" {
    icon     /EFI/refind/icons/os_arch.png
    volume   Archlinux
    loader   /boot/vmlinuz-linux-zen
    options  "root=UUID=9c4f2fd2-ff67-4f54-8f97-64d1c583b99c resume=UUID=00d03b45-ff5b-41c4-b242-d6f4dd43f464 rw rootflags=noatime,discard initrd=\boot\initramfs-linux-zen.img initrd=\boot\intel-ucode.img"
}

blkid -c /dev/null output:

/dev/nvme0n1p1: LABEL="ESP" UUID="A25F-97F1" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="6e9d499b-7638-4598-8aa3-89de27c646ce"
/dev/nvme0n1p2: LABEL="Archlinux" UUID="9c4f2fd2-ff67-4f54-8f97-64d1c583b99c" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Archlinux" PARTUUID="d98a9e6e-7210-4842-a93a-3d28a75c83a4"

fstab:
ESP on /boot/esp
Archlinux partition on /

ls /boot:

ESP intel-ucode.img vmlinuz-linux-zen initramfs-linux-zen.img

refind.log (loglevel 4):

----------Scanning for user-configured boot stanzas----------
12:50:22 - Loading file '\EFI\refind\icons\os_arch.png'
12:50:22 - Adding manual loader for '\boot\vmlinuz-linux-zen'
12:50:22 - Finding loader defaults for 'Boot Arch Linux (Zen Kernel) from ESP'
12:50:22 - Trying to load icon in same directory as loader....
12:50:22 - Creating icon hint based on loader path '\boot\vmlinuz-linux-zen'
12:50:22 - Merging hints based on filesystem name ('ESP')
12:50:22 - Merging hints based on partition name ('EFI system partition')
12:50:22 - Adding hints based on specific loaders
12:50:22 - Searching for an initrd to match '\boot\vmlinuz-linux-zen' on 'ESP'
12:50:22 - Kernel version string is '(null)'
12:50:22 - Located initrd is '(null)'
12:50:22 - Creating subscreen 'Boot Options for Arch Linux (Zen Kernel) on ESP'
12:50:22 - Creating loader entry for 'Boot Options for Arch Linux (Zen Kernel) on ESP'
...
==========Launching 'Boot Arch Linux (Zen Kernel) from ESP'==========
12:50:27 - Getting EFI variable 'PreviousBoot' from disk
12:50:28 - Loading file 'PreviousBoot'
12:50:28 - Saving EFI variable 'PreviousBoot' to disk
12:50:28 - Freeing OldBuf
12:50:28 - Starting vmlinuz-linux-zen
12:50:28 - Using load options 'root=UUID=9c4f2fd2-ff67-4f54-8f97-64d1c583b99c resume=UUID=00d03b45-ff5b-41c4-b242-d6f4dd43f464 rw rootflags=noatime,discard initrd=\boot\initramfs-linux-zen.img initrd=\boot\intel-ucode.img'
12:50:28 - Invalid loader file!
12:50:28 - Error: Not Found while loading vmlinuz-linux-zen
12:50:28 - Setting screen resolution and mode

So, the PARTLABEL is defined as "Archlinux" in the boot stanza, but rEFInd tries to load the files from ESP partition (shown in the logs)
I also tried to set volume to the UUID and PARTUUID, and it doesn't work

Last edited by Senderman (2021-08-12 23:13:59)

Offline

#2 2021-08-01 15:08:29

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,658

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

Your setup looks a bit confusing. You seem to have an EFI partition:

/EFI/refind/icons/os_arch.png

At the same time you have an ESP directory in boot.

Searching for an initrd to match '\boot\vmlinuz-linux-zen' on 'ESP'

rEFInd seems to be looking the kernel inside ESP. Why did you name it ESP in the first place?
Have you tried booting without the stanza? It is far simpler with refind_linux.conf inside boot.
I suggest having a good re-read of the rEFInd wiki.

Offline

#3 2021-08-01 17:16:42

Senderman
Member
Registered: 2021-08-01
Posts: 7

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

d_fajardo wrote:

Your setup looks a bit confusing. You seem to have an EFI partition:

/EFI/refind/icons/os_arch.png

At the same time you have an ESP directory in boot.

Yes, because the EFI parition mounted on /boot/esp, not on /boot (so, if i boot from system, the full path will be /boot/esp/EFI/refind/icons/os_arch.png)

/dev/nvme0n1p1 on /boot/ESP type vfat
/dev/nvme0n1p2 on / type ext4
d_fajardo wrote:
Searching for an initrd to match '\boot\vmlinuz-linux-zen' on 'ESP'

rEFInd seems to be looking the kernel inside ESP. Why did you name it ESP in the first place?

What's wrong with the name of the partition?

d_fajardo wrote:

Have you tried booting without the stanza? It is far simpler with refind_linux.conf inside boot.

I tried, and it works. It also works if I put linux kernel and initramfs to the EFI partition and try to boot from them. But still, why my config doesn't work?

Last edited by Senderman (2021-08-01 17:20:28)

Offline

#4 2021-08-02 09:28:13

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,658

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

Did you actually have a good read again of the rEFInd wiki as suggested?
If yes, then why do you have an /EFI directory and /boot/ESP directory?

But still, why my config doesn't work?

It already says there in your logs:

12:50:22 - Searching for an initrd to match '\boot\vmlinuz-linux-zen' on 'ESP'
12:50:22 - Kernel version string is '(null)'
12:50:22 - Located initrd is '(null)'
12:50:22 - Creating subscreen 'Boot Options for Arch Linux (Zen Kernel) on ESP'
12:50:22 - Creating loader entry for 'Boot Options for Arch Linux (Zen Kernel) on ESP'

I tried, and it works. It also works if I put linux kernel and initramfs to the EFI partition and try to boot from them.

This already answers your question.
Please re-read the wiki.

Offline

#5 2021-08-02 13:13:23

Senderman
Member
Registered: 2021-08-01
Posts: 7

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

d_fajardo wrote:

Did you actually have a good read again of the rEFInd wiki as suggested?

Yes, I did

d_fajardo wrote:

If yes, then why do you have an /EFI directory and /boot/ESP directory?

The /EFI direcotry is located in the root of my ESP partition (which is /dev/nvme0n1p1)
the /boot/esp directory is the mountpoint of the ESP parition (mount -t vfat /dev/nvme0n1p1 /boot/esp)
The /boot directory is not ESP directory, it's not even a mountpoint
The kernel and the initrd are located in /boot (on the Archlinux partition (mount -t ext4 /dev/nvme0n1p2 / )

d_fajardo wrote:

But still, why my config doesn't work?
It already says there in your logs:

12:50:22 - Searching for an initrd to match '\boot\vmlinuz-linux-zen' on 'ESP'
12:50:22 - Kernel version string is '(null)'
12:50:22 - Located initrd is '(null)'
12:50:22 - Creating subscreen 'Boot Options for Arch Linux (Zen Kernel) on ESP'
12:50:22 - Creating loader entry for 'Boot Options for Arch Linux (Zen Kernel) on ESP'

The 'on ESP' in the log means that rEFInd tries to find /boot/vlinux-linux-zen file on the ESP partition. But I put 'volume Archlinux' before the loader token
A quote from https://www.rodsbooks.com/refind/config … ml#stanzas:

'volume' sets the volume that's used for subsequent file accesses (by icon and loader, and by implication by initrd if loader follows volume). You pass this token a filesystem's label, a partition's label, or a partition's GUID. A filesystem or partition label is typically displayed under the volume's icon in file managers and rEFInd displays it on its menu at the start of the identifying string for an auto-detected boot loader. If this label isn't unique, the first volume with the specified label is used. The matching is nominally case-insensitive, but on some EFIs it's case-sensitive. If a volume has no label, you can use a partition GUID number. If this option is not set, the volume defaults to the one from which rEFInd launched.

So the Arch icon is loaded from the ESP partition (which is ok), and loader has to be loaded from 'Archlinux' partiton, but it does not!

d_fajardo wrote:

This already answers your question.

No, it doesn't. I want to put initrd and kernel on Archlinux partition and boot from it, i don't want to put initrd/kernel on ESP parition

Last edited by Senderman (2021-08-02 13:50:37)

Offline

#6 2021-08-02 13:23:43

Senderman
Member
Registered: 2021-08-01
Posts: 7

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

I figured out that maybe rEFInd uses UEFI's drivers to mount ext4 parition.

Archwiki wrote:

By default refind-install installs only the driver for the file system on which kernel resides. Additional file systems need to be installed manually by copying them from /usr/share/refind/drivers_x64/ to esp/EFI/refind/drivers_x64/

And maybe my UEFI just doesn't have ext4 driver, so the solutions are:
1) To put the ext4_x64.efi driver to the /boot/esp/EFI/refind/drivers directory
2) To move initrd/kernel to the esp partition

UPD
I copied /usr/share/refind/drivers_x64/ext4_x64.efi to the /boot/esp/EFI/refind/drivers directory and now everything works.
Solved!

Last edited by Senderman (2021-08-02 13:32:25)

Offline

#7 2021-08-02 14:00:49

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,658

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

The problem still exists that you have both /EFI directory and /boot/ESP. By design this doesn't look good and though it works for you now, it could be a potential problem for kernel upgrades or rEFInd upgrades.
Also the ext4 driver is built in rEFInd so in an ideal setup there reall is not a need to do anything or copy any driver. By way of you doing this manually means the setup is not ideal.
It's just difficult to comprehend why you setup things complicated when it's really rather simple.

Offline

#8 2021-08-02 15:19:17

Senderman
Member
Registered: 2021-08-01
Posts: 7

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

I agree that it's better to mount esp partition on /boot and keep kernel/initrd on esp partition, but I have too little space on it, and now it would be hard to do the disk repartition (because to extend nvme0n1p1, I have to move the start of the nvme0n1p2, which will waste too much time)
You said that rEFInd has built-in drivers. In fact, the only built-in driver it has is FAT32. But it also (as I quoted from archwiki) will copy driver of the filesystem where kernel resides, during the installation. Maybe when I was installing rEFInd, I had my kernel on esp partition (so the ext4 driver was not installed) and then I moved it to ext4 partition (I switched to rEFInd from systemd-boot)
There's no problem for kernel upgrades as long as the kernel is located in /boot directory
For the rEFInd upgrades, I don't know yet, but maybe it will cause problems in future. Or maybe not, idk.

Offline

#9 2021-08-02 15:32:19

progandy
Member
Registered: 2012-05-17
Posts: 5,280

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

refind should work just fine with the ESP mounted at /boot, /boot/efi, or /efi. Other paths may cause problems, like refind thinking it is not mounted and then mounting it somewhere to install and unmount again.

Last edited by progandy (2021-08-02 15:35:47)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#10 2021-08-02 15:42:23

Senderman
Member
Registered: 2021-08-01
Posts: 7

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

progandy, thanks, I renamed /boot/esp to /boot/efi

Last edited by Senderman (2021-08-02 15:43:08)

Offline

#11 2021-08-02 17:43:05

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,658

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

You said that rEFInd has built-in drivers. In fact, the only built-in driver it has is FAT32.

Yes you're right and I believe I wasn't clear on this. That is the reason why esp needs to be in a FAT filesystem.
What I really meant is that rEFInd finds the right drivers if it clearly sees the EFI partition so one doesn't need to manually copy it.

Offline

#12 2021-08-02 18:40:34

Senderman
Member
Registered: 2021-08-01
Posts: 7

Re: [SOLVED] rEFInd Ignores volume token in manual boot stanza

Yes, if you have kernel and initrd on ext4, and you run refind-install, it will copy driver automatically. But if you have kernel/initrd on ESP during refind-install, and then you move them to ext4, you'll have to copy the driver. And that's my case. Anyway, thanks smile

Offline

Board footer

Powered by FluxBB