Googling in the subject
shows that you can downgrade PHP packages to Lenny versions without much trouble. However the already documented methods lacked a few things I consider important, thus I write down my own downgrade instructions for future reference.
Let's assume that you already have Squeeze up and running (either a clean install or you've upgraded from Lenny).
First of all make a backup of at least your
/etc
directory and your package selections:
cd ~
cp -a /etc etc_$(date +%Y%m%d)
dpkg --get-selections '*' > dpkg_selections_$(date +%Y%m%d)
This always comes handy in case you mess things up.
Create an APT sources file for the lenny distribution eg. in a file named
/etc/apt/sources.list.d/lenny.list
with the following (or similiar) contents:
deb http://ftp.us.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.us.debian.org/debian/ lenny main contrib non-free
deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free
# deb http://ftp.us.debian.org/debian/ lenny-proposed-updates main contrib non-free
# deb-src http://ftp.us.debian.org/debian/ lenny-proposed-updates main contrib non-free
deb http://volatile.debian.org/debian-volatile/ lenny/volatile main contrib non-free
deb-src http://volatile.debian.org/debian-volatile/ lenny/volatile main contrib non-free
# deb http://www.backports.org/debian/ lenny-backports main contrib non-free
# deb-src http://www.backports.org/debian/ lenny-backports main contrib non-free
Note: I've included the proposed updates and backports sources too in case one might need them.
Now set up APT pinning by creating an APT preferences file: either create or edit
/etc/apt/preferences
or create a new one at
/etc/apt/preferences.d/lenny
(note that the latter filename has no extension!).
The contents should look something like this:
Explanation: by default install a package from Lenny if it is not yet installed and is not available from Squeeze
Package: *
Pin: release n=lenny*
Pin-Priority: 100
Explanation: install these packages always from Lenny
Package: libapache2-mod-php5 php5-common php5-curl php5-gd php5-mcrypt php5-mysql
Pin: release n=lenny*
Pin-Priority: 999
In the second paragraph list all packages you want to get from Lenny. This will make sure that these come always from Lenny (except if you put here a package that is not in Lenny, but let's assume you won't
). The first paragraph makes sure that Lenny-specific (ie. available only from Lenny) dependencies of packages in the second paragraph are automatically installed as well.
(As a sidenote: you can put either an asterisk ("*") or a space separated package list in the
Package:
line of the preferences file. It does not accept wildcards in a package name, ie.
php5*
will not match any package.
)
Update your APT caches:
apt-get update
apt-get clean
To get a full list of PHP related packages (for the following commands), go through the output of this:
dpkg --get-selections | grep php
Now purge (deinstall both packages and their config) the Squeeze PHP packages:
apt-get purge libapache2-mod-php5 php5-cli php5-common php5-curl php5-gd php5-mcrypt php5-mysql php5-suhosin
If there were any PHP related files/directories not removed during the purge, take a look at them and remove them manually if necessary. Note that probably you should not keep any PHP related stuff, since there's quite some difference between PHP 5.3 and PHP 5.2, and this is true for everything (libs, config, executables, etc.).
After the cleanup (re)install the packages, but first check if your APT configuration is OK.
For this, run
apt-get
in download only mode:
apt-get -d install libapache2-mod-php5 php5-curl php5-gd php5-mcrypt php5-mysql
This will print the URL for every package and you can check what package comes from what location.
(Note: if you're familiar with
apt-cache
you can verify the repository priorities with
apt-cache policy
and the package policies with
apt-cache policy packagename
.)
If every package comes from the right repository (the one you intend it to come from
), install the packages:
apt-get install libapache2-mod-php5 php5-curl php5-gd php5-mcrypt php5-mysql
The last step is to go through the PHP config files and apply your customizations (if you've any). Since you've a backup of your old PHP config files (your
/etc
directory), this should be not too difficult. And of course: don't forget to (re)start you Apache.
Comments
Great tutorial
MySQL
php5-mysql includes libraries for mysql 5.0 but mysql-server on squeeze is 5.1. As there are no dependencies between them they do install fine.
But are you sure that this will work? At least phpmyadmin is complaining:
Guido
Re: MySQL
TY bro!!! xD
Thanks!
THANKS!
Hi!,First of all, thanks a
First of all, thanks a lot for sharing your tutorial.
I have been fighting with this the whole day, I had a similar configuration in Ubuntu, but I have just moved to Debian 6.
I have applied the tutorial, but the packages are still getting download from the squeeze repository.
When I run apt-get update I get the following output:
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
drozas@fanelli-iv:/etc/apt/preferences.d$ sudo apt-get clean
drozas@fanelli-iv:/etc/apt/preferences.d$ sudo apt-get update
Get:1 http://ftp.es.debian.org squeeze Release.gpg [1,672 B]
Ign http://ftp.es.debian.org/debian/ squeeze/contrib Translation-en
Ign http://ftp.es.debian.org/debian/ squeeze/contrib Translation-en_GB
Ign http://ftp.es.debian.org/debian/ squeeze/main Translation-en
Ign http://ftp.es.debian.org/debian/ squeeze/main Translation-en_GB
Ign http://ftp.es.debian.org/debian/ squeeze/non-free Translation-en
Ign http://ftp.es.debian.org/debian/ squeeze/non-free Translation-en_GB
Get:2 http://ftp.es.debian.org squeeze-updates Release.gpg [836 B]
Ign http://ftp.es.debian.org/debian/ squeeze-updates/main Translation-en
Ign http://ftp.es.debian.org/debian/ squeeze-updates/main Translation-en_GB
Get:3 http://ftp.es.debian.org squeeze Release [107 kB]
Ign http://ftp.us.debian.org lenny Release.gpg
Ign http://ftp.us.debian.org/debian/ lenny/contrib Translation-en
Ign http://ftp.us.debian.org/debian/ lenny/contrib Translation-en_GB
Ign http://ftp.us.debian.org/debian/ lenny/main Translation-en
Ign http://ftp.us.debian.org/debian/ lenny/main Translation-en_GB
Get:4 http://ftp.es.debian.org squeeze-updates Release [113 kB]
Hit http://security.debian.org squeeze/updates Release.gpg
Ign http://security.debian.org/ squeeze/updates/contrib Translation-en
Ign http://security.debian.org/ squeeze/updates/contrib Translation-en_GB
Hit http://volatile.debian.org lenny/volatile Release.gpg
Ign http://volatile.debian.org/debian-volatile/ lenny/volatile/contrib Translation-en
Ign http://volatile.debian.org/debian-volatile/ lenny/volatile/contrib Translation-en_GB
Ign http://security.debian.org/ squeeze/updates/main Translation-en
Ign http://security.debian.org/ squeeze/updates/main Translation-en_GB
Ign http://security.debian.org/ squeeze/updates/non-free Translation-en
Ign http://security.debian.org/ squeeze/updates/non-free Translation-en_GB
Ign http://security.debian.org lenny/updates Release.gpg
Ign http://security.debian.org/ lenny/updates/contrib Translation-en
Ign http://security.debian.org/ lenny/updates/contrib Translation-en_GB
Ign http://ftp.us.debian.org/debian/ lenny/non-free Translation-en
Ign http://ftp.us.debian.org/debian/ lenny/non-free Translation-en_GB
Ign http://security.debian.org/ lenny/updates/main Translation-en
Ign http://security.debian.org/ lenny/updates/main Translation-en_GB
Ign http://security.debian.org/ lenny/updates/non-free Translation-en
Ign http://volatile.debian.org/debian-volatile/ lenny/volatile/main Translation-en
Ign http://volatile.debian.org/debian-volatile/ lenny/volatile/main Translation-en_GB
Ign http://volatile.debian.org/debian-volatile/ lenny/volatile/non-free Translation-en
Ign http://volatile.debian.org/debian-volatile/ lenny/volatile/non-free Translation-en_GB
Ign http://ftp.us.debian.org lenny Release
Get:5 http://ftp.es.debian.org squeeze/main Sources [4,541 kB]
Ign http://security.debian.org/ lenny/updates/non-free Translation-en_GB
Hit http://security.debian.org squeeze/updates Release
Ign http://security.debian.org lenny/updates Release
Hit http://volatile.debian.org lenny/volatile Release
Ign http://security.debian.org lenny/updates/main Sources
Ign http://ftp.us.debian.org lenny/main Sources
Ign http://security.debian.org lenny/updates/contrib Sources
Ign http://security.debian.org lenny/updates/non-free Sources
Ign http://security.debian.org lenny/updates/main amd64 Packages
Ign http://security.debian.org lenny/updates/contrib amd64 Packages
Hit http://volatile.debian.org lenny/volatile/main Sources
Ign http://security.debian.org lenny/updates/non-free amd64 Packages
Hit http://security.debian.org squeeze/updates/main Sources
Hit http://security.debian.org squeeze/updates/contrib Sources
Hit http://security.debian.org squeeze/updates/non-free Sources
Hit http://security.debian.org squeeze/updates/main amd64 Packages
Hit http://security.debian.org squeeze/updates/contrib amd64 Packages
Hit http://volatile.debian.org lenny/volatile/contrib Sources
Hit http://volatile.debian.org lenny/volatile/non-free Sources
Hit http://volatile.debian.org lenny/volatile/main amd64 Packages
Ign http://ftp.us.debian.org lenny/contrib Sources
Hit http://volatile.debian.org lenny/volatile/contrib amd64 Packages
Hit http://volatile.debian.org lenny/volatile/non-free amd64 Packages
Ign http://ftp.us.debian.org lenny/non-free Sources
Ign http://ftp.us.debian.org lenny/main amd64 Packages
Ign http://ftp.us.debian.org lenny/contrib amd64 Packages
Ign http://ftp.us.debian.org lenny/non-free amd64 Packages
Hit http://security.debian.org squeeze/updates/non-free amd64 Packages
Err http://security.debian.org lenny/updates/main Sources
404 Not Found [IP: 195.20.242.89 80]
Err http://security.debian.org lenny/updates/contrib Sources
404 Not Found [IP: 195.20.242.89 80]
Err http://security.debian.org lenny/updates/non-free Sources
404 Not Found [IP: 195.20.242.89 80]
Err http://security.debian.org lenny/updates/main amd64 Packages
404 Not Found [IP: 195.20.242.89 80]
Err http://security.debian.org lenny/updates/contrib amd64 Packages
404 Not Found [IP: 195.20.242.89 80]
Err http://security.debian.org lenny/updates/non-free amd64 Packages
404 Not Found [IP: 195.20.242.89 80]
Err http://ftp.us.debian.org lenny/main Sources
404 Not Found [IP: 35.9.37.225 80]
Err http://ftp.us.debian.org lenny/contrib Sources
404 Not Found [IP: 35.9.37.225 80]
Err http://ftp.us.debian.org lenny/non-free Sources
404 Not Found [IP: 35.9.37.225 80]
Err http://ftp.us.debian.org lenny/main amd64 Packages
404 Not Found [IP: 35.9.37.225 80]
Err http://ftp.us.debian.org lenny/contrib amd64 Packages
404 Not Found [IP: 35.9.37.225 80]
Err http://ftp.us.debian.org lenny/non-free amd64 Packages
404 Not Found [IP: 35.9.37.225 80]
Get:6 http://ftp.es.debian.org squeeze/contrib Sources [40.8 kB]
Get:7 http://ftp.es.debian.org squeeze/non-free Sources [73.4 kB]
Get:8 http://ftp.es.debian.org squeeze/main amd64 Packages [6,539 kB]
Get:9 http://ftp.es.debian.org squeeze/contrib amd64 Packages [53.0 kB]
Get:10 http://ftp.es.debian.org squeeze/non-free amd64 Packages [102 kB]
Get:11 http://ftp.es.debian.org squeeze-updates/main Sources/DiffIndex [2,161 B]
Get:12 http://ftp.es.debian.org squeeze-updates/main amd64 Packages/DiffIndex [2,161 B]
Get:13 http://ftp.es.debian.org squeeze-updates/main amd64 Packages [13.7 kB]
Fetched 11.6 MB in 11s (988 kB/s)
W: Failed to fetch http://security.debian.org/dists/lenny/updates/main/source/Sources.gz 404 Not Found [IP: 195.20.242.89 80]
W: Failed to fetch http://ftp.us.debian.org/debian/dists/lenny/main/source/Sources.gz 404 Not Found [IP: 35.9.37.225 80]
W: Failed to fetch http://security.debian.org/dists/lenny/updates/contrib/source/Sources.gz 404 Not Found [IP: 195.20.242.89 80]
W: Failed to fetch http://security.debian.org/dists/lenny/updates/non-free/source/Sources.gz 404 Not Found [IP: 195.20.242.89 80]
W: Failed to fetch http://security.debian.org/dists/lenny/updates/main/binary-amd64/Packages.gz 404 Not Found [IP: 195.20.242.89 80]
W: Failed to fetch http://security.debian.org/dists/lenny/updates/contrib/binary-amd64/Packages.gz 404 Not Found [IP: 195.20.242.89 80]
W: Failed to fetch http://security.debian.org/dists/lenny/updates/non-free/binary-amd64/Packages.gz 404 Not Found [IP: 195.20.242.89 80]
W: Failed to fetch http://ftp.us.debian.org/debian/dists/lenny/contrib/source/Sources.gz 404 Not Found [IP: 35.9.37.225 80]
W: Failed to fetch http://ftp.us.debian.org/debian/dists/lenny/non-free/source/Sources.gz 404 Not Found [IP: 35.9.37.225 80]
W: Failed to fetch http://ftp.us.debian.org/debian/dists/lenny/main/binary-amd64/Packages.gz 404 Not Found [IP: 35.9.37.225 80]
W: Failed to fetch http://ftp.us.debian.org/debian/dists/lenny/contrib/binary-amd64/Packages.gz 404 Not Found [IP: 35.9.37.225 80]
W: Failed to fetch http://ftp.us.debian.org/debian/dists/lenny/non-free/binary-amd64/Packages.gz 404 Not Found [IP: 35.9.37.225 80]
I suspected this could be the cause, but when I perform the changes in lenny.list (i.e.: following the ideas of: http://forums.debian.net/viewtopic.php?f=10&t=54281) I still get the 5.3 packages.
If I run apt-cache policy I get:
apt-cache policy php5
php5:
Installed: (none)
Candidate: 5.3.3-7+squeeze8
Version table:
5.3.3-7+squeeze8 0
500 http://security.debian.org/ squeeze/updates/main amd64 Packages
5.3.3-7+squeeze3 0
500 http://ftp.es.debian.org/debian/ squeeze/main amd64 Packages
Thanks a lot!
Lenny reached end-of-life
Now the full Lenny repository became unavailable. It seems that these were transferred to the archive as well.
Thanks a lot müzso!, The
The method worked perfectly after performing the changes in the repositories file configuration.
I copy & paste my lenny.list configuration, in case it can be useful for someone else:
<code>
deb http://archive.debian.org/debian/ lenny main non-free contrib
deb-src http://archive.debian.org/debian/ lenny main non-free contrib
# Security:
deb http://archive.debian.org/debian-security/ lenny/updates main contrib non-free
deb-src http://archive.debian.org/debian-security/ lenny/updates main contrib non-free
# Volatile:
deb http://archive.debian.org/debian-volatile lenny/volatile main contrib non-free
deb-src http://archive.debian.org/debian-volatile lenny/volatile main contrib non-free
# Backports:
deb http://archive.debian.org/debian-backports lenny-backports main contrib non-free
</code>