51

I'm running Ubuntu 12.04, and two active linux images 3.2.0-37 and 3.2.0-36. In the /usr/src/ directory i find:

linux-headers-3.2.0-23    
linux-headers-3.2.0-23-generic    
linux-headers-3.2.0-26    
linux-headers-3.2.0-26-generic
linux-headers-3.2.0-29    
linux-headers-3.2.0-29-generic
linux-headers-3.2.0-31    
linux-headers-3.2.0-31-generic    
linux-headers-3.2.0-32    
linux-headers-3.2.0-32-generic    
linux-headers-3.2.0-33    
linux-headers-3.2.0-33-generic    
linux-headers-3.2.0-34    
linux-headers-3.2.0-34-generic    
linux-headers-3.2.0-35    
linux-headers-3.2.0-35-generic    
linux-headers-3.2.0-36    
linux-headers-3.2.0-36-generic     
linux-headers-3.2.0-37     
linux-headers-3.2.0-37-generic

Today I sudo apt-get purge linux-image-x.x.x.x-generic *34 and *35

I have to add that /boot contains only *36 and *37.

Is it safe to remove all of these except *37 and *36 ? Thank you in advance.

55

Those are header files are contained in the linux-headers-* and linux-headers-*-generic packages. It should be safe to remove them through apt-get. Maybe apt-get autoremove will already suggest that to you. Please do not remove them manually!

  • 4
    apt-get autoremove did not remove the header files for me – user12345 Oct 17 '14 at 23:51
  • 4
    Except sometimes apt-get autoremove can't run because of an out of disk space error, due in part to /usr/src/linux* taking up 2G of space on a small drive. – Mark Stosberg Feb 22 '16 at 21:12
  • 3
    Yap. Sometimes it is not the disk space, but no more inodes being left -> if df -i shows 100% usage, you are de facto left with no space whatsoever. Only solution is then to delete some /usr/src/linux* stuff, to get apt to work again. – Christian Ulbrich Apr 6 '17 at 0:48
  • 1
    Try sudo apt autoremove rather than apt-get. – jaybrau Jun 12 '18 at 14:22
  • 5
    FWIW, apt-get autoremove worked for me -- freed 3.3GB of space on my 8GB AWS instance. Thank you! – jeff_mcmahan Aug 16 '18 at 2:11
12

I just had this issue, and the suggestion to use apt-get autoremove did not work for me.

I resolved it by doing:

sudo apt-get purge linux-headers-3.2.0-23

on such linux headers that lived in /usr/src. I did not remove the headers that correspond to the kernel currently being used.

Restarted the server successfully.

-1

To anyone coming in off a Google search years later: You can also uninstall old kernels in the Synaptic Package Manager. Just double check which one you're currently using by typing 'uname -a' into the terminal.

  • 2
    Your answer should explain how to do this, specifically. – Elijah Lynn Mar 3 '17 at 20:08

protected by Community Mar 1 '18 at 11:36

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.