You are not logged in.

#1 2023-11-28 15:54:34

heistp
Member
Registered: 2023-11-28
Posts: 4

[SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

After upgrading mkinitcpio from version 36 to 37, it exits with an error code and warning at the end, but afaict, creates the img file correctly.

I execute it as follows, and get this output from 37:

# mkinitcpio -k 6.6.0-sce+ -g /boot/initramfs-6.6.0-sce+.img
==> Starting build: '6.6.0-sce+'
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [kms]
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: '/boot/initramfs-6.6.0-sce+.img'
==> WARNING: errors were encountered during the build. The image may not be complete.

When I execute 36, everything is the same, except it exits successfully and the WARNING line is replaced with:

==> Image generation successful

So, I ran both versions with the -v (verbose) flag. There's a lot of output, but here is a diff from 36 to 37:

225c225
<     caching 6 modules
---
>     caching 14 modules
736a737
>     overwriting file: /usr/bin/setfont
781c782
< ==> Image generation successful
---
> ==> WARNING: errors were encountered during the build. The image may not be complete.

So far, I don't see what's going wrong with 37. Any ideas?

Last edited by heistp (2023-11-29 08:39:02)

Offline

#2 2023-11-28 16:11:34

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

Where did you get that kernel version? Does mkinitcpio exit without error for the kernels from the repository?

Offline

#3 2023-11-28 16:25:17

seth
Member
Registered: 2012-09-03
Posts: 51,617

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

Edit /usr/bin/mkinitcpio, add

set -exo pipefail

re-run it and hope for it to stop at some silent error return that would end up raising _builderrors

Offline

#4 2023-11-28 19:12:53

heistp
Member
Registered: 2023-11-28
Posts: 4

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

seth wrote:

Edit /usr/bin/mkinitcpio, add

set -exo pipefail

re-run it and hope for it to stop at some silent error return that would end up raising _builderrors

That helps, as I found out that the kms module in /usr/lib/initcpio/install/kms is failing because it calls add_checked_modules_from_symbol, which can't find any modules in /lib/modules/6.6.0-sce+/kernel/drivers/platform. That directory doesn't even exist.

This is a custom kernel with a fairly minimal build config, not an official Arch kernel. That said, I don't think this should fail, so I'll file a bug for mkinitcpio, or see if this has been dealt with already.

Thanks...

Offline

#5 2023-11-28 19:50:21

heistp
Member
Registered: 2023-11-28
Posts: 4

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

The bug was already reported here, but I think the fix needs to return 0 at line 1165.

I can't seem to register for a GitLab account using the Register link though, otherwise I'd report it. It just says "An error occurred while validating username" no matter what I enter. I'll try that again later, but I think the original issue is solved for now.

Offline

#6 2023-11-28 21:14:01

seth
Member
Registered: 2012-09-03
Posts: 51,617

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

You'll have to apply by mail for a login because apparently the gitlab scratchpad is worth the hassle…

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

#7 2023-11-29 09:48:28

heistp
Member
Registered: 2023-11-28
Posts: 4

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

For completeness, here is a patch for /usr/lib/initcpio/functions that solves the problem for me:

--- functions	2023-11-29 10:42:11.110671847 +0100
+++ functions-add-checked-fix	2023-11-29 10:41:48.834146000 +0100
@@ -1162,7 +1162,7 @@
     local -a mods
 
     mapfile -t mods < <(find_module_from_symbol "$@")
-    (( ${#mods[@]} )) || return 1
+    (( ! ${#mods[@]} )) && return 0
 
     # _autodetect_cache is declared in mkinitcpio and assigned in install/autodetect
     # shellcheck disable=SC2154

The quirky syntax is because a bash trap is used to check the return code, so

 (( ${#mods[@]} )) || return 0

would be identified incorrectly as returning 1.

Once I get an account I'll see if the devs agree to this fix.

Offline

#8 2023-12-11 18:26:00

dtcooper
Member
Registered: 2023-12-11
Posts: 2

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

heistp wrote:

For completeness, here is a patch for /usr/lib/initcpio/functions that solves the problem for me:

--- functions	2023-11-29 10:42:11.110671847 +0100
+++ functions-add-checked-fix	2023-11-29 10:41:48.834146000 +0100
@@ -1162,7 +1162,7 @@
     local -a mods
 
     mapfile -t mods < <(find_module_from_symbol "$@")
-    (( ${#mods[@]} )) || return 1
+    (( ! ${#mods[@]} )) && return 0
 
     # _autodetect_cache is declared in mkinitcpio and assigned in install/autodetect
     # shellcheck disable=SC2154

The quirky syntax is because a bash trap is used to check the return code, so

 (( ${#mods[@]} )) || return 0

would be identified incorrectly as returning 1.

Once I get an account I'll see if the devs agree to this fix.

This fixes the same problem I was having using mkinitcpio with the Liquorix kernel (linux-lqx) installed from https://liquorix.net/archlinux/$repo/$arch

Offline

#9 2024-01-16 15:01:39

dtcooper
Member
Registered: 2023-12-11
Posts: 2

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

Appears to be fixed in version 37.2

Offline

#10 2024-01-16 16:23:16

mpausch
Member
Registered: 2009-01-02
Posts: 24

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

dtcooper wrote:

Appears to be fixed in version 37.2

can't confirm

[root@myrpi ~]# mkinitcpio --version
mkinitcpio "37.2"

[root@myrpi ~]# mkinitcpio -p linux-rpi
==> Building image from preset: /etc/mkinitcpio.d/linux-rpi.preset: 'default'
==> Using configuration file: '/etc/mkinitcpio.conf'
  -> -k 6.6.11-2-rpi -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: '6.6.11-2-rpi'
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [kms]
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: '/boot/initramfs-linux.img'
==> WARNING: errors were encountered during the build. The image may not be complete.

Offline

#11 2024-01-22 19:31:04

MikeDee
Member
Registered: 2019-12-19
Posts: 13

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

dtcooper wrote:

Appears to be fixed in version 37.2

Not fixed for me with the xanmod v3 kernel and version 37.3-1 of mkinitcpio.

Offline

#12 2024-01-23 09:58:57

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 599

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

MikeDee wrote:

Not fixed for me with the xanmod v3 kernel and version 37.3-1 of mkinitcpio.

Perhaps that kernel is missing some modules.

Post the output of:

$ find "/usr/lib/modules/$(uname -r)/kernel/drivers/platform/" -name '*.ko.zst' -exec zstdgrep -El '^(drm_privacy_screen_register)' '{}' ';'

With the "linux" kernel, it returns chromeos_privacy_screen.ko.zst and thinkpad_acpi.ko.zst.

Offline

#13 2024-02-02 16:21:43

MikeDee
Member
Registered: 2019-12-19
Posts: 13

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

nl6720 wrote:
MikeDee wrote:

Not fixed for me with the xanmod v3 kernel and version 37.3-1 of mkinitcpio.

Perhaps that kernel is missing some modules.

Post the output of:

$ find "/usr/lib/modules/$(uname -r)/kernel/drivers/platform/" -name '*.ko.zst' -exec zstdgrep -El '^(drm_privacy_screen_register)' '{}' ';'

With the "linux" kernel, it returns chromeos_privacy_screen.ko.zst and thinkpad_acpi.ko.zst.

There is no output (i.e., nothing is returned).

Offline

#14 2024-02-04 13:52:40

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 599

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

Then your kernel is built without CONFIG_THINKPAD_ACPI=m and CONFIG_CHROMEOS_PRIVACY_SCREEN=m. The failure is expected in this case.

Offline

#15 2024-02-04 16:59:56

MikeDee
Member
Registered: 2019-12-19
Posts: 13

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

nl6720 wrote:

Then your kernel is built without CONFIG_THINKPAD_ACPI=m and CONFIG_CHROMEOS_PRIVACY_SCREEN=m. The failure is expected in this case.

OK, so how do I install those (probably unneeded) kernel modules? Do you know that with the addition of these modules, that mkinitcpio will work without the warning? If so, that seems to contradict the cause is a buggy script (see above)...

Last edited by MikeDee (2024-02-04 18:23:27)

Offline

#16 2024-02-04 18:53:34

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,765

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

By adjusting the kernel config and ammending those parameters.

The "error" happens because you're missing files that would be necessary to fulfill the kms/amdgpu contract. If you're not actively using those the simplest would be to just ignore the error as a false positive for yourself

Last edited by V1del (2024-02-04 18:54:53)

Offline

#17 2024-02-04 22:01:56

MikeDee
Member
Registered: 2019-12-19
Posts: 13

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

Actually, the two modules (chromeos_privacy_screen.ko.zst and thinkpad_acpi.ko.zst) exist in the equivalent xanmod folders. They are uncompressed (all of them are) which is why the find command in post #12 couldn't find them (it looks for files ending in "ko.zst" instead of ".ko").

The patch in post #7 above worked to eliminate the warning.

Last edited by MikeDee (2024-02-08 21:48:13)

Offline

#18 2024-02-23 13:42:56

verge36
Member
Registered: 2021-03-01
Posts: 2

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

Can confirm the patch in post #7 fixes the issue for me as well, on linux-xanmod.

Offline

#19 2024-02-28 11:41:27

shelter
Member
Registered: 2024-02-28
Posts: 2

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

Finally a solution! The above patch solved the mkinitcpio warning/error with my selfcompiled kernels.
Unless it breaks something else, this fix should really be merged into mkinitcpio.

Offline

#20 2024-02-28 11:50:00

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 599

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

heistp wrote:
--- functions	2023-11-29 10:42:11.110671847 +0100
+++ functions-add-checked-fix	2023-11-29 10:41:48.834146000 +0100
@@ -1162,7 +1162,7 @@
     local -a mods
 
     mapfile -t mods < <(find_module_from_symbol "$@")
-    (( ${#mods[@]} )) || return 1
+    (( ! ${#mods[@]} )) && return 0
 
     # _autodetect_cache is declared in mkinitcpio and assigned in install/autodetect
     # shellcheck disable=SC2154

It's not a fix. If no module with the searched symbol can be found, then the function should return 1 (i.e. failure).
The question that needs answering to create a proper fix is, what makes find_module_from_symbol fail if the chromeos_privacy_screen and/or thinkpad_acpi modules do exist?

Offline

#21 2024-02-28 16:08:23

seth
Member
Registered: 2012-09-03
Posts: 51,617

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

https://gitlab.archlinux.org/archlinux/ … ions#L1165

+     set -x
        while read -r -d '' mod; do
            if decomp_to_stdout "$mod" | grep -Eq "^($symbols)" &> /dev/null; then
                mod=${mod##*/}
                mod="${mod%.ko*}"
                printf '%s\n' "${mod//-/_}"
            fi
        done < <(LC_ALL=C.UTF-8 find "$moduledir" -name '*.ko*' -print0 2>/dev/null)
+     set +x

should tell?

Offline

#22 2024-03-04 19:34:41

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 27
Website

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

Nope, the patch worked for mkinitcpio-37, but -38 broke everything again sad

Offline

#23 2024-03-04 21:39:49

seth
Member
Registered: 2012-09-03
Posts: 51,617

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

Could you trace the script like in #21 ?

Offline

#24 2024-03-05 21:36:02

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 27
Website

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

seth wrote:

Could you trace the script like in #21 ?

Well I'm not at all sure I did how I was supposed to do, but I got no output.
(linux-xanmod-lts-6.6.19, mkinitcpio-38-4)

Offline

#25 2024-03-05 21:46:49

seth
Member
Registered: 2012-09-03
Posts: 51,617

Re: [SOLVED] mkinitcpio exits with code 1 after upgrade from 36 to 37

Empty loop?
Try to wrap the entire function

find_module_from_symbol() {
set -x
…
set +x
}

Offline

Board footer

Powered by FluxBB