Skip to main content
Topic: ERROR: invalid kernel specified: `/boot/vmlinuz-linux' (Read 3487 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #15
I sure can I appreciate you spending all this time.

Code: [Select]
bash-5.1$ read kver _ < <(dd if=/boot/vmlinuz-linux bs=1 count=127 skip=$(( 14464 + 0x200 )) 2>/dev/null)
bash-5.1$ echo $kver
5.13.10-artix1-1

I am sure you realize this, I have installed 5.13.10-artix1-1, but I am still running Linux 5.13.8-artix1-1

I am almost certain that if I reboot, it won't

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #16
The generation of initramfs failed on your system, so your system definitely won't boot if you restart it.

That the function fails, but the commands it calls don't is weird. I'd try to call kver /boot/vmlinuz-linux again, just is case.

What I'd try is to replace zsh with bash, (chsh first as user, then as root, maybe even run pacman -S bash for good measure) relog (not restart) and then retry pacman -S linux mkinitcpio as root.

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #17
Code: [Select]
# /usr/bin/bash --norc
bash-5.1# source /usr/lib/initcpio/functions
bash: /usr/lib/initcpio/functions: line 817: syntax error near unexpected token `('
bash: /usr/lib/initcpio/functions: line 817: `    rm "$moduledest"/modules.!(*.bin|devname|softdep)'
bash-5.1# type kver
kver is a function
kver ()
{
    local kver re='^[[:digit:]]+(\.[[:digit:]]+)+';
    local offset=$(hexdump -s 526 -n 2 -e '"%0d"' "$1");
    [[ $offset = +([0-9]) ]] || return 1;
    read kver _ < <(dd if="$1" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null);
    [[ $kver =~ $re ]] || return 1;
    printf '%s' "$kver"
}
bash-5.1# set -x
bash-5.1# kver /boot/vmlinuz-linux
+ kver /boot/vmlinuz-linux
+ local kver 're=^[[:digit:]]+(\.[[:digit:]]+)+'
++ hexdump -s 526 -n 2 -e '"%0d"' /boot/vmlinuz-linux
+ local offset=14464
+ [[ 14464 = +([0-9]) ]]
+ read kver _
++ dd if=/boot/vmlinuz-linux bs=1 count=127 skip=14976
+ [[ You =~ ^[[:digit:]]+(\.[[:digit:]]+)+ ]]
+ return 1

I did as you suggested. Changed shells, reinstalled bash, relog, pacman -S linux mkinitcpio, but unfortunately I'm still getting invalid kernel specified errors.

Did you happen to upgrade to linux-5.13.10.artix1-1 yet?

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #18
Did you happen to upgrade to linux-5.13.10.artix1-1 yet?
Yes, without any problems.

What you describe is very weird and shouldn't happen. We have narrowed it down to the assignment to the $kver variable by process substitution <(), but if that command works on its own, it should work as part of the function as well. There must be some interaction or limit somewhere, but I'm out of ideas.

If anything else fails, reinstall Artix from bootable media and upgrade.

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #19
Have you tried to install lts kernel?

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #20
Yes, I tried installing linux-lts and linux-zen and the same thing happened with both of them, too.

I went by my office where I still run Arch linux. I did the updates, got linux-5.13.10, and the same thing happened on Arch linux. So something about the way I set these two computers up had the same effect when linux 5.13.10 came along. I've been using zsh for many years, but maybe that is it and it just never mattered until now, I don't know. I also use the program R a lot on both computers and I wonder if some kind of a file conflict might be causing it.

strajder, thanks for your help!


Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #21
Tough luck then. But while initcpio is so capricious, it's still possible to try dracut.

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #22
Couple of alternative ideas:
https://www.cgsecurity.org/wiki/PhotoRec
If you were lucky you might get the deleted contents of /boot back, but you would need to be careful even if you did find some, because they might be corrupted or older versions. Could take a while if you weren't familiar with that software though and it might not work when you rebooted!
Also, if these are important systems, copy them (at least the system parts if not /home/ and it's probably less than 10GB) to an external drive or USB and then you can chroot in and try stuff in safety. Probably rolling back some updates would fix it but safest to figure out on the copy, if one slip means you can't reboot and then have to chroot in anyway.

failing command from first post:
Code: [Select]
# mkinitcpio -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
man mkinitcpio:
-k, --kernel kernelversion
           Use kernelversion, instead of the current running kernel. This may be a path to a kernel image (only supported for x86-based architectures), a
           specific kernel version or the special keyword none. In the latter case, no kernel modules are added to the image.

Perhaps not x86?
This should make the /boot stuff for the currently running kernel, you could try and figure out the -k content for other versions later if it worked:
Code: [Select]
# mkinitcpio -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #23
failing command from first post:
Code: [Select]
# mkinitcpio -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
While this could work, the OP could still experience the issue on every update and would possibly have to manually generate initramfs every time.

The issue itself would require more thorough debugging, removing any user-modified configuration files, separate versions of programs and alternate symbolic links to programs.

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #24
Not sure it's user config doing it, on my system:
Code: [Select]
$ sudo mkinitcpio -p linux
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
But perhaps that -k /boot/vmlinuz-linux won't work on say, an ARM server, according to the man page? This would only be relevant if both the problem machines were not x86 though, which I don't know, and if the -k specifier content or something related to it's behavior has changed on an update.

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #25
But perhaps that -k /boot/vmlinuz-linux won't work on say, an ARM server, according to the man page? This would only be relevant if both the problem machines were not x86 though, which I don't know, and if the -k specifier content or something related to it's behavior has changed on an update.
Maybe the OP is using a virtual machine?

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #26
Code: [Select]
# /usr/bin/bash --norc
bash-5.1# source /usr/lib/initcpio/functions
bash: /usr/lib/initcpio/functions: line 817: syntax error near unexpected token `('
bash: /usr/lib/initcpio/functions: line 817: `    rm "$moduledest"/modules.!(*.bin|devname|softdep)'
bash-5.1# type kver
kver is a function
kver ()
{
    local kver re='^[[:digit:]]+(\.[[:digit:]]+)+';
    local offset=$(hexdump -s 526 -n 2 -e '"%0d"' "$1");
    [[ $offset = +([0-9]) ]] || return 1;
    read kver _ < <(dd if="$1" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null);
    [[ $kver =~ $re ]] || return 1;
    printf '%s' "$kver"
}
bash-5.1# set -x
bash-5.1# kver /boot/vmlinuz-linux
+ kver /boot/vmlinuz-linux
+ local kver 're=^[[:digit:]]+(\.[[:digit:]]+)+'
++ hexdump -s 526 -n 2 -e '"%0d"' /boot/vmlinuz-linux
+ local offset=14464
+ [[ 14464 = +([0-9]) ]]
+ read kver _
++ dd if=/boot/vmlinuz-linux bs=1 count=127 skip=14976
+ [[ You =~ ^[[:digit:]]+(\.[[:digit:]]+)+ ]]
+ return 1

I did as you suggested. Changed shells, reinstalled bash, relog, pacman -S linux mkinitcpio, but unfortunately I'm still getting invalid kernel specified errors.

Did you happen to upgrade to linux-5.13.10.artix1-1 yet?
Considering you said you changed shells and reinstalled bash... what is /usr/bin/sh linked to?
Chris Cromer

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #27
Hi, sorry for the delay.

Quote
Maybe the OP is using a virtual machine?

No, both the Artix installation at home and the Arch installation at work were bare metal.

Quote
Considering you said you changed shells and reinstalled bash... what is /usr/bin/sh linked to?

Code: [Select]
lrwxrwxrwx 1 root root 4 May 9 13:14 sh -> bash

I thought I would chroot in and see if matters improved. I don't know if any of the messages in here might provide a clue. Here I have only typed in the lines that seem like they might be helpful.

Code: [Select]
sh-5.1# pacman -S linux linux-headers util-linux mkinitcpio
...
(2/5) Creating temporary files...
Failed to open file "/sys/devices/system/cpu/microcode/reload": Read-only file system
error: command failed to execute correctly
(3/5) Reloading device manager configuration...
 Skipped: Device manager is not running.
...
(5/5) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> ERROR: invalid kernel spcified: '/boot/vmlinuz-linx'

The results were the same for linux-lts, linux-zen, and all the fallback images.

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #28
Code: [Select]
$ ls /usr/lib/modules
will show installed kernels, pick the one you want to build for and be careful as you may see extra dirs for kernels that aren't installed if you have headers only for some versions, they won't build and fail with an error.
So just take the name as given in that dir and use it for -k instead of the vmlinuz which isn't working, to run the command manually and see if specifying the actual kernel version helps:
Code: [Select]
# mkinitcpio -k x.y.z-artix-foobar -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
It won't resolve the vmlinuz issue but it might fix the immediate problem so you can reboot.

Re: ERROR: invalid kernel specified: `/boot/vmlinuz-linux'

Reply #29
I had both /usr/lib/modules/5.13.10-artix1-1 and linux-headers 5.13.10.artix1-1, so as you suggested:

Code: [Select]
mkinitcpio -k 5.13.10-artix1-1 -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img

And I did get a /boot/initramfs-linux.img!

Its size is 5594970.

But, when I rebooted it hung here.

Code: [Select]
Loading Linux linux ...
Loading initial ramdisk ...

Thanks anyway for your help.

I got all my files off that drive. So no problem there. If its time to call it I can live with that.