On my Elementary OS system, dpkg reports a number of kernel packages that aren't installed. (I did an apt-get purge on them previously.) I'd like to have them forgotten about entirely, but I can't figure out how to get them that way.

For example:

elementary:~$ dpkg -l linux-*-3.2.0-51*
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                 Version                              Description
un  linux-headers-3.2.0-51               <none>                               (no description available)
un  linux-headers-3.2.0-51-generic       <none>                               (no description available)
un  linux-image-3.2.0-51-generic         <none>                               (no description available)

apt-get purge doesn't work:

elementary:~$ sudo apt-get purge linux-headers-3.2.0-51
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package linux-headers-3.2.0-51 is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

dpkg doesn't work:

elementary:~$ sudo dpkg --purge linux-headers-3.2.0-51
dpkg: warning: there's no installed package matching linux-headers-3.2.0-51
elementary:~$ sudo dpkg --forget-old-unavail
dpkg: warning: obsolete '--forget-old-unavail' option, unavailable packages are automatically cleaned up.

apt-cache shows:

elementary:~$ apt-cache policy linux-headers-3.2.0-51
  Installed: (none)
  Candidate: 3.2.0-51.77
  Version table:
     3.2.0-51.77 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages

aptitude isn't installed.

Obviously, there's something I'm not understanding. Why does dpkg -l show purged packages? How do I go about making dpkg forget about them?

  • Does your dpkg still have a --forget-old-unavail? – derobert Oct 9 '13 at 21:54
  • @derobert Unfortunately not. I added the result to the question. – Tony Oct 10 '13 at 18:24
  • Well, I guess the next thing to check is apt-cache policy linux-headers-3.2.0-51 to make sure the package is actually unavailable. – derobert Oct 10 '13 at 18:27
  • @derobert I added that to the question as well. – Tony Oct 10 '13 at 18:34

According to your apt-cache policy output, they're still in the archive (aka available), so dpkg won't forget about them. So the short answer is there isn't a way to get rid of that record.

The long answer is you could probably edit /var/lib/dpkg/status (it's a plain-text file) to do it. Make sure to keep a backup. Breaking this file would not be a good thing, badness level approaching "have you considered re-installing?"

  • /var/lib/dpkg/status doesn't contain the string "3.2.0-51". Or -52, or -53. Heh. I'm beginning to think that dpkg is a bit sloppy. – Tony Oct 10 '13 at 18:47
  • Then it must be /var/lib/dpkg/available, which is going to get updated with apt-get update. Problem is, its a package that your distro (Ubuntu) is giving out—that's why dpkg knows about it. – derobert Oct 10 '13 at 18:49
  • If Ubuntu is pushing the dpkg data at me willy-nilly, I guess I'll just have to learn to live with dead kernel package names in the list. Thanks. – Tony Oct 10 '13 at 20:09

You can use dpkg --clear-avail to delete dpkgs available packge list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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