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

Bug#908001: Removal of currently running kernel is prevented by "Failed to substitute package name in title: ..."



Package: linux-base
Version: 4.5
Severity: normal

Dear Maintainer,

I recently encountered the following situation while trying to remove the
package of a currently running kernel:

root@router-foo:~# apt purge linux-image-4.9.0-6-amd64
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.9.0-6-amd64*
0 upgraded, 0 newly installed, 1 to remove and 24 not upgraded.
After this operation, 193 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 50646 files and directories currently installed.)
Removing linux-image-4.9.0-6-amd64 (4.9.88-1+deb9u1) ...
Failed to substitute package name in title: 10 at /usr/bin/linux-check-removal
line 102, <STDIN> line 1. dpkg: error processing package
linux-image-4.9.0-6-amd64 (--remove): subprocess installed pre-removal script
returned error exit status 255 Errors were encountered while processing:
 linux-image-4.9.0-6-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

Instead of the above error message I expected a dialog asking for
confirmation of the removal of the currently running kernel.

The same happens reproducible for many hosts (all sharing the same
setup).

Minimal test:
 /usr/share/debconf/frontend /usr/bin/linux-check-removal "$(uname -r)"

In case of success, the above command leads to a dialog asking for
confirmation for removing the currently running kernel.
In case of failure, the following error is emitted (resulting in an
exitcode 255):
 Failed to substitute package name in title: 10 at /usr/bin/linux-check-removal
line 102, <STDIN> line 1.

The problem can be fixed by executing
/var/lib/dpkg/info/linux-base.postinst.
This results (among others) in the following new section in
/var/cache/debconf/config.dat:

Name: linux-base/removing-running-kernel
Template: linux-base/removing-running-kernel
Value: true
Owners: linux-base
Flags: seen
Variables:
 running = 4.9.0-6-amd64

The problem returns, if the above section is removed from that file.

Thus it looks like the script "linux-check-removal" does not handle a
situation where the above debconf data is missing. This probably
involves very specific circumstances, since the linux-base is widely
used and seems to work well for most users.

The only specific detail of the problematic environment is probably the
fact, that /var/cache is stored on a tmpfs and thus is regularly
discarded on every reboot.

Cheers,
Lars

-- System Information:
Debian Release: 9.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-6-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8),
LANGUAGE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages linux-base depends on:
ii  debconf [debconf-2.0]  1.5.61

linux-base recommends no packages.

linux-base suggests no packages.

-- debconf information:
  linux-base/removing-title:
* linux-base/removing-running-kernel: true


Reply to: