linux-version sort: argv and stdin behaviors differ

Bug #1926985 reported by dann frazier
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-base (Debian)
Fix Released
Unknown
linux-base (Ubuntu)
Fix Released
Undecided
dann frazier
Bionic
Fix Released
Undecided
dann frazier
Focal
Fix Released
Undecided
dann frazier
Groovy
Won't Fix
Undecided
dann frazier
Hirsute
Fix Released
Undecided
dann frazier
Impish
Fix Released
Undecided
dann frazier

Bug Description

[Impact]
`linux-version sort` provides 2 ways to sort kernel version strings: users can provide these strings either via the command line or via stdin. Currently these methods give different answers for certain version strings (see Test Case). The stdin behavior is decidedly incorrect, and this is the mode flash-kernel uses. As a real world example, a user with an arm64 u-boot system might end up booting 5.8.0-50-generic instead of the expected 5.8.0-50-generic-64k if both are installed. There maybe additional issues caused by this; for example, I found this with our automation that tests kernels on various arm64 platforms in version increasing order. Only after consulting logs did we realize that 64k kernels were not ever getting booted because the tooling (which uses argv mode) disagreed with the kernel installer (flash-kernel using stdin mode) about which kernel should be the default.

It's possible this internal discrepancy can cause other issues due to tools disagreeing about which kernel is the latest, but the flash-kernel example is the only one I'm aware of at this point.

[Test Case]
Using argv:
$ linux-version sort 5.8.0-50-generic 5.8.0-50-generic-64k
5.8.0-50-generic
5.8.0-50-generic-64k

Using stdin (incorrect):
$ cat versions.txt
5.8.0-50-generic
5.8.0-50-generic-64k
$ cat versions.txt | linux-version sort
5.8.0-50-generic-64k
5.8.0-50-generic

[Where Problems Could Occur]
An obvious place where problems could occur is if someone is relying on rebooting into the kernel that is incorrectly being sorted greatest. For those using only Ubuntu kernel packages, the only case I'm aware of is arm64 generic vs. generic-64k case used in the examples above. The generic-64k flavor is available in >= 20.10, as well as 20.04-hwe. ARM server users - those most likely to want the generic-64k flavor - are very unlikely to be using flash-kernel. The standard for ARM servers is UEFI firmware, which use GRUB and are unaffected by this change. We found this on an HP m400 platform which is the only Ubuntu certified u-boot-based arm64 server.

Changed in linux-base (Debian):
status: Unknown → New
dann frazier (dannf)
Changed in linux-base (Ubuntu):
status: New → In Progress
assignee: nobody → dann frazier (dannf)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-base - 4.5ubuntu6

---------------
linux-base (4.5ubuntu6) impish; urgency=medium

  * linux-version: Fix sorting of versions provided via stdin to match
    the output when provided via argv (LP: #1926985).

 -- dann frazier <email address hidden> Mon, 03 May 2021 10:16:43 -0600

Changed in linux-base (Ubuntu):
status: In Progress → Fix Released
dann frazier (dannf)
Changed in linux-base (Ubuntu Hirsute):
assignee: nobody → dann frazier (dannf)
Changed in linux-base (Ubuntu Focal):
assignee: nobody → dann frazier (dannf)
Changed in linux-base (Ubuntu Groovy):
assignee: nobody → dann frazier (dannf)
Changed in linux-base (Ubuntu Bionic):
assignee: nobody → dann frazier (dannf)
dann frazier (dannf)
Changed in linux-base (Ubuntu Hirsute):
status: New → In Progress
Changed in linux-base (Ubuntu Groovy):
status: New → In Progress
Changed in linux-base (Ubuntu Focal):
status: New → In Progress
Changed in linux-base (Ubuntu Bionic):
status: New → In Progress
dann frazier (dannf)
description: updated
dann frazier (dannf)
description: updated
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello dann, or anyone else affected,

Accepted linux-base into hirsute-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/linux-base/4.5ubuntu5.4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-hirsute to verification-done-hirsute. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-hirsute. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in linux-base (Ubuntu Hirsute):
status: In Progress → Fix Committed
Changed in linux-base (Ubuntu Groovy):
status: In Progress → Fix Committed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello dann, or anyone else affected,

Accepted linux-base into groovy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/linux-base/4.5ubuntu4.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-groovy to verification-done-groovy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-groovy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in linux-base (Ubuntu Focal):
status: In Progress → Fix Committed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello dann, or anyone else affected,

Accepted linux-base into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/linux-base/4.5ubuntu3.7 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in linux-base (Ubuntu Bionic):
status: In Progress → Fix Committed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello dann, or anyone else affected,

Accepted linux-base into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/linux-base/4.5ubuntu1.7 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
dann frazier (dannf) wrote :

= Verification =
$ cat versions.txt
5.8.0-50-generic
5.8.0-50-generic-64k

$ for dist in hirsute groovy focal bionic; do
  lxc exec dannf-lp1926985-${dist} -- dpkg-query --showformat='${Version}\n' --show linux-base; lxc exec dannf-lp1926985-${dist} -- linux-version sort < versions.txt; done

4.5ubuntu5.4
5.8.0-50-generic
5.8.0-50-generic-64k
4.5ubuntu4.1
5.8.0-50-generic
5.8.0-50-generic-64k
4.5ubuntu3.7
5.8.0-50-generic
5.8.0-50-generic-64k
4.5ubuntu1.7
5.8.0-50-generic
5.8.0-50-generic-64k

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (linux-base/4.5ubuntu5.4)

All autopkgtests for the newly accepted linux-base (4.5ubuntu5.4) for hirsute have finished running.
The following regressions have been reported in tests triggered by the package:

initramfs-tools/0.139ubuntu3 (amd64, arm64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/hirsute/update_excuses.html#linux-base

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (linux-base/4.5ubuntu3.7)

All autopkgtests for the newly accepted linux-base (4.5ubuntu3.7) for focal have finished running.
The following regressions have been reported in tests triggered by the package:

linux-oem-5.6/5.6.0-1057.61 (amd64)
linux-hwe-5.11/5.11.0-24.25~20.04.1 (armhf)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/focal/update_excuses.html#linux-base

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
dann frazier (dannf) wrote :

The above test failures all seemed to pass upon re-run.

dann frazier (dannf)
tags: added: verification-done verification-done-bionic verification-done-focal verification-done-hirsute
Changed in linux-base (Ubuntu Groovy):
status: Fix Committed → Won't Fix
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-base - 4.5ubuntu5.4

---------------
linux-base (4.5ubuntu5.4) hirsute; urgency=medium

  * linux-version: Fix sorting of versions provided via stdin to match
    the output when provided via argv (LP: #1926985).

 -- dann frazier <email address hidden> Wed, 07 Jul 2021 14:13:01 -0600

Changed in linux-base (Ubuntu Hirsute):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for linux-base has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-base - 4.5ubuntu3.7

---------------
linux-base (4.5ubuntu3.7) focal; urgency=medium

  * linux-version: Fix sorting of versions provided via stdin to match
    the output when provided via argv (LP: #1926985).

 -- dann frazier <email address hidden> Wed, 07 Jul 2021 14:20:10 -0600

Changed in linux-base (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-base - 4.5ubuntu1.7

---------------
linux-base (4.5ubuntu1.7) bionic; urgency=medium

  * linux-version: Fix sorting of versions provided via stdin to match
    the output when provided via argv (LP: #1926985).

 -- dann frazier <email address hidden> Wed, 07 Jul 2021 14:34:55 -0600

Changed in linux-base (Ubuntu Bionic):
status: Fix Committed → Fix Released
Changed in linux-base (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.