Upgrade from wheezy to jessie🔗

Run the following commands:

apt-get update
apt-get -u upgrade --assume-no
apt-get upgrade
apt-get dist-upgrade

Run these - they should have empty output:

dpkg -C
apt-mark showhold
dpkg --audit

Disable and uninstall the previous version of puppet🔗

Now to make sure that puppet is off, disabled, and uninstalled. This will prevent weird behaviour during upgrade:

/etc/init.d/puppet stop
apt-get remove --purge puppet puppet-common
crontab -e # Remove check_puppet crontab

Edit APT sources🔗

Replace whatever is in /etc/apt/sources.list with this:

deb http://ftp.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.debian.org/debian/ jessie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib
deb-src http://security.debian.org/ jessie/updates main contrib

This is a standard jessie sources list.

Upgrade to next version🔗

Run The following command:

apt-get update

You may end up getting the following lines of errors:

E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start. Current value: 25165824. (man 5 apt.conf)
Reading package lists... Error!
W: There is no public key available for the following key IDs:
AA8E81B4331F7F50
E: Unable to increase the size of the MMap as the limit of 16777216 bytes is already reached.
E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start. Current value: 25165824. (man 5 apt.conf)
E: Error occurred while processing samba-testsuite (NewVersion2)
E: Problem with MergeList /var/lib/apt/lists/security.debian.org_dists_jessie_updates_main_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.

It can be various things, so first try this solution:

rm /var/lib/apt/lists/* -vf
mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
cp /var/lib/dpkg/status-old /var/lib/dpkg/status
apt-get update

If the error persists, go try this solution: Add APT::Cache-Limit "100000000"; to /etc/apt/apt.conf.d/70debconf

Delete all corrupted merge lists:

rm /var/lib/apt/lists/* -vf

Running the following will automatically create a good new /var/lib/dpkg/status file.

apt-get update

Most of the lines above should be gone then.

You might get the following error still, though:

W: There is no public key available for the following key IDs:
AA8E81B4331F7F50

You simply have to install or update a package:

apt-get install debian-archive-keyring

Thereafter you can resume with the upgrade:

apt-get update
apt-get -u upgrade --assume-no # Just to see how many and what package are being upgraded.
apt-get upgrade
apt-get dist-upgrade # To upgrade the last packages.

That should be it!

Notes🔗

Apache goes from 2.2 to 2.4. A lot of changes are made between the two version. Update configuration accordingly. Mysql might complain about some log files. Move those log files and restart mysql, and shit should work.

A restart is pretty much required for the server to make use of all the new updates (including the installation of systemd).

After you've upgraded to Jessie, follow the Jessie+ update guide.