Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: Cannot boot. "error: premature end of file /boot/vmlinuz-linux." (Read 2180 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Cannot boot. "error: premature end of file /boot/vmlinuz-linux."

Black screen upon logging in this morning, hear noises from startup programs so maybe it was just the window manager.
Had a session yesterday, can't think of anything that I did to cause this.
Haven't updated since the 9th.
Decided to pacman -Syu through tty (and make the situation worse, bad upgrade?)
Rebooted to grub menu and it displays this error:
Code: [Select]
Loading Linux linux ...
error: premature end of file /boot/vmlinuz-linux.
Loading initial ramdisk ...
error: you need to load the kernel first.

I checked the updated packages before installing and I thought I saw linux among them but it's not in pacman.log

Some searches recommend reinstalling the kernel.
Should I and is this how to do that?
LiveISO chroot into mount
Code: [Select]
pacman --force -S linux linux-headers

Checked missing package files
Code: [Select]
pacman -Qk 2>/dev/null | grep -v "0 missing files"
artix-branding-base: 19 total files, 3 missing files
   
Let me know if I should run any commands to help.

Re: Cannot boot. "error: premature end of file /boot/vmlinuz-linux."

Reply #1
i think you hit the grub bug from the version 2.0.6-r322, which landed in artix ~2 weeks ago.
see here for more infos: https://forum.artixlinux.org/index.php/topic,4464.0.html
basically, you'll have to reboot on a live cd/usb, mount your partitions, chroot and reinstall grub (grub-install and grub-mkconfig)

Re: Cannot boot. "error: premature end of file /boot/vmlinuz-linux."

Reply #2
Seems strange because I upgraded grub to that version on the 9th.
I managed to perform those steps however after drive decryption the grub menu now only shows one entry and that's for the UEFI settings.
Code: [Select]
artix-chroot /[root mount]
mount /dev/[EFI partition] /boot
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub
Installing for x86_64-efi platform.
Installation finished. No error reported.
grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/artix/theme.txt
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
ERROR: mkdir /var/lock/dmraid
Adding boot menu entry for UEFI Firmware Settings ...
done

Re: Cannot boot. "error: premature end of file /boot/vmlinuz-linux."

Reply #3
I checked fstab and noticed the EFI partition gets mounted to /boot/efi not /boot which solved the grub-install issue however the original issue remains.
Selecting the boot entry results in this error:
Code: [Select]
Loading Linux linux ...
error: premature end of file /boot/vmlinuz-linux.
Loading initial ramdisk ...
error: you need to load the kernel first.

Re: Cannot boot. "error: premature end of file /boot/vmlinuz-linux."

Reply #4
When libxfont2 updated a little while back I also ended up having a similar issue (for different programs), because updating libxfont2 caused my graphical session to crash (which killed pacman, resulting in a partial upgrade), a partial upgrade caused the file to only be partially written.

I could fortunately boot to fix the issue, you'll have to use a live environment and chroot in. To fix this, you'll need to remove and re-download and re-install the package that provides vmlinuz-linux, which I believe is the linux package. Because there will be existing files from the program you will need to tell pacman to overwrite any existing files with the overwrite argument.

 

Re: Cannot boot. "error: premature end of file /boot/vmlinuz-linux."

Reply #5
I managed to fix this yesterday by reinstalling every package with overwrite and manually deleting /etc/mkinitcpio.d/linux.preset before reinstalling the linux package. Just reinstalling linux with overwrite after deleting linux.preset might have worked on it's own.

Hashed steps as I didn't fully record the output:
  • Removed linux
Code: [Select]
pacman -R linux
Error: file xyz is empty, not checked
e.g. usr/bin/ldconfig: File /usr/lib/libQt6Gui.so.6.3.2 is empty, not checked.
  • Installed linux
Code: [Select]
pacman -S linux
Error: file xyz exists in filesystem
  • Reinstalled linux with --overwrite but I didn't search for the error at the time.
(some error)
  • Decided to reinstall every package
Code: [Select]
pacman -Qqn | pacman -S -
Error: file xyz exists in filesystem
  • Reinstalled every package with overwrite
Code: [Select]
pacman -Qqn | pacman -S --overwrite=* -
  • Reinstalled linux with overwrite
Code: [Select]
(2/3) Updating linux initcpios...
==> WARNING: Preset file `/etc/mkinitcpio.d/linux.preset' is empty or does not contain any presets.
(3/3) Refreshing PackageKit...
Error connecting: Could not connect: No such file or directory
error: command failed to execute correctly
  • Deleted linux.preset
Code: [Select]
sudo rm /etc/mkinitcpio.d/linux.preset
  • Reinstalled linux