4

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.

  • Couldn't you upgrade the OS and then remove mono? – Alfredo Hernández Feb 3 '11 at 21:29
  • @aldomann Yes. But it's annoying. I'd rather not download mono and it's dependancies at all. – KitsuneYMG Feb 4 '11 at 0:41
5

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.*";
 };
};
  • Did not work for me (even specifically for grub*). Details in new question: askubuntu.com/questions/196037/… – Skaperen Oct 3 '12 at 17:39
  • 1
    Uh? Never-MarkAuto-Sections doesn't do this at all: it causes packages in a section not to be marked as automatically installed. You can't use package names, only section names. You can't use wildcards, only exact names. And this doesn't do anything about whether the package will be installed. – Gilles Oct 4 '12 at 0:49
1

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

Sometimes this creates dep-solving issues though

  • 1
    the other answer is more the way you are "supposed" to do it. my answer is more hackish, but it's been used for longer i think. you should accept Ilias el Matani's answer – RobotHumans Feb 4 '11 at 15:51
0

I'm not sure what APT::NeverMarkAuto really does, whether it stops it from being considered for dependency resolution.

edit /etc/apt/preferences and put in:

Package: mono
Pin: version *
Pin-Priority: -10

(warning, I didn't test this. Even if it does work, this might stop you from even installing it manually.)

More docs in the apt_preferences(5) man page.

Comment lines by prefixing with Explanation:. The Package: field doesn't support wildcards; Package: * used in some examples is a special case.

I haven't used preferences since I stopped trying to mix some packages from intrepid-backports with other packages from karmic (before it was released), or from Debian repos or from Medibuntu vs. Ubuntu-shipped. Pinning with preferences could make apt / aptitude /etc. decide that some version other than the highest version-numbered version was the best one to install, or that it didn't need upgrading.

Anyway, I just use aptitude for all my package management, it's SO much better than any of the simplistic GUIs I've seen come up on liveCDs or default installs. After marking something to be installed, if there's a crapload of stuff it's going to pull in via recommends:, I go and unmark that stuff before giving the final go-ahead.

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.