You are not logged in.

#1 2019-02-04 12:30:51

afusco
Member
Registered: 2016-01-20
Posts: 3

[SOLVED] Cannot boot custom kernel with refind - Invalid loader file

I'm experimenting with linux kernels. I built a kernel out of the linux-next branch. I cannot boot it.

I'm mounting many OSes on this machine; arch is installed on /dev/sdb8.
Refind is installed on /dev/sdb1 with another OS. This was before Arch was installed.
All internal booting options are defined in manual stanzas.

I have a working Arch system that is able to boot with the following refind manual stanza.

#This correctly boots
menuentry "Arch Linux" {
    volume   "ddf6d72a-d1d3-4b27-8055-ff0748ca9015"
    loader   /boot/vmlinuz-linux
    initrd   /boot/initramfs-linux.img
    options  "root=UUID=d4a9bd86-b683-4fcb-b095-1a0e97a08d2a rw add_efi_memmap initrd=/boot/intel-ucode.img"

    submenuentry "Boot using fallback initramfs" {
        initrd /boot/initramfs-linux-fallback.img
    }

    submenuentry "Boot to terminal" {
        add_options "systemd.unit=multi-user.target"
    }
}

The kernel I built does not boot with the following entry:

#This gives me "invalid loader, error: not found vmlinuz-next"
menuentry "Arch Linux Next" {
    volume   "ddf6d72a-d1d3-4b27-8055-ff0748ca9015"
    loader   /boot/vmlinuz-next
    initrd   /boot/initramfs-next.img
    options  "root=UUID=d4a9bd86-b683-4fcb-b095-1a0e97a08d2a rw add_efi_memmap initrd=/boot/intel-ucode.img"

    submenuentry "Boot using fallback initramfs" {
        initrd /boot/initramfs-next-fallback.img
    }
    submenuentry "Boot to terminal" {
        add_options "systemd.unit=multi-user.target"
    }
}

You can find the whole refind.conf file here: https://pastebin.com/52Vz7BRW

My partitions are setup like this

NAME   FSTYPE LABEL      UUID                                 PARTUUID                             MOUNTPOINT
sda                                                                                                
├─sda1 ntfs   Data       30A0836CA083377E                     edbade3c-01                          
└─sda2 ext4              ed706919-e8ad-4791-8ad0-a6015a0201f1 edbade3c-02                          
sdb                                                                                                
├─sdb1 vfat              DB65-8235                            7149817c-2c13-4d45-ac0c-4e9417cdc630 /boot/efi
├─sdb2 ntfs   Ripristino E47878A2787874E0                     1330777b-7276-445a-988b-7a37b42c2bf5 
├─sdb3 vfat              567B-DF16                            bab795e0-9d09-4f14-aecd-c1a56efa10dc 
├─sdb4                                                        5d08b780-c9fc-4160-8371-9c4c0661ac0a 
├─sdb5 ntfs              A26696AB66967FA9                     4f9cd24d-913f-4823-a9b4-a7cb1d4ad5bd 
├─sdb6 ext4              12ab1c28-ae88-4b40-b130-6c9c4b318e70 aed87b52-f2b0-48a0-a189-ad6bc7be8407 
├─sdb7 ext4              75c6ef80-a843-400d-84a7-952ccd8c371d 906436bc-35ae-4263-b036-bffd7faeba68 
└─sdb8 ext4              d4a9bd86-b683-4fcb-b095-1a0e97a08d2a ddf6d72a-d1d3-4b27-8055-ff0748ca9015 /

This is the content of the /boot directory

total 72708
drwxr-xr-x  3 root root     4096 Feb  4 12:57 .
drwxr-xr-x 17 root root     4096 Feb  3 09:20 ..
drwxr-xr-x  3 root root     4096 Jan  1  1970 efi
-rw-r--r--  1 root root 28999065 Feb  4 11:03 initramfs-linux-fallback.img
-rw-r--r--  1 root root  7788302 Feb  4 11:03 initramfs-linux.img
-rw-r--r--  1 root root  6998992 Feb  4 12:25 initramfs-next-fallback.img
-rw-r--r--  1 root root  6361237 Feb  4 12:25 initramfs-next.img
-rw-r--r--  1 root root  1747456 Aug 25 10:35 intel-ucode.img
-rw-r--r--  1 root root  4074683 Feb  4 12:43 System.map
-rw-r--r--  1 root root  4074683 Feb  4 12:23 System.old
-rw-r--r--  1 root root  5855104 Jan 31 09:17 vmlinuz-linux
-rw-r--r--  1 root root  8523824 Feb  4 12:23 vmlinuz-next

After building the linux-next kernel i installed this way:

make install #this puts the bzImage of the kernel in /boot/vmlinuz
cd /boot
mv vmlinuz vmlinuz-next # I rename it
mkinitcpio -p next # I create initramfs-next

This is the "next" mkinitcpio profile, which is a slight modification of the default linux profile

# mkinitcpio preset file for the 'linux' package

ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-next"

PRESETS=('default' 'fallback')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-next.img"
#default_options=""

#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-next-fallback.img"
fallback_options="-S autodetect"

I really don't understand what's wrong.
Why can't refind find my vmlinuz-next image?

Last edited by afusco (2019-02-05 09:35:16)

Offline

#2 2019-02-04 13:02:25

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Cannot boot custom kernel with refind - Invalid loader file

Does it work if you build the AUR package instead of compiling manually?

https://aur.archlinux.org/packages/linux-next-git/


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2019-02-04 13:52:26

afusco
Member
Registered: 2016-01-20
Posts: 3

Re: [SOLVED] Cannot boot custom kernel with refind - Invalid loader file

I don't like that package dependencies.. no need for graphviz or xorg or python to build a kernel (I'm trying to keep this installation minimal)

But I run a test: remove my custom kernel, copy the working kernel to vmlinuz-next, rerun mkinitcpio and check if refind can boot it. And it can.

So I guess you are right in thinking that the kernel wasn't compiled properly.
Now I'm trying to build the kernel from the mainline and see if it boots. I'll keep you updated.

What could cause refind not to boot a bzimage and throw an "error not found?

Offline

#4 2019-02-05 09:34:55

afusco
Member
Registered: 2016-01-20
Posts: 3

Re: [SOLVED] Cannot boot custom kernel with refind - Invalid loader file

I was able to successfully boot the next kernel after a rebuild. I guess it was a configuration problem, I rebuilt it following the same steps but reusing the current config taken from /proc/config.gz
Still, I believe that refind should be able to provide a more descriptive error than "Not found", especially when the image is there.
Well, I guess I can mark this topic as solved.
Have a good day and thanks for your help

Offline

#5 2019-02-05 10:00:51

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Cannot boot custom kernel with refind - Invalid loader file

afusco wrote:

I don't like that package dependencies.. no need for graphviz or xorg or python to build a kernel (I'm trying to keep this installation minimal).

Then just remove the makedepends after building using makepkg's -r flag or ideally build in a clean chroot so that nothing gets installed on your main system.

Glad you got it fixed smile


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

Board footer

Powered by FluxBB