1

I want to have packages installed manually via dpkg -i not being updated. I figured the most elegant way to do this would to pin them to a high priority.

The manpage of apt_preferences says

Assign [...] priority 990 to the instances that are not installed and belong to the target release.

so I guess it should be higher than that.

Also:

For example, the following record causes APT to assign a high priority to all package instances available from the local site.

     Package: *
     Pin: origin ""
     Pin-Priority: 999

But even with priority 1100 it doesn't work.

How can I prevent such packages (edit) from being updated by apt-get dist-upgrade?

1 Answer 1

2

The tool you are looking for to complete your task is apt-mark.

Use the following command to mark a manually installed [Package] to prevent apt from updating it.

apt-mark hold [Package]

The command marks the package as held. A held package cannot be installed, upgraded, removed, or purged.

You can "unhold" a package with apt-mark unhold [Package] if you need to remove it.

Please check out the apt-mark manpage for more information on these tools.

9
  • I new of that possibility, but isn't there a way to generally prefer locally installed packages, regardless of version number? Having to deal with every individual package doesn't seem to be a good solution to me, especially since I consider it quiet a common use case to prefer packages installed from files. Oct 4, 2019 at 7:16
  • @philipp2100 I can look into a more robust solution. As far as I can tell you were doing things correctly, using apt-mark is to guarantee that apt does not do anything with the package in question.
    – kemotep
    Oct 4, 2019 at 12:13
  • @philipp2100 If you choose to use apt_preferences and assign a pin priority you need to make sure that your local package source is listed at the top of /etc/apt/sources.list. Check out this answer on AskUbuntu. It looks like you will need to create a local repo and reference that. If necessary I can update my answer if you can update your post with what version of Debian or Debian-based Linux you are running.
    – kemotep
    Oct 4, 2019 at 12:29
  • @philipp2100 I have also found this manual page with a table explaining priorities. If I am reading it correctly, it looks like assigning a pin priority of -1 accomplishes a similar goal as apt-mark hold.
    – kemotep
    Oct 4, 2019 at 12:43
  • Thanks for your efforts! It's unfortunate that you can seem to assign a pin priority to a "file" source and would have to create a local repo. If this is indeed not possible you don't have to update your answer. Otherwise I can include my distribution in the question. It's Devuan Ascii. Oct 9, 2019 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .