Mkinitcpio 39 is buggy

baseversion is not added to initramfs.

also the grub menu is looking wired.
Unstable on a qemu vm.

$ ls                                                                                                                                                      
amd-ucode.img  grub  initramfs--fallback.img  initramfs-.img  intel-ucode.img  linux68-x86_64.kver  linux69-x86_64.kver  memtest86+  vmlinuz-

Maybe something to do with the vm?

Could not reproduce.

With 6.6 LTS plus one custom kernel;

$ ls -a /boot | sort
.
..
amd-ucode.img
efi
grub
initramfs-6.6-x86_64.img
initramfs-linux-amd-znver3.img
linux66-x86_64.kver
memtest86+
System.map-6.8.9-AMD-znver3
vmlinuz-6.6-x86_64
vmlinuz-linux-amd-znver3

And grub looks normal during boot, etc.

okay… seams fine now, I had to reinstall all Kernels

$ ls /boot | sort
amd-ucode.img
grub
initramfs-6.6-x86_64-fallback.img
initramfs-6.6-x86_64.img
initramfs-6.8-x86_64-fallback.img
initramfs-6.8-x86_64.img
intel-ucode.img
linux66-x86_64.kver
linux68-x86_64.kver
memtest86+
vmlinuz-6.6-x86_64
vmlinuz-6.8-x86_64

For some reasons the presets where corrupted…

I am confused now, the mkinitcpio update today has modified the presets.

cat linux66.preset 
# mkinitcpio preset file for the '%PKGBASE%' package

#ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-"

PRESETS=('default' 'fallback')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-.img"
#default_uki="/efi/EFI/Linux/manjaro-.efi"
#default_options="--splash /usr/share/systemd/bootctl/splash-manjaro.bmp"

#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs--fallback.img"
#fallback_uki="/efi/EFI/Linux/manjaro--fallback.efi"
fallback_options="-S autodetect"
cat linux68.preset
# mkinitcpio preset file for the '%PKGBASE%' package

#ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-"

PRESETS=('default' 'fallback')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-.img"
#default_uki="/efi/EFI/Linux/manjaro-.efi"
#default_options="--splash /usr/share/systemd/bootctl/splash-manjaro.bmp"

#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs--fallback.img"
#fallback_uki="/efi/EFI/Linux/manjaro--fallback.efi"
fallback_options="-S autodetect"
1 Like

Either your files were messed up by something else, were already in an unexpected ‘bad’ state, or there is something wrong with the ALPM-Scriptlet.
My files do not look like that.
But also none of the scriptlets fired.

[ALPM] upgraded mkinitcpio (39-4 -> 39-5)
[ALPM-SCRIPTLET] ==> Check if we should port MODULES to new array format in /etc/mkinitcpio.conf.
[ALPM-SCRIPTLET]   -> No string format found. No change.
[ALPM-SCRIPTLET] ==> Check if we should port BINARIES to new array format in /etc/mkinitcpio.conf.
[ALPM-SCRIPTLET]   -> No string format found. No change.
[ALPM-SCRIPTLET] ==> Check if we should port FILES to new array format in /etc/mkinitcpio.conf.
[ALPM-SCRIPTLET]   -> No string format found. No change.
[ALPM-SCRIPTLET] ==> Check if we should port HOOKS to new array format in /etc/mkinitcpio.conf.
[ALPM-SCRIPTLET]   -> No string format found. No change.
[ALPM-SCRIPTLET] ==> Check if we need to add "kms" to hooks in /etc/mkinitcpio.conf.
[ALPM-SCRIPTLET]   -> "kms" hook already exists. Doing nothing.
[ALPM] transaction completed

PS.

Is there a reason you are messaging me instead of writing in a public thread?

Was to lacy to open a new one as this one is closed.

[2024-05-09T21:34:06+0200] [ALPM] upgraded mkinitcpio (39-1 -> 39-5)
[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET] ==> Check if we should port MODULES to new array format in /etc/mkinitcpio.conf.
[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET] ==> Check if we should port BINARIES to new array format in /etc/mkinitcpio.conf.
[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET] ==> Check if we should port FILES to new array format in /etc/mkinitcpio.conf.
[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET] ==> Check if we should port HOOKS to new array format in /etc/mkinitcpio.conf.
[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET] ==> Check if we need to add "kms" to hooks in /etc/mkinitcpio.conf.
[2024-05-09T21:34:25+0200] [ALPM] running '90-mkinitcpio-install.hook'...
[2024-05-09T21:34:25+0200] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux66.preset: 'default'
[2024-05-09T21:34:25+0200] [ALPM-SCRIPTLET] ==> Using default configuration file: '/etc/mkinitcpio.conf'
[2024-05-09T21:34:28+0200] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux66.preset: 'fallback'
[2024-05-09T21:34:28+0200] [ALPM-SCRIPTLET] ==> Using default configuration file: '/etc/mkinitcpio.conf'
[2024-05-09T21:34:41+0200] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux68.preset: 'default'
[2024-05-09T21:34:41+0200] [ALPM-SCRIPTLET] ==> Using default configuration file: '/etc/mkinitcpio.conf'
[2024-05-09T21:34:44+0200] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux68.preset: 'fallback'
[2024-05-09T21:34:44+0200] [ALPM-SCRIPTLET] ==> Using default configuration file: '/etc/mkinitcpio.conf'
[2024-05-09T21:41:49+0200] [ALPM] running '90-mkinitcpio-install.hook'...
[2024-05-09T21:41:50+0200] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux68.preset: 'default'
[2024-05-09T21:41:50+0200] [ALPM-SCRIPTLET] ==> Using default configuration file: '/etc/mkinitcpio.conf'
[2024-05-09T21:41:53+0200] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux68.preset: 'fallback'
[2024-05-09T21:41:53+0200] [ALPM-SCRIPTLET] ==> Using default configuration file: '/etc/mkinitcpio.conf'
[2024-05-09T21:42:15+0200] [ALPM] running '90-mkinitcpio-install.hook'...
[2024-05-09T21:42:15+0200] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux66.preset: 'default'
[2024-05-09T21:42:15+0200] [ALPM-SCRIPTLET] ==> Using default configuration file: '/etc/mkinitcpio.conf'
[2024-05-09T21:42:18+0200] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux66.preset: 'fallback'
[2024-05-09T21:42:18+0200] [ALPM-SCRIPTLET] ==> Using default configuration file: '/etc/mkinitcpio.conf'

Your snippet is missing the lines of what was actually done.
Under each of those there should be the action(s) taken.

Weird the reinstall of mkinitcpio also take not the missing actions.
I saw manjaro.patch · master · Packages / Core / mkinitcpio · GitLab

gets updated for 39 so there is maybe something wrong?

How did you produce that text?
If you 'grep’d ‘mkinitcpio’ then the following lines would not necessarily show.

I did cat pacman.log | grep mkinitcpio

Which would not show any lines that dont explicitly contain mkinitcpio

Add something like -n5 for 5 lines around matching entries.
Or note the line numbers and search the original text.
etc.

6704:[2024-05-09T21:34:06+0200] [ALPM] upgraded mkinitcpio (39-1 -> 39-5)
6705:[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET] ==> Check if we should port MODULES to new array format in /etc/mkinitcpio.conf.
6706-[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET]   -> No string format found. No change.
6707:[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET] ==> Check if we should port BINARIES to new array format in /etc/mkinitcpio.conf.
6708-[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET]   -> No string format found. No change.
6709:[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET] ==> Check if we should port FILES to new array format in /etc/mkinitcpio.conf.
6710-[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET]   -> No string format found. No change.
6711:[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET] ==> Check if we should port HOOKS to new array format in /etc/mkinitcpio.conf.
6712-[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET]   -> No string format found. No change.
6713:[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET] ==> Check if we need to add "kms" to hooks in /etc/mkinitcpio.conf.
6714-[2024-05-09T21:34:07+0200] [ALPM-SCRIPTLET]   -> "kms" hook already exists. Doing nothing.

I noticed that kernel-alive is not installed by default on cinnamon

I think that caused the issue (not sure)

So whatever got your items malformed is apparently not those scriptlets.

They at least state that they did nothing.

Which makes sense as well - they are supposed to edit mkinitcpio.conf … not the ‘preset’ files.

What do you mean?
That you have kernel-alive installed and you think it did this?
That might be a good guess … as it would mess with those files.
I also would not suggest using it … I remember problems with it in the past.

The better alternative is kernel-modules-hook.

1 Like

Interesting, I just checked and I have kernel-alive installed, and no I didn’t install it, so I would assume most Manjaro users have it too (well, at least those of us that haven’t installed or reinstalled manjaro for many years)? Are you suggesting we should switch to kernel-modules-hook?

If it were my system I would, yes.

I guess I will go looking at the iso profiles to see if/where kernel-alive might be in them.

During or after the switch you may want to keep an eye on the locations mentioned above and some other like /lib/modules (I find some users have tons of old directories here, maybe also related?)

EDIT.
Looks like someone who handles the OEM/gaming/etc profiles thought it was a good idea. Because thats where it mostly is, but also added to the kde and kde-dev and xfce profiles.

While someone appears to have gone through and removed it from the profiles at some point a few years ago.

So… it really depends what edition at what time. But new ISOs do not contain kernel-alive.

1 Like

Closed 3 days ago

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.

I am wondering what this means, as it seems to mean nothing?

It was closed automatically by the system at that time.
It is, as you see, no longer closed.
I also deleted the note so it wont be seen anymore either.

We have to analyze what the issue here is …

So far things point to kernel-alive as the culprit.

It was once included with some ISOs, but is not any longer.

Nothing seems amiss with mkinitcpio (or the ‘array’ scriptlets).

There were changes made to the script:

diff -Npur 38/usr/share/libalpm/scripts/mkinitcpio 39/usr/share/libalpm/scripts/mkinitcpio
--- 38/usr/share/libalpm/scripts/mkinitcpio	2024-03-14 08:55:39.000000000 +0700
+++ 39/usr/share/libalpm/scripts/mkinitcpio	2024-05-09 23:47:56.000000000 +0700
@@ -6,7 +6,34 @@ set -e
 args=()
 package=0
 
-process_preset() {
+install_preset() {
+    local pkgbase="$1" preset="$2"
+
+    if [[ ! -e "$preset" ]]; then
+        if [[ -e "$preset.pacsave" ]]; then
+            # move the pacsave to the template
+            mv -- "${preset}.pacsave" "$preset"
+        else
+            # create the preset from the template
+            sed "s|%KERNELBASE%|${kernelbase}|g" /usr/share/mkinitcpio/hook.preset \
+                | install -Dm644 /dev/stdin "$preset"
+        fi
+    fi
+}
+
+generate_presets() {
+    local preset pkgbase pkgbase_path
+
+    # only make presets for kernels with a pkgbase
+    for pkgbase_path in /usr/lib/modules/*/pkgbase; do
+        if read -r pkgbase &>/dev/null <"$pkgbase_path"; then
+            preset="/etc/mkinitcpio.d/${pkgbase}.preset"
+            install_preset "$pkgbase" "$preset"
+        fi
+    done
+}
+
+remove_preset() {
     if [[ -n "$pkgbase" && -e "$preset" ]]; then
         if ! cmp "$preset" <(sed "s|%KERNELBASE%|${kernelbase}|g" /usr/share/mkinitcpio/hook.preset) &>/dev/null; then
             if [[ ! -e "$preset.pacsave" ]]; then
@@ -78,8 +105,8 @@ read_preset() {
         unsorted_filelist+=("/boot/vmlinuz-${pkgbase}"
             "/boot/initramfs-${pkgbase}.img"
             "/boot/initramfs-${pkgbase}-fallback.img"
-            "/efi/EFI/Linux/arch-${pkgbase}.efi"
-            "/efi/EFI/Linux/arch-${pkgbase}-fallback.efi")
+            "/efi/EFI/Linux/manjaro-${pkgbase}.efi"
+            "/efi/EFI/Linux/manjaro-${pkgbase}-fallback.efi")
         unsorted_kernellist+=("/boot/vmlinuz-${pkgbase}")
     fi
 
@@ -98,17 +125,7 @@ install_kernel() {
     local pkgbase="$1"
     local kernel preset="/etc/mkinitcpio.d/${pkgbase}.preset"
 
-    if [[ ! -e "$preset" ]]; then
-        if [[ -e "$preset.pacsave" ]]; then
-            # move the pacsave to the template
-            mv -- "${preset}.pacsave" "$preset"
-        else
-            # create the preset from the template
-            sed "s|%KERNELBASE%|${kernelbase}|g" /usr/share/mkinitcpio/hook.preset \
-                | install -Dm644 /dev/stdin "$preset"
-        fi
-    fi
-
+    install_preset "$pkgbase" "$preset"
     (
         # source the preset to get the kernel and image locations
         # shellcheck disable=SC1090
@@ -145,10 +162,17 @@ remove_kernel() {
         rm -f -- "${filelist[@]}"
     ) || return
     # remove the preset
-    process_preset "$pkgbase" "$preset"
+    remove_preset "$pkgbase" "$preset"
 }
 
 while read -r line; do
+    if [[ "${line%%-git}" == "mkinitcpio" && "$1" == "install" ]]; then
+        # generate presets for each kernel on package install
+        generate_presets
+        package=1
+        continue
+    fi
+
     if [[ "$line" != */vmlinuz ]]; then
         # triggers when it's a change to usr/lib/initcpio/*
         package=1
@@ -182,7 +206,7 @@ if (( package )) && compgen -G /etc/mkin
             for preset in /etc/mkinitcpio.d/*.preset; do
                 pkgbase=${preset##*/}
                 pkgbase=${pkgbase%.preset}
-                process_preset "$pkgbase" "$preset"
+                remove_preset "$pkgbase" "$preset"
             done
             shopt -u nullglob
             ;;

most likely pacsaves get now autoconverted. kernel-alive we have to see … The full change is here: mkinitcpio changes ($1012) · Snippets · GitLab At first glance I also don’t see issues with it.

1 Like