2

I'm using a package provided in a PPA on Ubuntu. I use the PPA version because Debian's version is anemic to the point its effectively broken.

Today, when I went through the cycle of apt-get update and apt=get dist-upgrade, I was presented with:

$ sudo apt-get dist-upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  binutils-arm-none-eabi libnewlib-arm-none-eabi libnewlib-dev
The following packages will be upgraded:
  gcc-arm-none-eabi libcurl3 libcurl3-gnutls
3 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 338 kB/24.7 MB of archives.
After this operation, 9,572 kB disk space will be freed.

dist-upgrade is trying to install the packages that caused me the trouble in the past: binutils-arm-none-eabi and gcc-arm-none-eabi. Even a standard upgrade tries to install some of the same packages that caused me trouble.

I want to permanently block the distro's packages for binutils-arm-none-eabi and gcc-arm-none-eabi. How does one Permanently block a distro package, but allow a PPA that provides the same package?

1 Answer 1

2

In APT, you "pin" packages – i.e. specify custom package preferences based on various properties.

First run apt-cache policy to see properties of configured repositories, and look for one that is specific to your PPA. It'll probably have something like release n=precise (based on the Ubuntu release it targets) or at least origin launchpad.net (based on the source site):

$ apt-cache policy | egrep -i "(ppa|arm)"
 500 http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-terry.guo-gcc-arm-embedded,a=trusty,n=trusty,l=GNU ARM Embedded Toolchain,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-terry.guo-gcc-arm-embedded,a=trusty,n=trusty,l=GNU ARM Embedded Toolchain,c=main
     origin ppa.launchpad.net
     release v=14.04,o=LP-PPA-app-review-board,a=trusty,n=trusty,l=Application Review Board PPA,c=main
     release v=14.04,o=LP-PPA-app-review-board,a=trusty,n=trusty,l=Application Review Board PPA,c=main

Then create a file /etc/apt/preferences:

Package: binutils-arm-none-eabi
Pin: origin ppa.launchpad.net
Pin-Priority: 900

Package: gcc-arm-none-eabi
Pin: origin ppa.launchpad.net
Pin-Priority: 900

For Pin, use the repository property you found earlier. For the priority, choose a number that's higher than any of the regular Debian repositories.

Finally, run apt-cache policy binutils-arm-none-eabi – this time with the package name – to verify that the preferences are correctly applied:

$ apt-cache policy gcc-arm-none-eabi
gcc-arm-none-eabi:
  Installed: 4-8-2014q2-0trusty10
  Candidate: 4-8-2014q2-0trusty10
  Package pin: 4-8-2014q2-0trusty10
  Version table:
     4.8.2-14ubuntu1+6 900
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
 *** 4-8-2014q2-0trusty10 900
        500 http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
1
  • Perfect, thank you very much grawity. It worked flawlessly.
    – jww
    Sep 16, 2014 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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