Debian · Linux

Debian upgrade from 7 to 8

Upgrading Debian wheezy/7 to jessie/8
– skipping backup part – you own it
– stop running services such as apache, nginx, mysql, or postgresql: service nginx stop
As root edit /etc/apt/sources.list file:

nano /etc/apt/sources.list

Change all instances of wheezy to jessie.
This is how my sources.list file looked after replaced the line wheezy with jessie:

sed -i 's/wheezy/jessie/g' /etc/apt/sources.list

deb jessie main non-free
deb jessie/updates main non-free

deb jessie nginx
deb-src jessie nginx

Run the following command to update packages list:

apt-get update

Then, run the upgrade process – choose Yes to restart services:

apt-get upgrade

Finally, run the following command to perform full system upgrade.

apt-get dist-upgrade

Careful if you disable ssh password authentication for root user – I’ll assume you know what you’re doing.

In the news I found out this piece of advice – I did not took 🙂
Check the package state to ensure that no packages are on hold or in half installed state – if there are you need to fix first

dpkg --audit
dpkg --get-selections | grep hold

Found this advice on more how-to to remove all old and unnecessary packages using commands – not sure if necessary

apt-get purge $(dpkg -l | awk '/^rc/ { print $2 }')
apt-get autoremove

And of course, reboot is required to finish the upgrade and load the new kernel:


To check which Debian version is now installed on the system, take a look at the file /etc/os-release.

cat /etc/os-release

Possible problems
Errors about packages that are removed and not purged may be resolved by installing them again or purging the old package.

sudo apt-get install mysql-server

If the above step does not work for the package you are trying to install, you may purge the package with the following command after ensuring that you have a backup of the program’s data and configuration:

sudo apt-get remove --purge mysql-server
sudo apt-get install mysql-server

However, the upgrade when fine but something f….. up afterwards. Either that purge/autoremove or me deleting some configuration files repeatedly.
So this came to the rescue:

apt-get -o DPkg::options::=--force-confmiss --reinstall install package

You can use dpkg –purge to remove the config files before reinstalling the package.

For history sake I’ll write few “every-day” usage of apt-get, apt-cache, dpkg


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s