Bug 1171180 - get_kernel_version fails to handle zImage on armv7
get_kernel_version fails to handle zImage on armv7
Status: CONFIRMED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Basesystem
Current
armv7 Other
: P5 - None : Normal (vote)
: ---
Assigned To: Guillaume GARDET
E-mail List
:
Depends on: 1162581
Blocks:
  Show dependency treegraph
 
Reported: 2020-05-05 12:17 UTC by Andreas Schwab
Modified: 2022-03-09 00:03 UTC (History)
6 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schwab 2020-05-05 12:17:04 UTC
# get_kernel_version /boot/zImage-5.6.8-1-default ; echo $?
1
# get_kernel_version /boot/vmlinux-5.6.8-1-default.xz ; echo $?
1
# mkinitrd
No kernel found in /boot or bad modules dir in /lib/modules
Comment 1 Guillaume GARDET 2020-05-05 13:06:56 UTC
@Andreas, could you try with this pending update: https://build.opensuse.org/request/show/794073
Comment 2 Andreas Schwab 2020-05-05 13:29:22 UTC
# get_kernel_version /boot/zImage-5.6.8-1-default ; echo $?
1
panda:~/:[0]# get_kernel_version /boot/vmlinux-5.6.8-1-default.xz ; echo $?
5.6.8-1-default
0
panda:~/:[0]# mkinitrd
No kernel found in /boot or bad modules dir in /lib/modules
Comment 3 Guillaume GARDET 2020-05-05 13:56:46 UTC
(In reply to Andreas Schwab from comment #2)
> # get_kernel_version /boot/zImage-5.6.8-1-default ; echo $?
> 1
> panda:~/:[0]# get_kernel_version /boot/vmlinux-5.6.8-1-default.xz ; echo $?
> 5.6.8-1-default
> 0

Partially fixed then.

> panda:~/:[0]# mkinitrd
> No kernel found in /boot or bad modules dir in /lib/modules

Any reason you do not use 'dracut' instead of mkinitrd?
Could you try 'dracut' instead, please?
Comment 4 Andreas Schwab 2020-05-05 14:26:10 UTC
Because that's what everyone is using.
Comment 5 Guillaume GARDET 2020-05-05 14:34:15 UTC
(In reply to Andreas Schwab from comment #4)
> Because that's what everyone is using.

mkinitrd is just a wrapper around dracut.

On kernel update, dracut is used nowadays.

@Andreas, could you confirm that dracut is working properly, please?
Comment 6 Andreas Schwab 2020-05-05 14:42:07 UTC
# /usr/lib/module-init-tools/regenerate-initrd-posttrans
No kernel found in /boot or bad modules dir in /lib/modules
Comment 7 Fabian Vogt 2020-07-31 14:02:15 UTC
I see this issue as well.

As written in comment 6, mkinitrd is still used to regenerate the initrd on package updates.
Comment 8 Fabian Vogt 2020-07-31 14:05:47 UTC
For $(uname -m) ~= "arm*", mkinitrd only looks at /boot/[uz]Image-* and generates s/[uz]Image/initrd/ files. So AFAICT get_kernel_version has to be fixed for zImage as well.
Comment 9 Guillaume GARDET 2021-01-20 14:32:07 UTC
The following diff make mkinitrd to run properly on armv7:
**********
--- /sbin/mkinitrd      2021-01-20 14:29:44.886464086 +0000
+++ mkinitrd-suse.sh    2021-01-20 14:28:30.041163391 +0000
@@ -199,7 +199,6 @@ default_kernel_images() {
 
         kernel_version=$(kernel_version_from_image \
                          $boot_dir/$kernel_image 2> /dev/null)
-       [ -z $kernel_version ] && kernel_version=${kernel_image#zImage-}
         initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
         if [ "$kernel_image" != "$initrd_image" -a \
              -n "$kernel_version" -a \
**********

Not sure how upstreamable it is, though.
Comment 10 Dirk Mueller 2021-06-10 09:57:03 UTC
I guess that patch is reversed, right?

the other option is to fix our kernel image name to no longer be called zImage, but instead similar to all other distributions inherit the x86 name. 

this might be not so difficult to pull off, and it fixes dracut and all other occurences where we need to fix stuff (I remember other unfixed cases in virtualization and containerization area). I would prefer that over finding more places to hack.
Comment 11 Guillaume GARDET 2021-06-11 08:39:37 UTC
(In reply to Dirk Mueller from comment #10)
> I guess that patch is reversed, right?

Yes.

> 
> the other option is to fix our kernel image name to no longer be called
> zImage, but instead similar to all other distributions inherit the x86 name. 

Last time I checked, other distributions used zImage as well.

> this might be not so difficult to pull off, and it fixes dracut and all
> other occurences where we need to fix stuff (I remember other unfixed cases
> in virtualization and containerization area). I would prefer that over
> finding more places to hack.

Dracut should be fine. 
With such a change, we likely need to fix stuff in working things.
Comment 12 Michal Suchanek 2021-06-11 08:48:26 UTC
mkinitrd is no longer a thing.

Is this a problem with dracut?
Comment 13 Andreas Schwab 2021-06-14 12:35:21 UTC
See #c6.
Comment 14 Michal Suchanek 2021-06-14 13:58:31 UTC
Why does it not work?

The code seems to match zImage:

default_kernel_images() {
    local regex kernel_image kernel_version version_version initrd_image
    local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'

    case "${DRACUT_ARCH:-$(uname -m)}" in
        s390|s390x)
            regex='image'
            ;;
        ppc|ppc64)
            regex='vmlinux'
            ;;
        i?86|x86_64)
            regex='vmlinuz'
            ;;
        arm*)
            regex='[uz]Image'
            ;;
        aarch64|riscv64)
            regex='Image'
            ;;
        *)  regex='vmlinu.'
            ;;
    esac
Comment 15 openQA Review 2021-06-29 05:12:43 UTC
This is an autogenerated message for openQA integration by the openqa_review script:

This bug is still referenced in a failing openQA test: create_hdd_minimalx
https://openqa.opensuse.org/tests/1808868

To prevent further reminder comments one of the following options should be followed:
1. The test scenario is fixed by applying the bug fix to the tested product or the test is adjusted
2. The openQA job group is moved to "Released" or "EOL" (End-of-Life)
3. The label in the openQA scenario is removed
Comment 16 openQA Review 2021-07-14 00:22:17 UTC
This is an autogenerated message for openQA integration by the openqa_review script:

This bug is still referenced in a failing openQA test: create_hdd_minimalx
https://openqa.opensuse.org/tests/1838553

To prevent further reminder comments one of the following options should be followed:
1. The test scenario is fixed by applying the bug fix to the tested product or the test is adjusted
2. The openQA job group is moved to "Released" or "EOL" (End-of-Life)
3. The label in the openQA scenario is removed
Comment 17 openQA Review 2021-07-29 01:26:09 UTC
This is an autogenerated message for openQA integration by the openqa_review script:

This bug is still referenced in a failing openQA test: create_hdd_minimalx
https://openqa.opensuse.org/tests/1858645

To prevent further reminder comments one of the following options should be followed:
1. The test scenario is fixed by applying the bug fix to the tested product or the test is adjusted
2. The openQA job group is moved to "Released" or "EOL" (End-of-Life)
3. The label in the openQA scenario is removed
Comment 18 openQA Review 2021-08-17 23:58:45 UTC
This is an autogenerated message for openQA integration by the openqa_review script:

This bug is still referenced in a failing openQA test: create_hdd_minimalx
https://openqa.opensuse.org/tests/1876432

To prevent further reminder comments one of the following options should be followed:
1. The test scenario is fixed by applying the bug fix to the tested product or the test is adjusted
2. The openQA job group is moved to "Released" or "EOL" (End-of-Life)
3. The label in the openQA scenario is removed
Comment 19 openQA Review 2021-08-31 23:59:08 UTC
This is an autogenerated message for openQA integration by the openqa_review script:

This bug is still referenced in a failing openQA test: extra_tests_in_textmode
https://openqa.opensuse.org/tests/1892144

To prevent further reminder comments one of the following options should be followed:
1. The test scenario is fixed by applying the bug fix to the tested product or the test is adjusted
2. The openQA job group is moved to "Released" or "EOL" (End-of-Life)
3. The label in the openQA scenario is removed
Comment 20 openQA Review 2021-09-14 23:59:37 UTC
This is an autogenerated message for openQA integration by the openqa_review script:

This bug is still referenced in a failing openQA test: extra_tests_in_textmode
https://openqa.opensuse.org/tests/1913292

To prevent further reminder comments one of the following options should be followed:
1. The test scenario is fixed by applying the bug fix to the tested product or the test is adjusted
2. The openQA job group is moved to "Released" or "EOL" (End-of-Life)
3. The bugref in the openQA scenario is removed or replaced, e.g. `label:wontfix:boo1234`
Comment 21 openQA Review 2022-03-09 00:03:49 UTC
This is an autogenerated message for openQA integration by the openqa_review script:

This bug is still referenced in a failing openQA test: extra_tests_in_textmode
https://openqa.opensuse.org/tests/2234218

To prevent further reminder comments one of the following options should be followed:
1. The test scenario is fixed by applying the bug fix to the tested product or the test is adjusted
2. The openQA job group is moved to "Released" or "EOL" (End-of-Life)
3. The bugref in the openQA scenario is removed or replaced, e.g. `label:wontfix:boo1234`

Expect the next reminder at the earliest in 56 days if nothing changes in this ticket.