4

I did sudo apt-mark hold nameofthepackage on 3 packages, but now I have an annoying remark when I upgrade with sudo apt-get upgrade :

Following packages have been holded : 
  package1 package2 package3
0 upgraded, 0 installed, 0 to remove and 3 non-updated.

(I'm sorry about the unexact output of the terminal, I'm using a french-version and I don't know exactly how to say this in english.)

Does it exist a way of "hiding" this ? I would like to have the usual 0 non-updated even when I hold packages. Thanks

  • it's absolutely NOT a duplicate of that... I'm looking for a way to hold a package without displaying it's on hold. – MrVaykadji Feb 11 '14 at 1:14
  • I apologies for misunderstanding your question Sir. – Lynob Feb 11 '14 at 1:27
  • 1
    No need for old workaround (deleted), as there is a better one. – user.dz Feb 17 '14 at 14:31
  • try LC_ALL=C sudo apt-get upgrade to get the output in english – rubo77 Apr 18 '14 at 2:43
3

Pin a package version using Apt Preferences

  1. Check current priority policy for my package, Example with virtualbox:

    $ apt-cache policy virtualbox
    virtualbox:
      Installed: 4.3.6-dfsg-1
      Candidate: 4.3.6-dfsg-2
      Version table:
         4.3.6-dfsg-2 0
            500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse amd64 Packages
     *** 4.3.6-dfsg-1 0
            100 /var/lib/dpkg/status
    
  2. Create new file in /etc/apt/preferences.d/

    sudo vim /etc/apt/preferences.d/my_pin
    
  3. Add package you want (joker * can be used), with higher priority (default 0, max 1000, or even negative value like -1 to skip a version)

    Package: virtualbox*
    Pin: version 4.3.6-dfsg-1
    Pin-Priority: 500
    
  4. Check again:

    $ apt-cache policy virtualbox
    virtualbox:
      Installed: 4.3.6-dfsg-1
      Candidate: 4.3.6-dfsg-1
      Package pin: 4.3.6-dfsg-1
      Version table:
         4.3.6-dfsg-2 500
            500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse amd64 Packages
     *** 4.3.6-dfsg-1 500
            100 /var/lib/dpkg/status
    
  5. No need to use hold, So sudo apt-mark unhold virtualbox but you could leave it as 2nd lock.

Now, if I check apt-get update, nothing is mentioned about about virtualbox (In held back packages listing).

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.