Bug 32166 - Improve script for removal of old kernels
Improve script for removal of old kernels
Status: CLOSED FIXED
Product: Univention Corporate Client (UCC)
Classification: Unclassified
Component: General
unspecified
Other Linux
: P5 normal
: UCC 2.0
Assigned To: Felix Botner
Erik Damrose
: interim-1
: 31952 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-06 15:16 CEST by Daniel Fricke
Modified: 2014-06-12 09:20 CEST (History)
3 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Fricke univentionstaff 2013-08-06 15:16:51 CEST
There are some problems with the script  "/usr/share/univention-corporate-client/apt-get-pre-invoke.d/univention-ucc-prune-old-kernel-packages" . When the script is running to identified dpkg -p dependancy it is not recognize problems with old Kernels. The result is the old Kernals are marked as pi and persist on /boot.
Comment 1 Daniel Fricke univentionstaff 2013-09-03 10:47:26 CEST
The problem is reappeared. 

Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.5.0-27-generic
cryptsetup: WARNING: failed to detect canonical device of /dev/loop0
cryptsetup: WARNING: could not determine root device from /etc/fstab
cryptsetup: WARNING: invalid line in /etc/crypttab for crypt - 
mv: writing `/boot/initrd.img-3.5.0-27-generic': No space left on device
mv: failed to extend `/boot/initrd.img-3.5.0-27-generic': No space left on 
device
dpkg: error processing initramfs-tools (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
linux-image-3.2.0-52-generic-pae
linux-image-generic-pae
initramfs-tools




2013090321001495
Comment 2 Philipp Hahn univentionstaff 2013-09-04 10:33:12 CEST
The following "miracle of predicate logic" helps on UCS systems; it was successfully used in hundreds of ucs-tests runs in the Amazone clould.
Maybe a similar approach can help with UCC too:

cmd = """aptitude remove '
    ?installed
    ?name(linux-image-*)
    !?name(linux-image-'$(uname -r)')
    !?reverse-Depends(
        ?name(univention-kernel-image-*)
        ?version(TARGET)
    )'""".replace('\n', ' ')
rv = ssh_exec(cmd)

Translation to readable English: Remove all Linux Kernel images, which are neither the current running kernel nor the new default kernel selected by the univention-kernel-image packet.
Comment 3 Moritz Muehlenhoff univentionstaff 2013-09-10 10:38:23 CEST
The removal of old kernels generally works. One case where it could go wrong is if someone updates to a more recent kernel meta package. If the old meta package isn't removed, there's still a dependency on the most recent linux-image-3.2.0-52, so it cannot be removed.

We don't provide official documentation on how to update to a more kernel, but I've added a comment to https://forge.univention.org/bugzilla/show_bug.cgi?id=31783#c5

When updating to UCC 1.1 this will be handled automatically, so no need for an erratum.

One aspect of the script which should be improved in the removal script is that it currently only tests for the dpkg status "install ok installed". It should also cover "purge ok installed".
Comment 4 Moritz Muehlenhoff univentionstaff 2013-12-16 12:12:44 CET
(In reply to Moritz Muehlenhoff from comment #3)
> One aspect of the script which should be improved in the removal script is
> that it currently only tests for the dpkg status "install ok installed". It
> should also cover "purge ok installed".

This should be fixed for 1.1.
Comment 5 Felix Botner univentionstaff 2014-04-07 14:41:28 CEST
fixed in univention-corporate-client/apt-get-pre-invoke.d/univention-ucc-prune-old-kernel-packages(In reply to Moritz Muehlenhoff from comment #4)
> (In reply to Moritz Muehlenhoff from comment #3)
> > One aspect of the script which should be improved in the removal script is
> > that it currently only tests for the dpkg status "install ok installed". It
> > should also cover "purge ok installed".
> 
> This should be fixed for 1.1.

fixed
Comment 6 Erik Damrose univentionstaff 2014-04-22 15:07:13 CEST
(In reply to Felix Botner from comment #5)
> fixed in
> univention-corporate-client/apt-get-pre-invoke.d/univention-ucc-prune-old-
> kernel-packages(In reply to Moritz Muehlenhoff from comment #4)
> > (In reply to Moritz Muehlenhoff from comment #3)
> > > One aspect of the script which should be improved in the removal script is
> > > that it currently only tests for the dpkg status "install ok installed". It
> > > should also cover "purge ok installed".
> > 
> > This should be fixed for 1.1.
> 
> fixed

-> Verified successful removal of "purge ok installed" marked packages
Comment 7 Moritz Muehlenhoff univentionstaff 2014-06-02 14:45:04 CEST
*** Bug 31952 has been marked as a duplicate of this bug. ***
Comment 8 Moritz Muehlenhoff univentionstaff 2014-06-12 09:20:07 CEST
UCC 2.0 has been released:
 http://docs.univention.de/release-notes-ucc-2.0.html

If this error occurs again, please use "Clone This Bug".