Cleaning out old headers problem

Asked by steve taylor

I suspect it's just me that doesn't know about this one.

When I get a new build of linux-headers I delete the previous set but one, leaving the current set plus the one before in place.

To do this I use dpkg -l | grep linux-headers-* to check versions and sudo apt-get remove to clean out old versions. I also clean out old boot scripts with gksudo nautilus and update update grub.

I have noticed during this process:

'dpkg: warning: while removing linux-headers-3.2.0-33-generic, directory '/lib/modules/3.2.0-33-generic' not empty so not removed.'

Checking this directory it contains build modules dating back for some time. Maybe 1.5 gig.

So I guess I am doing it wrong.

Can anyone advise a better procedure that doesn't give this warning and clears out back copy header builds?

Ubuntu 12.04 precise 32-bit gnome 3.4.2

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Can you give the output of:

lsb_release -a; uname -a; dpkg -l | grep linux | grep header

Thanks

Revision history for this message
steve taylor (stevemail) said :
#2

steve@steve-System-Name:~$ lsb_release -a; uname -a; dpkg -l | grep linux | grep header
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.1 LTS
Release: 12.04
Codename: precise
Linux steve-System-Name 3.2.0-35-generic-pae #55-Ubuntu SMP Wed Dec 5 18:04:39 UTC 2012 i686 i686 i386 GNU/Linux
ii linux-headers-3.2.0-34 3.2.0-34.53 Header files related to Linux kernel version 3.2.0
ii linux-headers-3.2.0-34-generic 3.2.0-34.53 Linux kernel headers for version 3.2.0 on 32 bit x86 SMP
ii linux-headers-3.2.0-34-generic-pae 3.2.0-34.53 Linux kernel headers for version 3.2.0 on 32 bit x86 SMP
ii linux-headers-3.2.0-35 3.2.0-35.55 Header files related to Linux kernel version 3.2.0
ii linux-headers-3.2.0-35-generic 3.2.0-35.55 Linux kernel headers for version 3.2.0 on 32 bit x86 SMP
ii linux-headers-3.2.0-35-generic-pae 3.2.0-35.55 Linux kernel headers for version 3.2.0 on 32 bit x86 SMP
ii linux-headers-generic 3.2.0.35.40 Generic Linux kernel headers
ii linux-headers-generic-pae 3.2.0.35.40 Generic Linux kernel headers
steve@steve-System-Name:~$

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

sudo apt-get --purge remove linux-headers-3.2.0-34 linux-headers-3.2.0-34-generic linux-headers-3.2.0-34-generic-pae

What is the output?

Revision history for this message
steve taylor (stevemail) said :
#4

steve@steve-System-Name:~$ sudo apt-get --purge remove linux-headers-3.2.0-34 linux-headers-3.2.0-34-generic linux-headers-3.2.0-34-generic-pae
[sudo] password for steve:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED
  linux-headers-3.2.0-34* linux-headers-3.2.0-34-generic*
  linux-headers-3.2.0-34-generic-pae*
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 78.7 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 310300 files and directories currently installed.)
Removing linux-headers-3.2.0-34-generic-pae ...
Removing linux-headers-3.2.0-34-generic ...
dpkg: warning: while removing linux-headers-3.2.0-34-generic, directory '/lib/modules/3.2.0-34-generic' not empty so not removed.
Removing linux-headers-3.2.0-34 ...
steve@steve-System-Name:~$

That almost worked..

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

That's fine, the package has been removed. You can clear up with:

sudo rm -r /lib/modules/3.2.0-34-generic

Revision history for this message
steve taylor (stevemail) said :
#6

Can I use that command on all the other modules?

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#7

sure, just not:

/lib/modules/3.2.0-35-generic

Revision history for this message
steve taylor (stevemail) said :
#8

Thanks actionparsnip, that solved my question.

Revision history for this message
steve taylor (stevemail) said :
#9

Brilliant stuff Andrew many thanks.