Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GRUB Error 13 on a new kernel
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
tkzv
n00b
n00b


Joined: 22 Aug 2014
Posts: 69

PostPosted: Wed Jun 07, 2017 9:23 am    Post subject: GRUB Error 13 on a new kernel Reply with quote

1. I compiled a new kernel 4.9.16, with mostly the same config. I copied it to /boot and added it to /boot/grub/menu.lst. After the reboot I got a GRUB error:

Error 13: Invalid or unsupported executable format

Old kernel 4.4.6 boots fine.

file recognizes kernels as:
Code:

/boot/kernel-4.4.6:                               Linux kernel x86 boot executable bzImage, version 4.4.6-gentoo (root@jet) #1 SMP PREEMPT Mon Jul 4 22:52:11 MSK 2016, RO-rootFS, swap_dev 0x4, Normal VGA
/boot/kernel-4.9.16:                              Linux kernel x86 boot executable bzImage, version 4.9.16-gentoo (root@jet) #2 SMP PREEMPT Tue Jun 6 23:40:29 MSK 2017, RO-rootFS, swap_dev 0x5, Normal VGA


This was sys-boot/grub-static-0.97-r12

Just in case: I'm not using the swap partition.

Update: GRUB2 (sys-boot/grub-2.02_beta3-r1) managed to boot with the new kernel properly, once I figured which motherboard I had. The only question now is: Why did not GRUB-legacy boot kernel 4.9.16?

2. (SOLVED: motherboard doesn't support EFI, but BIOS boot partition worked fine.)

I assumed some new kernel features cause problems and tired installing new GRUB: sys-boot/grub-2.02_beta3-r1. /boot/grub/grub.cfg was generated by grub2-mkconfig from default /etc/default/grub. I created a FAT partition, added it to /etc/fstab, mounted it as /boot/efi, ran grub2-install:
Code:

# grub2-install --target=x86_64-efi /dev/sda
Installing for x86_64-efi platform.
EFI variables are not supported on this system.
EFI variables are not supported on this system.
Installation finished. No error reported.


After the reboot I got the old GRUB menu, which worked fine (but did not boot new kernel).

Disk partitions are:
Code:

# parted /dev/sda print
Model: ATA WDC WD40EFRX-68W (scsi)
Disk /dev/sda: 4001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system     Name  Flags
 1      1049kB  3947GB  3947GB  ext4            root  boot, esp
 2      3947GB  4001GB  53.7GB  linux-swap(v1)  swap
 3      4001GB  4001GB  2956kB                        boot, esp



The only question now is: Why did not GRUB-legacy boot kernel 4.9.16? Here's the diff between configs: https://pastebin.com/Rg8RixTn


Last edited by tkzv on Thu Jun 08, 2017 7:29 pm; edited 4 times in total
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7552
Location: Goose Creek SC

PostPosted: Thu Jun 08, 2017 12:30 pm    Post subject: Reply with quote

Quote:
# grub2-install --target=x86_64-efi /dev/sda
Installing for x86_64-efi platform.
EFI variables are not supported on this system.
EFI variables are not supported on this system.
Installation finished. No error reported.
The kernel needs to support efi/efi variables:
Code:
grep -i efi /usr/src/linux/.config
Quote:
CONFIG_EFI_PARTITION=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y
#CONFIG_EFI_MIXED is not set
CONFIG_FB_EFI=y
CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
# EFI (Extensible Firmware Interface) Support
CONFIG_EFI_VARS=m
CONFIG_EFI_ESRT=y
CONFIG_EFI_FAKE_MEMMAP=y
CONFIG_EFI_MAX_FAKE_MEM=8
CONFIG_EFI_RUNTIME_WRAPPERS=y
# CONFIG_EFI_BOOTLOADER_CONTROL is not set
# CONFIG_EFI_CAPSULE_LOADER is not set
# CONFIG_EFI_TEST is not set
CONFIG_EFI_DEV_PATH_PARSER=y
# CONFIG_CACHEFILES is not set
CONFIG_EFIVAR_FS=m
# CONFIG_EARLY_PRINTK_EFI is not set
# CONFIG_EFI_PGT_DUMP is not set
The system needs to support efi/efivars:
Quote:
emerge -av efivar efibootmgr
With kernel and system ready and the EFI partition mounted, run
Code:
grub-install --target=x86_64-efi --efi-directory=<path to EFI directory> /dev/sda
(should succeed without error)and finally run
Code:
grub-mkconfig -o /boot/grub/grub.cfg


Quote:
After the reboot I got the old GRUB menu, which worked fine.
If legacy grub is booting the new kernel, life should be good.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
tkzv
n00b
n00b


Joined: 22 Aug 2014
Posts: 69

PostPosted: Thu Jun 08, 2017 3:41 pm    Post subject: Reply with quote

DONAHUE wrote:
The kernel needs to support efi/efi variables:

It does:
Code:
# zgrep -i efi /proc/config.gz
CONFIG_EFI_PARTITION=y
CONFIG_EFI=y
# CONFIG_EFI_STUB is not set
CONFIG_FB_EFI=y
CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
# EFI (Extensible Firmware Interface) Support
CONFIG_EFI_VARS=y
CONFIG_EFI_ESRT=y
CONFIG_EFI_RUNTIME_MAP=y
# CONFIG_EFI_FAKE_MEMMAP is not set
CONFIG_EFI_RUNTIME_WRAPPERS=y
CONFIG_EFIVAR_FS=m
# CONFIG_EARLY_PRINTK_EFI is not set
# CONFIG_EFI_PGT_DUMP is not set
[/quote]

DONAHUE wrote:
The system needs to support efi/efivars:

In does. Both efivar and efibootmgr were present.

As I just found, I mistook my motherboard for a slightly different model, ASUS M5A78L/USB3. My motherboard ASUS M5A78L LE turned out to have no EFI support. I'll try BIOS recipe instead.

Quote:
Quote:
After the reboot I got the old GRUB menu, which worked fine.
If legacy grub is booting the new kernel, life should be good.
It doesn't. (I've corrected the first post to make it clearer.) That mystery is still unsolved. Any ideas?
Back to top
View user's profile Send private message
tkzv
n00b
n00b


Joined: 22 Aug 2014
Posts: 69

PostPosted: Thu Jun 08, 2017 4:14 pm    Post subject: Reply with quote

Creating a BIOS boot partition for GRUB2 worked. I still would like to know what was the problem with GRUB1.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7552
Location: Goose Creek SC

PostPosted: Thu Jun 08, 2017 4:38 pm    Post subject: Reply with quote

The manual for legacy grub says
Quote:
13. Invalid or unsupported executable format
This error is returned if the kernel image being loaded is not recognized as Multiboot or one of the supported native formats (Linux zImage or bzImage, FreeBSD, or NetBSD).
Suggesting there is some subtle difference in the compiled form of new and old kernel or how each was copied to /boot.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
tkzv
n00b
n00b


Joined: 22 Aug 2014
Posts: 69

PostPosted: Thu Jun 08, 2017 7:28 pm    Post subject: Reply with quote

DONAHUE wrote:
The manual for legacy grub says
Quote:
13. Invalid or unsupported executable format
This error is returned if the kernel image being loaded is not recognized as Multiboot or one of the supported native formats (Linux zImage or bzImage, FreeBSD, or NetBSD).
Suggesting there is some subtle difference in the compiled form of new and old kernel or how each was copied to /boot.
Both were bzImages, both used XZ compression, though I tried gzip too.

Here is the diff between old and new configs: https://pastebin.com/Rg8RixTn It's long, but most changes were done automatically.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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