6

I'm trying to roll back my pigpio installation to test for changes but running into this problem:

pi@MyPi:~ $ sudo apt install pigpio=1.68-3+rpi1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 pigpio : Depends: libpigpiod-if2-1 (= 1.68-3+rpi1) but 1.71-0~rpt1 is to be installed
          Depends: libpigpiod-if1 (= 1.68-3+rpi1) but 1.71-0~rpt1 is to be installed
          Depends: libpigpiod-if-dev (= 1.68-3+rpi1) but 1.71-0~rpt1 is to be installed
          Depends: pigpio-tools (= 1.68-3+rpi1) but 1.71-0~rpt1 is to be installed
          Depends: libpigpio1 (= 1.68-3+rpi1) but 1.71-0~rpt1 is to be installed
          Depends: libpigpio-dev (= 1.68-3+rpi1) but 1.71-0~rpt1 is to be installed
          Depends: pigpiod (= 1.68-3+rpi1) but 1.71-0~rpt1 is to be installed
E: Unable to correct problems, you have held broken packages.

The last line includes an error message but it doesn't seem to be the problem:

pi@MyPi:~ $ apt-mark showhold
pi@MyPi:~ $

If I add a package, it does show up in hold.

Note, I've also removed pigpio:

pi@MyPi:~ $ sudo apt purge pigpio -y && sudo apt autoremove -y

I can get past my issue by manually specifying each package as the old version but this seems unnecessary.

pi@MyPi:~ $ sudo apt install pigpio=1.68-3+rpi1 libpigpiod-if2-1=1.68-3+rpi1 libpigpiod-if1=1.68-3+rpi1 libpigpiod-if-dev=1.68-3+rpi1 pigpio-tools=1.68-3+rpi1 libpigpio1=1.68-3+rpi1 libpigpio-dev=1.68-3+rpi1 pigpiod=1.68-3+rpi1

In particular, I think this means that in the future if I remove pigpio, it's dependencies won't be cleaned up too.

Is there some simple apt option I'm missing?

4 Answers 4

3

apt refuses to downgrade packages which you already have installed, unless you ask to do it explicitly.

One way to do this, as you found out, is to specify each version manually in the install command. If you want to make sure the dependencies will be removed when pigpio is removed, you can mark them as auto with apt-mark after installation.

An easier way is to uninstall those upgraded packages first:

apt-get remove pigpio
apt-get autoremove
apt-get install pigpio=1.68-3+rpi1

This normally should work, but for some reason it doesn't for pigpio, probably because there's only one package in the default release. What does work with pigpio is the -t release option, and you can find out what release a package belongs to with apt-cache or apt policy:

pi@raspberrypi:~ $ apt-cache madison pigpio
    pigpio | 1.78-1+rpi1 | http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages
    pigpio | 1.68-3+rpi1 | http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages

pi@raspberrypi:~ $ apt policy pigpio
pigpio:
  Installed: (none)
  Candidate: 1.78-1+rpi1
  Version table:
     1.78-1+rpi1 500
        500 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages
     1.68-3+rpi1 500
        500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages

pi@raspberrypi:~ $ sudo apt-get -t buster install pigpio
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libpigpio-dev libpigpio1 libpigpiod-if-dev libpigpiod-if1 libpigpiod-if2-1 pigpio-tools pigpiod
The following NEW packages will be installed:
  libpigpio-dev libpigpio1 libpigpiod-if-dev libpigpiod-if1 libpigpiod-if2-1 pigpio pigpio-tools pigpiod
0 upgraded, 8 newly installed, 0 to remove and 7 not upgraded.
Need to get 328 kB of archives.
After this operation, 990 kB of additional disk space will be used.

If autoremove doesn't remove all the dependencies, it means that something else in your system is depending on those packages. You'll need to either uninstall that something, or downgrade it along with pigpio. Note that specifying old package versions manually wouldn't work in such a case either.

2
  • I tried exactly this. Newer versions of the dependencies would still get installed or also need to have their versions manually specified. Commented Nov 22, 2021 at 23:24
  • @CameronTacklind You're right! I'll look into it. Interestingly, the same command works for if you try to downgrade pigpiod (with its dependency, libpigpio1), so there seems to be something special about pigpio package in particular. Commented Nov 23, 2021 at 16:41
0

I struggled with the same situation and found a solution that worked for me.

In my case I need to switch between psql-dev(postgresql) versions, so first I have to add the postgresql apt repository and each of the releases available to install for my distribution:

cat /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt xenial-pgdg 9.4 9.5 9.6 10 11

With this alone you won't be able to downgrade from version 11* to 9.6* due to the error you encountered. The trick is explained in this article:

cat /etc/apt/preferences.d/xenial-pgdg.pref
Explanation: postgresql: xenial-pgdg
Package: *
Pin: release c=9.6
Pin-Priority: 1001

After pinning the release with a priority of 1001or higher, it will install the dependencies from that release, in this case all dependencies matching version 9.6* .

0

When downgrading dependencies the apt system needs to know to which version each dependency should be downgraded.

In practice what you often want to do is downgrade a package together with its dependencies to a given release using option -t. Thus you will use sudo apt-get -t=<target release> install <package-name>

But there is one catch: The release must be configured to allow downgrades. This means its preference must be greater than 1000 because otherwise apt will keep the currently installed version. For more details see https://linux-tips.com/t/downgrade-a-package-with-its-dependencies/261

-1

According to apt manual, you can do it either by executing one of the following commands:

sudo apt-get install <package-name>=<package-version-number> OR

sudo apt-get -t=<target release> install <package-name>
3
  • 2
    I don't see what is different about this than what I've already tried. When I list only the main package, it gives me an error about wanting to install newer versions of other packages. Commented Oct 9, 2019 at 20:46
  • Please provide full error message Commented Oct 10, 2019 at 6:35
  • 1
    The first command you posted is the same one as the one I originally posted. I included the full output. I don't think this package has multiple "releases" so I don' think your second command applies. Commented Oct 11, 2019 at 2:29

You must log in to answer this question.

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