[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#794403: flash-kernel: command "update-initramfs -uk <kver>" result in boot images in false version



On Mon, 2015-08-03 at 01:27 +0900, Roger Shimizu wrote:
> Package: flash-kernel
> Version: 3.45
> Severity: normal
> Tags: patch
> 
> Dear Maintainer,
> 
> Hook script "initramfs-hook/flash-kernel" will be called when update-initramfs
> is invoked. However flash-kernel only build the latest kernel version it find,
> rather than the specific version passing from update-initramfs.
> 
> For example, after running "update-initramfs -uk ", the  is
> successfully passed to "initramfs-hook/flash-kernel", and then "flash-kernel"
> script, but "flash-kernel" script simply ignore that version, except adding
> a "--force" flag, which is why this patch is here.

The "update-initramfs -uk <kver>" command is intended to update the
initramfs for <kver>, it is not intended to mean "and boot <kver> next
time", that is not update-initramfs's job (on other platforms it does
not e.g. call grub-set-default or grub-reboot either).

flash-kernel normally always tries to keep the latest kernel installed.
It offers a command line override for this, but this is not expected to
be used by automatic callers. Really this capability is more for
debugging (by booting an older kernel once or twice) than anything
else. If you want to permanently boot <kver> then at the moment you
have to arrange that <kver> is the newest installed kernel.

I think your patch will break things by automatically installing (via
the initramfs hook in the kernel postinst) whatever kernel was most
recently installed/upgraded, instead of the latest kernel by version.
We do not want this: consider people who still have stable+testing in
their sources.list and the stable+testing kernel's both installed, they
are expecting to use the testing kernel and do not want to get a
surprise stable kernel installed whenever a DSA is issued against the
Linux package in stable.

> I also checked the log for initramfs-hook/flash-kernel, as commit 7bacb9 the
> kernel version was actually not passed to "flash-kernel" script, but from
> commit e05fc9, this has been changed, which I think it means the flash-kernel
> script need to honor what kernel version update-initramfs is working on.

I'm afraid not, when called from the initramfs-hook flash-kernel should
arrange for the update only if operating on the newest kernel.

An acceptable alternative to your patch might be to add support for a
new option in /etc/default/flash-kernel e.g. LINUX_KERNEL_VERSION which
names an explicit version which is the one which should should always
be installed in flash (unless overridden on the command line). Care
would need to be taken that the kernel exists and to do the right thing
if it is is removed.

I think a suitable algorithm for determining the version would be to
consider in order:

     1. The version on the command line, if any. If one is given but
        doesn't exist then error out.
     2. The version from /etc/default/flash
        -kernel:$LINUX_KERNEL_VERSION, if it doesn't exist then fall
        through to next option(*) with a big fat warning printed.
     3. The currently installed version with the greatest version
        number.

The fall through from option 2 to option 3 is important, otherwise a
kernel removal/upgrade/install (which invokes flash-kernel) may find
itself unable to complete if the desired kernel is missing and abort
the whole operation, which will be potentially tricky to recover from
since it will block further apt/dpkg operations until it is sorted out.
Installing the latest kernel if the preferred option is not available
seems better than failing in this case.

People who then want to boot an older kernel could set
LINUX_KERNEL_VERSION and call flash-kernel to make it take effect.

Ian.

> 
> Thanks and looking forward to your comments.
> 
> Cheers,
> Roger
> 
> -- System Information:
> Debian Release: 8.1
>   APT prefers stable
>   APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 
> 'unstable'), (1, 'experimental')
> Architecture: armel (armv5tel)
> 
> Kernel: Linux 4.0.0-2-kirkwood
> Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: sysvinit (via /sbin/init)
> 
> Versions of packages flash-kernel depends on:
> ii  debconf [debconf-2.0]  1.5.56
> ii  devio                  1.2-1+b1
> ii  initramfs-tools        0.120
> ii  linux-base             3.5
> ii  ucf                    3.0030
> 
> Versions of packages flash-kernel recommends:
> ii  u-boot-tools  2014.10+dfsg1-5
> 
> flash-kernel suggests no packages.


Reply to: