Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I have a package installed (xcp-xapi) which is prone to a bug. The fix is very simple (only a couple of lines in the code) so what I do is the following:

apt-get source xcp-xapi

Then I find the source file to apply the fix and then I run again

apt-get -b source xcp-xapi

This will produce some .deb files that I install using

dpkg -i *.deb

Now the problem is that every time I try to run an apt-get upgrade, apt tries to fetch the packages from the repositories. I guess this can be fixed using pinning, but I cannot find the proper configuration to put in high priority the packages I compiled on my own.

So the question is how can I configure pinning to put the following already installed packages on higher priority than any existing in the repositories?

# apt-cache policy xcp-networkd xcp-v6d xcp-xapi xcp-xapi-debug
xcp-networkd:
  Installed: 1.3.2-5ubuntu0.1
  Candidate: 1.3.2-5ubuntu0.1
  Version table:
     1.3.2-5ubuntu0.1 0
        500 http://ftp.uninett.no/ubuntu/ precise-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/universe amd64 Packages
 *** 1.3.2-5ubuntu0.1 0
        100 /var/lib/dpkg/status
     1.3.2-5 0
        500 http://ftp.uninett.no/ubuntu/ precise/universe amd64 Packages
xcp-v6d:
  Installed: 1.3.2-5ubuntu0.1
  Candidate: 1.3.2-5ubuntu0.1
  Version table:
     1.3.2-5ubuntu0.1 0
        500 http://ftp.uninett.no/ubuntu/ precise-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/universe amd64 Packages
 *** 1.3.2-5ubuntu0.1 0
        100 /var/lib/dpkg/status
     1.3.2-5 0
        500 http://ftp.uninett.no/ubuntu/ precise/universe amd64 Packages
xcp-xapi:
  Installed: 1.3.2-5ubuntu0.1
  Candidate: 1.3.2-5ubuntu0.1
  Version table:
     1.3.2-5ubuntu0.1 0
        500 http://ftp.uninett.no/ubuntu/ precise-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/universe amd64 Packages
 *** 1.3.2-5ubuntu0.1 0
        100 /var/lib/dpkg/status
     1.3.2-5 0
        500 http://ftp.uninett.no/ubuntu/ precise/universe amd64 Packages
xcp-xapi-debug:
  Installed: 1.3.2-5ubuntu0.1
  Candidate: 1.3.2-5ubuntu0.1
  Version table:
     1.3.2-5ubuntu0.1 0
        500 http://ftp.uninett.no/ubuntu/ precise-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/universe amd64 Packages
 *** 1.3.2-5ubuntu0.1 0
        100 /var/lib/dpkg/status
     1.3.2-5 0
        500 http://ftp.uninett.no/ubuntu/ precise/universe amd64 Packages
share|improve this question

marked as duplicate by bodhi.zazen, Seth, Stephen Myall, Kevin Bowen, Eric Carvalho Jun 29 '13 at 2:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
I tried the "apt-mark hold" thing, but then it shows that the package has been kept back. I know that this is the latest version, so I don't want to see this warning each time I do an upgrade. apt pinning provides a "cleaner" solution to this in my opinion. –  Vangelis Tasoulas Jun 28 '13 at 18:37
1  
As you wish, I prefer a hold. Nice thing with Linux, often there is more then one option, choose the one that works best for you. –  bodhi.zazen Jun 28 '13 at 19:08

2 Answers 2

up vote 1 down vote accepted

I don't know if this is the proper solution, but trying different pinning configurations, I end up made it working like this:

create the file /etc/apt/preferences.d/xcp-xapi with the following contents:

Package: xcp-networkd
Pin: release n=precise
Pin-Priority: -1

Package: xcp-v6d
Pin: release n=precise
Pin-Priority: -1

Package: xcp-xapi
Pin: release n=precise
Pin-Priority: -1

Package: xcp-xapi-debug
Pin: release n=precise
Pin-Priority: -1

From what I understand, giving it a negative priority to the specific package from the specific repository means do not bother for this package, thus keep the current version installed. If someone can explain further or provide a "more correct" solution, I would appreciate it. Thank you!

share|improve this answer

One way might also be to send a bug report and patch to the developers of the xcp-xapi, and over time the bug might be fixed in the repositories. Then you can install the version from the repository again. That said, it might take some patience before the repositories are updated.

share|improve this answer
    
The problem with this as you said is time, and if it is not a security vulnerability it might not be backported in a stable distribution :( I have already filed a bug report here: bugs.launchpad.net/ubuntu/+source/xen-api/+bug/1195821 –  Vangelis Tasoulas Jun 28 '13 at 18:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.