3

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
2
  • 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. Jun 28, 2013 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.
    – Panther
    Jun 28, 2013 at 19:08

2 Answers 2

2

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!

1
  • 1
    This can be written more compact with one section for all packages, if the section are the same. In the Package:-line, you can list multiple packages separated with spaces, like this: Package: metacity metacity-common libmetacity-private0a. (Seems like patterns like Package: metacity* are also possible) Aug 22, 2014 at 2:43
0

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.

1

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