4

I seem to remember doing the suggested autoremove earlier this year and bricking my system in the process. linux-headers-generic and linux-image-generic seem pretty important.

    phm@LuckyCompCo:~$ sudo apt-get -f install
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      libmono-accessibility4.0-cil
      libmono-system-runtime-serialization-formatters-soap4.0-cil
      libmono-system-windows-forms4.0-cil libmono-webbrowser4.0-cil
      linux-headers-generic linux-image-generic
    Use 'apt-get autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
Braiam
  • 67,791
  • 32
  • 179
  • 269
Paul
  • 465
  • 1
  • 4
  • 8
  • For 2, see http://askubuntu.com/questions/223237/unable-to-correct-problems-you-have-held-broken-packages – muru Nov 15 '14 at 10:49

2 Answers2

5

The two packages linux-headers-generic and linux-image-generic are meta-packages. They provide nothing by themselves, but rely on other packages. These two always depend on the latest version of the kernel, so when you do apt-get upgrade, the latest version get installed. You can safely remove them, but you won't be prompted for kernel upgrades if you do. You can mark them as manually installed:

sudo apt-get install linux-headers-generic linux-image-generic

After this, autoremove should not suggest removing these two.

muru
  • 197,895
  • 55
  • 485
  • 740
3

Those package are being suggested to be removed because they are marked as "Automatically installed" instead of manually:

The following packages were automatically installed and are no longer required:

This is not normally the case as Ubuntu tries to keep the system using the latest available kernel using this metapackage, in fact, after you install your system most packages are marked as manually installed. You unknowingly must have set it up as automatically installed, but you can safely ignore the message so long you don't use the autoremove command. To mark those packages as manually installed you can use apt-mark:

sudo apt-mark manual linux-headers-generic linux-image-generic

With this, the package must be successfully removed from the list. You can use aptitude's unmarkauto to mark packages as manually installed too.


Why not using apt-get install packages to mark them?

First of all, it can get undesired results such as upgrading the packages or install others unrelated packages. Secondly, that's not the usage of the install command. This feature was implemented so when you select to install a package already installed it wouldn't be uninstalled automatically when you used autoremove or with other packages, since you already listed the package to be installed explicitly, instead of implicitly as result of other package installation.

Braiam
  • 67,791
  • 32
  • 179
  • 269