If you have the version number, or the target release, apt-get supports choosing a particular version or target release. More details can be found on manual page of apt-get. It can also be accessed from terminal by typing man apt-get
sudo apt-get install <package-name>=<package-version-number> OR
sudo apt-get -t=<target release> install <package-name>
is the command to be run. This can be used to down-grade a package to a specific version.
Remark that when using a target release (option -t), the release priority must greater than 1000 to allow downgrades (see man 5 apt_preferences) otherwise the currently installed version will be kept.
It has been helpfully pointed out in the comments that
apt-cache showpkg <package-name>lists all available versions. (h/t Sparhawk)apt-mark hold <package-name>"holds" the package at the current version, preventing automatic upgrades. (h/t Luís de Sousa )
If you have the version number, or the target release, apt-get supports choosing a particular version or target release. More details can be found on manual page of apt-get. It can also be accessed from terminal by typing man apt-get
sudo apt-get install <package-name>=<package-version-number> OR
sudo apt-get -t=<target release> install <package-name>
is the command to be run. This can be used to down-grade a package to a specific version.
Remark that when using a target release (option -t), the release priority must greater than 1000 to allow downgrades (see man 5 apt_preferences) otherwise the currently installed version will be kept.
It has been helpfully pointed out in the comments that
apt-cache showpkg <package-name>lists all available versions. (h/t Sparhawk)apt-mark hold <package-name>"holds" the package at the current version, preventing automatic upgrades. (h/t Luís de Sousa )
Use:
apt-get install «pkg»=«version»
or:
sudo aptitude install «pkg»=«version»
Where:
«pkg»is the name of the package.«version»is the version number.
What is the correct way to downgrade apt package and dependencies? - Unix & Linux Stack Exchange
Manually downgrade a package?
linux - How to downgrade a specfic package using Pacman - Stack Overflow
Downgrading packages without removing half the OS
Videos
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.
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
Arch mirrors do not usually maintain older versions of packages, so you cannot directly find older versions in a mirror.
You can look in the Archlinux Archive here for the package: https://archive.archlinux.org/packages/p/python/
Download the package and install it with pacman -U
For more information: https://wiki.archlinux.org/title/Arch_Linux_Archive
If the package is already in your local cache (/var/cache/pacman/pkg/), it is possible to downgrade to that version.
As an example with firefox from this online tutorial:
sudo pacman -U /var/cache/pacman/pkg/firefox-81.0.1-1-x86_64.pkg.tar.zst
Be aware this should be a temporary solution, as on rolling-release distros, only the very latest version of every package is supported. Older packages may break.
The article also mentions the unofficial (and not supported) Arch Linux Archive. It has an archive of older packages you may not have in your cache. This is how they show how to use it:
sudo pacman -U https://archive.archlinux.org/packages/f/firefox/firefox-83.0-1-x86_64.pkg.tar.zst