Kangarooo and Srinath: Ah ha, I get what you are on about now. My test
system here doesn't have that package because of the same issue :-)

This is now fixed. The script should now only ever remove packages that match 
this pattern
"linux-image-|linux-headers-|linux-backports-modules-"
*and* show up in the 'dpkg -l' output as a 3 dotted number followed by a dash. 
This should prevent removal of the package that triggers updates (as it shows 
up as a 5 dotted number)

The running kernel is now never removed either, just as with the last-
good-boot kernel (if present).

There is also an option to run the command.

I've also tweaked the output:
$ ./remove-old-kernels
/etc/kernel/postinst.d/remove-old-kernels:
Reading system config file /etc/remove-old-kernels.conf ...
Found last-good-boot, 2.6.32-23 will never be removed
Current kernel 2.6.32-24 will never be removed
Installed kernels 2.6.32-21.32 2.6.32-22.36 2.6.32-23.37 2.6.32-24.42
Older than top 3: 2.6.32-21.32 
Will remove packages for 2.6.32-21.32
Suggested command is ...
sudo apt-get remove linux-image-2.6.32-21-generic
$

if I change my number to keep:

$ ./remove-old-kernels
/etc/kernel/postinst.d/remove-old-kernels:
Reading system config file /etc/remove-old-kernels.conf ...
Found last-good-boot, 2.6.32-23 will never be removed
Current kernel 2.6.32-24 will never be removed
Installed kernels 2.6.32-21.32 2.6.32-22.36 2.6.32-23.37 2.6.32-24.42
Older than top 1: 2.6.32-21.32 2.6.32-22.36 2.6.32-23.37 
Will remove packages for 2.6.32-21.32
Will remove packages for 2.6.32-22.36
Nothing can be done with 2.6.32-23.37
Suggested command is ...
sudo apt-get remove linux-image-2.6.32-21-generic linux-image-2.6.32-22-generic
$

This is with what I hope is a more normal set of packages (note 'linux' and 
'linux-generic'):
$ dpkg -l | grep ^ii|  grep 2.6.32
ii  linux                                                                       
 2.6.32.24.25                                         Generic complete Linux 
kernel.
ii  linux-generic                                                               
 2.6.32.24.25                                         Complete Generic Linux 
kernel
ii  linux-headers-2.6.32-23                                                     
 2.6.32-23.37                                         Header files related to 
Linux kernel version
ii  linux-headers-2.6.32-23-generic                                             
 2.6.32-23.37                                         Linux kernel headers for 
version 2.6.32 on x
ii  linux-headers-2.6.32-24                                                     
 2.6.32-24.42                                         Header files related to 
Linux kernel version
ii  linux-headers-2.6.32-24-generic                                             
 2.6.32-24.42                                         Linux kernel headers for 
version 2.6.32 on x
ii  linux-headers-generic                                                       
 2.6.32.24.25                                         Generic Linux kernel 
headers
ii  linux-image                                                                 
 2.6.32.24.25                                         Generic Linux kernel 
image.
ii  linux-image-2.6.32-21-generic                                               
 2.6.32-21.32                                         Linux kernel image for 
version 2.6.32 on x86
ii  linux-image-2.6.32-22-generic                                               
 2.6.32-22.36                                         Linux kernel image for 
version 2.6.32 on x86
ii  linux-image-2.6.32-23-generic                                               
 2.6.32-23.37                                         Linux kernel image for 
version 2.6.32 on x86
ii  linux-image-2.6.32-24-generic                                               
 2.6.32-24.42                                         Linux kernel image for 
version 2.6.32 on x86
ii  linux-image-generic                                                         
 2.6.32.24.25                                         Generic Linux kernel image
ii  linux-libc-dev                                                              
 2.6.32-24.42                                         Linux Kernel Headers for 
development
$

** Attachment added: "v4 script"
   
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/241368/+attachment/1537814/+files/remove-old-kernels

-- 
remove old kernels from grub list
https://bugs.launchpad.net/bugs/241368
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to