You are not logged in.

#1 2017-12-13 22:15:27

dimo
Member
Registered: 2017-12-04
Posts: 8

[SOLVED] Invalid magic number

I have grub on a uefi/gpt boot system. Today when i tried to boot into arch i got this message:

error: invalid magic number.
Loading initial ramdisk...
error: you need to lead the kernel first

I don't remember what i did on arch last time (2 days ago) but i think nothing of special.
Today i updated windows, but i don' t think that matters.
However i still could boot into windows and ubuntu, so i booted into ubuntu and tried to fix grub.
Nothing changes.
I apt-get upgrade in ubuntu (i didn't use it for 2 years so i don't know why i did it), he did some changes on grub and now i can't boot on any system.
With efibootmgr i can see the windows boot loader, the arch-grub and 2 ubuntu-grub.
When i try to boot into arch i get the invalid magic number error, on ubuntu i get system is running in low graphics mode and doesn't start, while windows gives me a wonderful black screen.
I have a live usb with arch, but i really don't know what should i do.
I tried to do grub-install and grub-mkconfig.
The first one works successfully, while the second one gives me failed to connect to lvmetad.

P.S. If it can make things easier i don't care about data (i already save them) so i can reinstall arch if necessary.

Last edited by dimo (2017-12-17 21:44:59)

Offline

#2 2017-12-14 10:15:42

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,558

Re: [SOLVED] Invalid magic number

It wouldn't be the first windows 10 update that screws up other OSes.

Boot the arch linux live iso, then try to chroot to your installed system.
If that works, try re-running mkinitcpio -p linux .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2017-12-14 11:45:44

dimo
Member
Registered: 2017-12-04
Posts: 8

Re: [SOLVED] Invalid magic number

The result was: invalid kernel specified: /boot/vmlinuz-linux.
What i did:

mkdir /mnt/arch
mount /dev/sda9 /mnt/arch
mount /dev/sda1 /mnt/arch/boot
arch-chroot /mnt/arch
mkinitcpio -p linux

i tried

 pacman -U --force /var/cache/pacman/pkg/linux-4.14.4-1-x86_64.pkg.tar.xz 

but it failed with

gzip: stdout: No space left on device
Bsdcpio: write error: broken pipe
ERROR: image generation failed: bsdcpio reported an error

Now i get this error from mkinitcpio too.
I don't understand, there's a lot of space, is it trying to install it on my usb?

Offline

#4 2017-12-14 11:50:57

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

Re: [SOLVED] Invalid magic number

Is there really space left on your EFI (/boot) partition?

df -h /dev/sda1

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

Offline

#5 2017-12-14 12:00:47

dimo
Member
Registered: 2017-12-04
Posts: 8

Re: [SOLVED] Invalid magic number

progandy wrote:

Is there really space left on your EFI (/boot) partition?

df -h /dev/sda1

Yes, you are right, there is no space left.
I was checking that with du -sh /boot after pacman -Syyu told me no space on /boot.
96MB used over 100MB

Edit: my answer was not clear

Last edited by dimo (2017-12-14 12:08:14)

Offline

#6 2017-12-14 12:11:58

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

Re: [SOLVED] Invalid magic number

So you only have 4MB free? Try to move your initramfs-linux-fallback.img somewhere else first.
Edit: I really suggest you show the df output.

Last edited by progandy (2017-12-14 12:22:25)


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

Offline

#7 2017-12-14 12:45:49

dimo
Member
Registered: 2017-12-04
Posts: 8

Re: [SOLVED] Invalid magic number

progandy wrote:

So you only have 4MB free? Try to move your initramfs-linux-fallback.img somewhere else first.
Edit: I really suggest you show the df output.

Filesystem Size Used Avail Use Mounted on
/dev/sda1  96M  96M  1.0K  100% /boot

After moving away initramfs-linux-fallback.img the used size becomes 73M, but it seems is not enough.

Offline

#8 2017-12-14 13:05:44

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

Re: [SOLVED] Invalid magic number

If "pacman -Qkk linux" doesn't throw any errors (except a few in /usr/lib/modules), then you should be able to at least run mkinitcpio to genreate the default initramfs. If you get "==> Image generation successful" in the first half of the output then it worked. The second half of the output is only for the fallback image.


By the way, a 100MB EFI partition is pretty low for a multiboot system. The arch linux kernel alone requires about 45MB (vmlinuz + ramfs + ramfs-fallback), then add grub, windows, ubuntu, ...


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

Offline

#9 2017-12-14 15:41:00

dimo
Member
Registered: 2017-12-04
Posts: 8

Re: [SOLVED] Invalid magic number

I succeeded to boot into arch from grub. But I really don't know how.
The output of pacman -Qkk linux is:

warning: linux: /boot/vmlinuz-linux (Permissions mismatch)
warning: linux: /boot/vmlinuz-linux (Modification time mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.alias (Modification time mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.alias.bin (Modification time mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.builtin.bin (Modification time mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.dep (Modification time mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.dep (Size mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.dep.bin (Modification time mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.dep.bin (Size mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.devname (Modification time mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.softdep (Modification time mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.symbols (Modification time mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.symbols (Size mismatch)
warning: linux: /usr/lib/modules/4.14.5-1-ARCH/modules.symbols.bin (Modification time mismatch)
warning: /usr/lib/modules/4.14.5-1-ARCH/modules.symbols.bin (Size mismatch)

I just ran "grub-install ..". But this time without the --bootloader-id option and without run grub-mkconfig after that.
I solved the no space left problem on the boot partition moving away a FSCK0001.REC file (23MB).
The original "invalid magic number" issue is solved (yeah), however ubuntu gives me some errors (but i don't care, i'll remove it) and the windows boot loader doesn't work (that's a big problem).
Just a last little thing, that's my efibootmgr output:

BootCurrent: 0002
Timeout: 2 seconds
BootOrder: 0005,0002,0003,0000,0001
Boot0000* Windows Boot Manager
Boot0001* ubuntu
Boot0002* grub
Boot0003* ubuntu
Boot0005* arch

Can i remove Boot0001, Boot0003, Boot 0005 with "efibootmgr -b 000X -B" right?

Thank you so much for the help!

P.S. any suggestion to fix the windows issue?

Offline

Board footer

Powered by FluxBB