** Description changed:

  [Impact]
  Systems that use flash-kernel may end up installing the wrong kernel image.
  
  `linux-version sort` can provide different answers depending on how it
  is called (see Test Case). The stdin behavior appears to be a bug, and
  this is the mode flash-kernel uses. So, for example, a user with an
  arm64 u-boot system might end up booting 5.8.0-50-generic-64k instead of
  the expected 5.8.0-50-generic 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 old HP m400 platform which 
is the only Ubuntu certified u-boot-based arm64 server, and is long out of 
support.
+ 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.

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux-base in Ubuntu.
https://bugs.launchpad.net/bugs/1926985

Title:
  linux-version sort: argv and stdin behaviors differ

Status in linux-base package in Ubuntu:
  Fix Released
Status in linux-base source package in Bionic:
  In Progress
Status in linux-base source package in Focal:
  In Progress
Status in linux-base source package in Groovy:
  In Progress
Status in linux-base source package in Hirsute:
  In Progress
Status in linux-base source package in Impish:
  Fix Released
Status in linux-base package in Debian:
  New

Bug description:
  [Impact]
  Systems that use flash-kernel may end up installing the wrong kernel image.

  `linux-version sort` can provide different answers depending on how it
  is called (see Test Case). The stdin behavior appears to be a bug, and
  this is the mode flash-kernel uses. So, for example, a user with an
  arm64 u-boot system might end up booting 5.8.0-50-generic-64k instead
  of the expected 5.8.0-50-generic 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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-base/+bug/1926985/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to