I getting the errors 'invalid magic number' and 'you need to load the kernel' in grub

I have a dual booted laptop with windows 10 and endevour which I’ve had no problems until now.

I don’t think I did anything weird to my instalation in order for this to happen, except for maybe shutting my laptop down during an ‘yay -Syu’.

Also I am able to use ‘arch-chroot’ from my live USB.

Chroot in then:

sudo pacman -Syu
sudo mkinitcpio -P
sudo grub-mkconfig -o /boot/grub/grub.cfg

Exit the chroot and reboot.

outputs

==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux'
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux'

and

outputs

/usr/bin/grub-mkconfig: line 248: /boot/grub/grub.cfg.new: No such file or directory

Did the pacman command return anything?

In the chroot try to reinstall a kernel.

sudo pacman -S linux linux-headers

Interesting. I in the past had a magic number error but that was “bad magic number in super-block”.

I was also not able to boot until I fixed the error. Maybe you have the same issue?

The following page explains the error and how to fix it. Helped me back then.

It didn’t return any errors just updated some programs.

I just reinstalled linux and linux-headers; It still doesn’t work.

Did you rerun the mkint & grub commands?

No, I’ll try rerunning them now.

Now, mkinit only gives me a couple of warnings( Possibly missing firmware for module: ) while mkgrub still gives me the same output.

Have you used grub-customizer or other unofficial grub app?

sudo grub-install /dev/sdX

In the chroot
Where X is the letter of your drive, then update grub again.

The mkinitcpio errors are meaningless, ignore - I get them too.

In order to boot Eos directly, no. I have installed Aio boot though after I dual booted with windows. I use it to open the original grub that I got when I installed Eos.

It outputs this :

[root@archiso /]# sudo grub-install /dev/nvme0n1p2
Installing for i386-pc platform.
grub-install: warning: File system `ext2' doesn't support embedding.
grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists.

sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=EndeavourOS --recheck
sudo grub-mkconfig -o /boot/grub/grub.cfg

Long day and I don’t use EFI - try the above.

I ran them in their respective order

Installing for x86_64-efi platform.
grub-install: error: failed to get canonical path of `/boot/efi'.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
done

It appears to be working, though I have 2 grubs now. Thanks a lot!

I don’t normally use EFI, but this is an EFI install, forgot I did it.

Glad it is working, looks like something screwed up badly, might be worth a reinstall, even though it is working.

1 Like