Ubuntu

remove old kernels from grub list

Reported by DanielRoesler on 2008-06-19
132
This bug affects 26 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Wishlist
Unassigned
Nominated for Hardy by jnustudent

Bug Description

Binary package hint: linux-image

This is a bug for new user confidence. So far Hardy has updated the kernel 3 times, which means 7 Ubuntu options on the grub list (3 kernels, 3 recoveries, 1 memtest).

A beginner will definitely be intimidated by this huge list of grub options. When I made the jump from Windows, after the first kernel update, I was really worried that I would make the wrong choice. No explanation is given in the grub menu, and the only difference between the options is one number. I thought this new option was a completely different version of Linux (not just the kernel), and all of my data might be on the other option. An unexplained option on the grub boot menu list adds anxiety, which doesn't help Bug #1.

There are two general ways to fix this:

1) Commenting out the options in the grub list. This is a simple fix, but it doesn't clear up the space taken by the old kernels. There is also the possibility that grub updates will reload the list, bringing back all of the options. You would have to make sure any reloading of the grub list also makes sure the old kernels stay commented out, which makes this a trans-package fix.

2) Actually removing the old kernels. This clears up space, but runs the risk of removing a stable kernel when the new one causes problems. I agree that at least one old kernel should be kept just in case the new one doesn't work. However, that would still mean 2 kernels showing up on the grub list, which will still intimidate casual users.

---------------------------

If there is worry about adding an prompt for the user to choose, there is already one that appears when the kernel is updated: the restart notification. The update manager lets users know they need to restart their computer, and there is plenty of room for a short notification that the new kernel is at the top of the grub menu list.

So, my proposed solution:

1) When installing a new kernel, mark for removal all but the current kernel (plus the one that's going to be installed). That way, if the new kernel doesn't work, the user can just use the previous one. Also, if more advanced users want to keep older kernels, they can simply uncheck the mark for removal of those older kernels.

2) Include a sentence in the restart notification that says something like, "Your updated Linux kernel (x.xx.xx-xx) will be added to the top of the Grub list. (What's a Linux kernel?)" This is so casual users won't get confused when they restart and now see two versions of Ubuntu. The What's a Linux kernel part should have a link to a small help that explains what it means. The help file shouldn't have a in depth explanation about kernels, just info saying that this isn't a new version of Ubuntu, just a new version of the underlying hardware interface, so no data will be lost.

3) After a successful restart (or several successful restarts), include a notification that says something like, "Your current Linux kernel (x.xx.xx-xx) appears to be working well. You can remove old Linux kernel versions to clear up space (XXX MB). This will also remove those old versions from your Grub boot menu list. You can do this anytime by removing the following packages via Synaptic: A, B, C [Remove old versions now]" Similar to the update notification, it would be confined to the Notification Area, and would pop up only when the user clicked on it. The "Remove old versions now" is a button that the user can click. This is so the user can simply dismiss the notification if they want, but still be informed if they want to remove the packages later.

See also:
Bug #79332
Bug #199086
http://ubuntuforums.org/showthread.php?t=554849
http://brainstorm.ubuntu.com/idea/2236/

[This is an automated message. Apologies if it has reached you inappropriately.]

This bug was reported against the linux-meta package when it likely should have been reported against the linux package instead. We are automatically transitioning this to the linux kernel package so that the appropriate teams are notified and made aware of this issue. Thanks.

affects: linux-meta (Ubuntu) → linux (Ubuntu)
kernel-janitor (kernel-janitor) wrote :

Hi diafygi,

Please be sure to confirm this issue exists with the latest development release of Ubuntu. ISO CD images are available from http://cdimage.ubuntu.com/releases/ . Please then run following command from a Terminal (Applications->Accessories->Terminal). It will automatically gather and attach updated debug information to this report.

apport-collect -p linux-image-`uname -r` 241368

Also, if you could test the latest upstream kernel available that would be great. It will allow additional upstream developers to examine the issue. Refer to https://wiki.ubuntu.com/KernelMainlineBuilds . Once you've tested the upstream kernel, please remove the 'needs-upstream-testing' tag. This can be done by clicking on the yellow pencil icon next to the tag located at the bottom of the bug description and deleting the 'needs-upstream-testing' text. Please let us know your results.

Thanks in advance.

[This is an automated message. Apologies if it has reached you inappropriately; please just reply to this message indicating so.]

tags: added: needs-kernel-logs
tags: added: needs-upstream-testing
tags: added: kj-triage
Changed in linux (Ubuntu):
status: New → Incomplete

Architecture: i386
DistroRelease: Ubuntu 9.04
HibernationDevice: RESUME=UUID=65826650-3688-4bb6-bf61-62832853f7e9
MachineType: To Be Filled By O.E.M. Z96JS
Package: linux-image-2.6.28-13-generic 2.6.28-13.45
PackageArchitecture: i386
ProcCmdLine: root=UUID=35734ca0-3423-41ee-94fb-581b76166eb6 ro quiet splash
ProcEnviron:
 SHELL=/bin/bash
 LANG=lt_LT.UTF-8
 LANGUAGE=lt_LT:lt:en_GB:en
ProcVersionSignature: Ubuntu 2.6.28-13.45-generic
Uname: Linux 2.6.28-13-generic i686
UserGroups: adm admin cdrom dialout fuse lpadmin plugdev sambashare

Changed in linux (Ubuntu):
importance: Undecided → Wishlist
status: Incomplete → Triaged

Completely removing the old kernels (rather than just removing from GRUB menu) is necessary because the modules use a very large amount of disk space (especially so when running on SSD). Constantly increasing disk space usage is precisely the kind of thing that people hate in Windows. Apt could solve this issue nicely, but only if Ubuntu actually removes the unneeded old versions.

user2037 (user2037) wrote :

The growing list of kernels also makes it difficult to dual boot chain-loaded operating systems like Windows or DOS. Wiki page https://wiki.ubuntu.com/KernelTeam/removing-old-kernels has a good solution with saving the last-known kernel.

Barry Warsaw (barry) wrote :

De-duped from bug 132311 because that bug is really about running out of disk space breaking upgrades. This is a different issue which might be related but isn't a duplicate.

The solution seems complicated, with all the prompts and so on. This *will* confuse users, and is something that can easily be hidden.

For casual users, the current kernel will be stable, and updates will only be for security.
We should keep the current and new kernels by default (so if the update does break anything, the user can recover).
Power users need to easily change this limit.
I suggest a simple script like the attached (but should get 'number to keep' from /etc/defaults/ etc). It can be easily triggered via a link in /etc/kernel/postinst.d/ - simply sucking up all the users disk space with limit (as at present) is not a solution, nor is expecting users to under stand what a kernel is or what is a 'good number' to keep around.

Kangarooo Jānis (kangarooo) wrote :

R u sure sript is ok?
i got code
sudo apt-get remove linux-image-2.6.35-10-generic linux-headers-2.6.35-11 linux-headers-2.6.35-11-generic linux-image-2.6.35-11-generic linux-headers-2.6.35-12 linux-headers-2.6.35-12-generic linux-image-2.6.35-12-generic linux-headers-2.6.35-13 linux-headers-2.6.35-13-generic linux-image-2.6.35-13-generic linux-headers-2.6.35-14 linux-headers-2.6.35-14-generic linux-image-2.6.35-14-generic linux-libc-dev linux-image-2.6.35-6-generic

and executing it left only 2 oldest not latest kernels and i think also whole kernel and something more
see dpkg.log

Could you post the output of
#ls /boot | grep vmlinuz
too ?

I'm also attaching a newer version which outputs more about what it is doing and why, please post the whole of the new output. It's harmless to run directly from the console (still).

Kangarooo Jānis (kangarooo) wrote :

Oh yes of course.
Since Comment #17 i havent made any updates and output now is
vmlinuz-2.6.35-8-generic
vmlinuz-2.6.35-9-generic

now on another comp i did v2
and output --> attachment v2 result

and in comp2 now output is
.. also?
vmlinuz-2.6.35-8-generic
vmlinuz-2.6.35-9-generic

this is good script so i hope it will leave latest kernels :)

And the output of
ls /boot | grep vmlinuz
?

That's how the script works out what kernel's are available, and I think it must be something in there that is confusing it, or at least the sorting that locates the oldest ones...

You could also try replacing line 8 (VERS=...) with this one and let me know how that behaves.
VERS=`dpkg -l | grep ^ii |grep linux-image|grep -v linux-image-generic|tr -s ' '|cut -d' ' -f3|sort -V | head -n -$NUM_TO_KEEP`

Kangarooo Jānis (kangarooo) wrote :

that i already posted
$ ls /boot | grep vmlinuz is now for both comps
vmlinuz-2.6.35-8-generic
vmlinuz-2.6.35-9-generic

ok so first i need to install some kernel couse i think maybe new update of it came but i didnt recieve couse deleted were also linux-image-generic and linux-generic and some more too. now i can install .15 but witch i need to install to have all back? linux-generic or linux-image-generic ? or some other?
and to have more linux images now installed to test script witch to install ? header-***** or image-header-**** ?

Jeff Craig (foxxtrot) wrote :

It might be nice if this could be somehow configured as well. The following configuration options seem potentially useful:

Keep X most recent kernels. Defaulted to 2, this should keep a 'known good' kernel, and the new one, but remove older ones.

Kernel Whitelist: Never delete this kernel revision, this would allow me to keep a 'known good' when I'm running an Alpha version of Ubuntu (as I am now).

This is a *huge* problem on SSD devices, as my netbook only has 16 GiB of space, and 2.4 GiB were consumed with Kernels (I removed a bunch, but I can still remove some more).

Kangerooo: If you've accidentaly (as the script mistakenly suggested) removed the mose recent kernel, "sudo apt-get update; sudo apt-get dist-upgrade" should reinstall them.

Jeff: Spot on idea with the number being configurable (from a file in /etc/).
Would you want a list of known good or just one? Would simply using the one recorded by last-good-boot (i.e./boot/last-good-boot/version ) work for you ? Actually, the script should probably honour that regardless as a safety net to stop other people having Kangerooo's problem.

v3 script that incorporates some of the above

I think since its its not know for all witch is good kernel then i think
Jeff sugests that its choosable witch one to ignore. That means another
terminal gui version with choosing witch to ignore
Example
./removekernels
1 2 3 4 5 will stay 6 7 8 will be removed do u want to change that? [Y/n]
Y or enter
kernel1 kernel2 kernel3 kernel4 kernel5 kernel6 kernel7 kernel8
1 or a 2 or b 3 or c etc
if more then 10 (1-0) then < > moves to next (or maybe make kernel chooser
to allow to choose from 10 latest installed that will be ok couse al
nonworking user have been already revomed
so 1 4 6 7 8
with Enter accept
1 4 6 7 8 will be removed
Thank you for using kernel remover! Have a nice 1337 day :)

@Tom no update and dist-upgrade doesnt install update of whats been removed.
Since thouse image-generic and kernel-something-generic packages without
version was uninstalled then new kernel wasnt installed

Kangarooo Jānis (kangarooo) wrote :

it would be also good if /boot/last-good-boot/version would work but where is it written? theres no such /boot/last-good-boot/version folder

@Kangarooo
I don't believe this script should be interactive. My use case is that it Just Works, on unattended servers or 'Joe Sixpack' machines where we can't or don't want to bother the user with something they do not care about and don't understand (see #16). This is how other distributions such as RedHat work.

last-good-boot may need enabling in /etc/default/kernel-helper-rc or something else - please ask on the forums for details.

Sorry to have broken your upgrades. You should simply be able to reinstall anything you uninstalled, again, please ask on the forums for details as it's kinda off topic for this bug.

Kangarooo Jānis (kangarooo) wrote :

khe khem.. now i opened script
its wrong..
s/grep linux-/grep linux-image-
couse to remove kernel is needed to remove linux-image-xxxxxx

Kangarooo Jānis (kangarooo) wrote :

meaning xxx numbers so no generic is deleted.. so not xxxx would be generic

I think you refer to this line:
      new=`dpkg -l | grep ^ii | grep $ver |grep linux-| awk -F' ' '{ print $2 }'|xargs`
which identifies all the packages involved with a particular kernel version.
In this case, searching (with grep) for linux- instead of linux-image- has the same effect, unless you see otherwise (in which case, please show the commands as well as the filtered and unfiltered (before and after grep) outputs).

Srinath (srinath) wrote :

How about removing the current running kernel ?

Kangarooo Jānis (kangarooo) wrote :

current running kernel removing from one comp i cant do from
synaptic.. see screenshot.
but is possible from terminal and is sugesting to remove also
linux-generic linux-image-generic witch if removed then no updates of
kernels come..
but if its somehow possible then thats another reason to add to this
kernel-removing script gui to choose how much and witch to remove..

@Srinath: I don't know what you mean. This script should never offer to do that.
@Kangaroo: I don't see how that is relevant. If you think the latest version of the script is going wrong, I've asked you to post the full script output as well as a dpkg dump

Kangarooo Jānis (kangarooo) wrote :

@Tom Srinath means that his kernel witch doesnt work is the newest
thats why he wants to remove it.
BUT removing newest with commands makes image-kernel removed
BTW if image-kernel is also removed then no new updates come.
so when script will work fine for reason to remove old kernels then
next step version witch also offering choose latest but without
removing image-kernel would be good. maybe somone will find how to
remove that with command line. im now off and going away for 4 days.
then ill find if no one finds till then.

when ill come back ill check V3 and post thouse outputs.

DanielRoesler (diafygi) wrote :

I'm glad people are discussing and proposing fixes to this bug, and I have some questions.

This script, from what I understand, creates a suggested command (but doesn't run it) to remove all but the last good boot kernel and the highest numbered kernel, right? If not, please clarify.

I worry that this script doesn't address the original problem of a confused new user after updating. First, I'm assuming this script would automatically run after an update, and it would also be changed to actually run the 'sudo apt-get remove ...' command, right?

Second, when the user reboots, there are still two kernels to choose from in the Grub list. Plus, there still isn't any indication about which one to pick. How can we explain, either on the Grub menu or before the user reboots, which one to pick?

Perhaps we could change the listing for the latest kernel to be appended with an "(Updated)" or "(Recommended)" or something?

Correct, the script currently does not run the command, instead printing it out.
It is my intention to change this to run the command once it's been stable for a while (and several kernel updates). In the mean time testers can duplicate the line
  echo sudo apt-get remove $PKGS_LIST
and remove the echo :
  sudo apt-get remove $PKGS_LIST
to have the suggestions happen automatically.
This *should* be safe, but be aware of the limited testing to date.

Yes, the user will see multiple kernels (at least two if using last-good-boot). The default settings for Grub, however, mean the latest one will always be selected.

Your suggestion to append "(Recommended)" is a good one though- open a new wish list item.

DanielRoesler (diafygi) wrote :

For appending a note at the end of the updated kernel in the Grub list, I've created Bug #629024.

Download full text (4.1 KiB)

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.
i...

Read more...

Kangarooo Jānis (kangarooo) wrote :

juris@juris-elina:~/Darbavirsma$ ls /boot | grep vmlinuz
vmlinuz-2.6.31-21-generic
vmlinuz-2.6.32-21-generic
vmlinuz-2.6.32-22-generic
vmlinuz-2.6.32-23-generic
vmlinuz-2.6.32-24-generic
vmlinuz-2.6.32-25-generic
juris@juris-elina:~/Darbavirsma$ ./remove-old-kernels
/etc/kernel/postinst.d/remove-old-kernels:
Current kernel 2.6.32-25 will never be removed
Installed kernels 2.6.31-21.59 2.6.32-21.32 2.6.32-22.36 2.6.32-23.37 2.6.32-24.43 2.6.32-25.45
Older than top 3: 2.6.31-21.59 2.6.32-21.32 2.6.32-22.36
Will remove packages for 2.6.31-21.59
Will remove packages for 2.6.32-21.32
Will remove packages for 2.6.32-22.36
Suggested command is ...
sudo apt-get remove linux-image-2.6.31-21-generic linux-image-2.6.32-21-generic linux-headers-2.6.32-22 linux-headers-2.6.32-22-generic linux-image-2.6.32-22-generic
juris@juris-elina:~/Darbavirsma$ sudo apt-get remove linux-image-2.6.31-21-generic linux-image-2.6.32-21-generic linux-headers-2.6.32-22 linux-headers-2.6.32-22-generic linux-image-2.6.32-22-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
Sekojošas pakotnes tiks NOŅEMTAS:
  linux-headers-2.6.32-22 linux-headers-2.6.32-22-generic linux-image-2.6.31-21-generic
  linux-image-2.6.32-21-generic linux-image-2.6.32-22-generic
0 modernizētas, 0 instalētas no jauna, 5 tiks noņemtas un 0 netiks modernizētas.
Pēc šīs operācijas tiks atbrīvota 369MB vieta uz diska.
...
...
juris@juris-elina:~/Darbavirsma$ ls /boot | grep vmlinuz
vmlinuz-2.6.32-23-generic
vmlinuz-2.6.32-24-generic
vmlinuz-2.6.32-25-generic

So now i think all is ok
This i did on comp witch hasnt been removing kernels for about 5months

Colin Watson (cjwatson) wrote :

I think we should solve this per bug 540452 instead.

DanielRoesler (diafygi) wrote :

I agree that this bug should be solved via a sub-menu system (like Bug #540452). However, Tom Chiverton's script is very useful in keeping a lid on the disk space taken up by updated kernels. Perhaps a combination of the script that keeps the latest two kernels and puts one in a sub-menu, leaving only the most recent at the top level grub list.

Colin Watson (cjwatson) wrote :

computer-janitor was originally designed with this as its single most
important use case. I believe ultimately it's due to be subsumed into
software-center, at which point it would be in a tool that people
actually run rather than hidden somewhere in the menus; it seems that
that ought to help.

#28 and go back to last working kernel option.

Edit /etc/default/kernel-helper-rc to enable the last-good-boot system.

My script is now in a PPA : https://launchpad.net/~bugs-launchpad-net-falkensweb/+archive/remove-old-kernels
Further updates to it will come from there, and so you should add the PPA and reinstall the script from there if you have it already.

Kangarooo Jānis (kangarooo) wrote :

I added PPA updated apt-get and installed remove-old-kernels and cant start programm with its name execution in terminal..

It's /etc/kernel/postinst.d/remove-old-kernels but you should never have to invoke this by hand.

I'm using Ubuntu 11.10. GNU GRUB version 1.99-12ubuntu5 removes old kernels from the grub list and shows: "Previous Linux versions" instead.

Howard Walker (h-635csi) wrote :

Quote "I'm using Ubuntu 11.10. GNU GRUB version 1.99-12ubuntu5 removes old kernels from the grub list and shows: "Previous Linux versions" instead."

Is this version soon to be released as a general update?

I now get two screens full of previously release messages, and have no idea from reading all the 50 odd comments above what anyone is talking about and whether its possible or not to remove them..

Most Ubuntu users may be what are called "Geeks" (no criticism implied"), but I am no longer one of these. I just want to switch my computer on and select Windows or Ubuntu, without having to know the ins and outs of the code that runs the OS.

Takes me back to DOS 2.1

@Howard Walker (h-635csi) comment #51

Canonical has released the latest version of Ubuntu 11.10 (Oneiric Ocelot). Linux Mint 12 is also based on Ubuntu 11.10.

The grub changes do not help the disk slowly filling up with kernels almost no one needs, though it reduces the user confusion caused by not removing them like RPM based distros tend to do.

Arno Teigseth (arnotixe) wrote :

I was quite proud to have been able to set up my first linux system once. I had created a boot partition by hand, even. It was 100MB.

Then after a while updates didn't work anymore...

Kangarooo Jānis (kangarooo) wrote :

i did sudo add-apt-repository ppa:bugs-launchpad-net-falkensweb/remove-old-kernels
how to execute it now?

Kangarooo Jānis (kangarooo) wrote :

i did sudo add-apt-repository ppa:bugs-launchpad-net-falkensweb/remove-old-kernels && sudo apt-get update && sudo apt-get install remove-old-kernels

how to execute it now?

It'll run the next time a kernel is installed. It's not designed to be run 'by hand'.

Howard Walker (h-635csi) wrote :
Download full text (5.1 KiB)

Sound very technical but how do you do any of these things. What does sudo add-apt-repository ppa:bugs-launchpad-net-falkensweb/remove-old-kernels mean?
Its all meaningless to new users. I now have 4 pages of old kernels on my laptop with windows at the bottom of course.
What is a grub list and ho do I edit it?
How do I remove the old kernels?

These are the sort of questions that need simple answers for people like me.

Good job that I only use my laptop for playing games on.

Best wishes
Howard Walker
Email: <email address hidden>
or h@635csi.co.uk

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Kangarooo
Sent: 12 May 2012 09:45
To: h@635csi.co.uk
Subject: [Bug 241368] Re: remove old kernels from grub list

i did sudo add-apt-repository ppa:bugs-launchpad-net-falkensweb/remove-old-kernels
how to execute it now?

--
You received this bug notification because you are subscribed to the bug report.
https://bugs.launchpad.net/bugs/241368

Title:
  remove old kernels from grub list

Status in “linux” package in Ubuntu:
  Triaged

Bug description:
  Binary package hint: linux-image

  This is a bug for new user confidence. So far Hardy has updated the
  kernel 3 times, which means 7 Ubuntu options on the grub list (3
  kernels, 3 recoveries, 1 memtest).

  A beginner will definitely be intimidated by this huge list of grub
  options. When I made the jump from Windows, after the first kernel
  update, I was really worried that I would make the wrong choice. No
  explanation is given in the grub menu, and the only difference between
  the options is one number. I thought this new option was a completely
  different version of Linux (not just the kernel), and all of my data
  might be on the other option. An unexplained option on the grub boot
  menu list adds anxiety, which doesn't help Bug #1.

  There are two general ways to fix this:

  1) Commenting out the options in the grub list. This is a simple fix,
  but it doesn't clear up the space taken by the old kernels. There is
  also the possibility that grub updates will reload the list, bringing
  back all of the options. You would have to make sure any reloading of
  the grub list also makes sure the old kernels stay commented out,
  which makes this a trans-package fix.

  2) Actually removing the old kernels. This clears up space, but runs
  the risk of removing a stable kernel when the new one causes problems.
  I agree that at least one old kernel should be kept just in case the
  new one doesn't work. However, that would still mean 2 kernels showing
  up on the grub list, which will still intimidate casual users.

  ---------------------------

  If there is worry about adding an prompt for the user to choose, there
  is already one that appears when the kernel is updated: the restart
  notification. The update manager lets users know they need to restart
  their computer, and there is plenty of room for a short notification
  that the new kernel is at the top of the grub menu list.

  So, my proposed solution:

  1) When installing a new kernel, mark for removal all but the current
  kernel (plus the one that's going to be installe...

Read more...

Kangarooo Jānis (kangarooo) wrote :
Download full text (3.3 KiB)

where i can see that after kernel installation older are removed?

kangarooo@UNR100403onLaptopE525:~$ sudo apt-get install linux-image-generic-lts-backport-oneiric
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  linux-image-3.0.0-20-generic
Suggested packages:
  fdutils linux-lts-backport-oneiric-doc-3.0.0 linux-lts-backport-oneiric-source-3.0.0 linux-lts-backport-oneiric-tools
The following NEW packages will be installed:
  linux-image-3.0.0-20-generic linux-image-generic-lts-backport-oneiric
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.6MB of archives.
After this operation, 114MB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://lv.archive.ubuntu.com/ubuntu/ lucid-proposed/main linux-image-3.0.0-20-generic 3.0.0-20.34~lucid1 [36.6MB]
Get:2 http://lv.archive.ubuntu.com/ubuntu/ lucid-proposed/main linux-image-generic-lts-backport-oneiric 3.0.0.20.8 [5,584B]
Fetched 36.6MB in 49s (739kB/s)
Selecting previously unselected package linux-image-3.0.0-20-generic.
(Reading database ... 180480 files and directories currently installed.)
Unpacking linux-image-3.0.0-20-generic (from .../linux-image-3.0.0-20-generic_3.0.0-20.34~lucid1_i386.deb) ...
Done.
Selecting previously unselected package linux-image-generic-lts-backport-oneiric.
Unpacking linux-image-generic-lts-backport-oneiric (from .../linux-image-generic-lts-backport-oneiric_3.0.0.20.8_i386.deb) ...
Setting up linux-image-3.0.0-20-generic (3.0.0-20.34~lucid1) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-3.0.0-20-generic
Running postinst hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.0.0-20-generic
Found initrd image: /boot/initrd.img-3.0.0-20-generic
Found linux image: /boot/vmlinuz-2.6.32-41-generic
Found initrd image: /boot/initrd.img-2.6.32-41-generic
Found linux image: /boot/vmlinuz-2.6.32-40-generic
Found initrd image: /boot/initrd.img-2.6.32-40-generic
Found linux image: /boot/vmlinuz-2.6.32-39-generic
Found initrd image: /boot/initrd.img-2.6.32-39-generic
Found linux image: /boot/vmlinuz-2.6.32-38-generic
Found initrd image: /boot/initrd.img-2.6.32-38-generic
Found linux image: /boot/vmlinuz-2.6.32-37-generic
Found initrd image: /boot/initrd.img-2.6.32-37-generic
Found linux image: /boot/vmlinuz-2.6.32-36-generic
Found initrd image: /boot/initrd.img-2.6.32-36-generic
Found linux image: /boot/vmlinuz-2.6.32-35-generic
Found initrd image: /boot/initrd.img-2.6.32-35-generic
Found linux image: /boot/vmlinuz-2.6.32-21-generic
Found initrd image: /boot/initrd.img-2.6.32-21-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Microsoft Windows XP Professional on /dev/sda1
done
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 3.0.0-20-generic /boot/vmlinuz-3.0.0-20-generic
run-parts: executing /etc/kernel/postinst.d/nvidia-common 3.0.0-20-generic /b...

Read more...

kangarooo: Please post the output of
#ls -lah /etc/kernel/postinst.d/ ; uname -a ; cat /etc/lsb-release

It looks like the script did not get triggered for some reason.

Kangarooo Jānis (kangarooo) wrote :

I now have need to trigger script couse no new kernels comming and no
autoremove happening

kangarooo@UNR100403onLaptopE525:~$ ls -lah /etc/kernel/postinst.d/ ; uname
-a ; cat /etc/lsb-release
total 24K
drwxr-xr-x 2 root root 4.0K 2012-05-12 11:15 .
drwxr-xr-x 5 root root 4.0K 2012-04-01 13:32 ..
-rwxr-xr-x 1 root root 207 2010-02-15 20:45 dkms
-rwxr-xr-x 1 root root 481 2010-01-14 13:18 nvidia-common
-rwxr-xr-x 1 root root 196 2010-04-19 13:11 pm-utils
-rw-r--r-- 1 root root 3.1K 2012-03-31 02:07 remove-old-kernels
Linux UNR100403onLaptopE525 2.6.32-41-generic #89-Ubuntu SMP Fri Apr 27
22:22:09 UTC 2012 i686 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.4 LTS"

kangarooo, thanks, I see the error now, I think I'll release a fixed package shortly.
In the mean time see comment #41

I've had discussions with people on the debian-mentors IRC group.
There is not much prospect of my approach in the PPA working automatically. The best it can do is tell you the command to run (DUMMY_RUN left as the default). It you are in the habit of running sudo apt-get update;sudo apt-get upgrade from the command line like me, that is good enough.

A real fix is being addressed in https://blueprints.launchpad.net/ubuntu/+spec/desktop-q-clean-old-kernels

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Related blueprints