Blacklisting packages from installing

I'm currently running 10.10 with a package removed.

I'm concerned that when it comes time to upgrade, synaptic may well install that package again. Is there way to blacklist a package that works even through distribution upgrades?

In my case, the package is mono.


Solution 1:

The answer is simple:

Remove the packages you don't want using apt-get, synaptic package manager or the Software Center. open APT's 01autoremove file by issuing the command

sudo -H gedit /etc/apt/apt.conf.d/01autoremove

Navigate to the bottom of the section titled Never-MarkAuto-Sections and add an entry to the section. In my case to block GRUB I entered grub.*;. The contents of the modified file is at the bottom of this page.

You will enter the package name or portion of package names, including using .* to mean any characters. In my case grub.* blocks all packages that start with the word grub.

When you next open the update utility it will not show the option to upgrade or update the software that you chose to block.

My /etc/apt/apt.conf.d/01autoremove file:

APT
{
 NeverAutoRemove  {
  "^linux-firmware$";
  "^linux-image.*";   "^linux-restricted-modules.*";
  "^linux-ubuntu-modules-.*";
 };
 Never-MarkAuto-Sections
 {   "metapackages";
  "restricted/metapackages";
  "universe/metapackages";
  "multiverse/metapackages";
  "oldlibs";
  "restricted/oldlibs";
  "universe/oldlibs";
  "multiverse/oldlibs";
  "grub.*";
 };
};

Solution 2:

You could make your own mono package that is empty and set the version crazy high.

Sometimes this creates dep-solving issues though