Debian jessie is now officially released. So it’s time to upgrade my home server (used as NAS and for development)
I have to make some configuration backup to track unexpected changes that may apply due to switching to Systemd. Have some doubts regarding Docker, which is installed from backport repository.
Furthermore, I cannot tolerate any loss of data. Well, I’m using software RAID and data is stored on separate discs. The core system is not running on RAID, my root partition is mounted to a dedicated SSD. Anyway, all very important data are backed up now.
Backup your configs
Let’ backup system configuration we might need to check after the upgrade.
# Installed packet status
dpkg --get-selections "*" > /.../BACKUP/wheezey/dpkg_selections.txt
# Copy current /etc config to
cp -a /etc /...BACKUP/wheezey/
# and more packet information
cp -a /var/lib/aptitude/ /.../BACKUP/wheezey/
cp -a /var/lib/apt/ /.../BACKUP/wheezey/
cp -a /var/lib/dpkg/ /.../BACKUP/wheezey/
System checks
It’s a good idea to check whether there are some problems with kernel modules. Do a quick check if there are errors using dmesg
You may want to see the list of loaded modules as well cat */proc/modules*
.
If you use aptitude make sure that there are no outstanding tasks. Start aptitude in interactive mode and hit “g”. You also have to make sure that there are no packages “on hold” otherwise it will prevent the system to be upgraded. Besides this aptitude and apt-get uses its own systems to maintain that.
aptitude search "~ahold"
The apt apt-get maintained “hold” packages:
dpkg --get-selections | grep 'hold'
Now check dpkg problems with
dpkg --audit
If it shows nothing - everything is fine for now.
But there is maybe more to do. As already mentioned by default Jessie will replace init-scripts with systemd by default (and i want give it a try). To minimize the number of problems, I want to be sure that my current configuration of the services is clean. During the lifetime of my system, I’ve installed and removed a lot of packages, now it’s time to make sure that there are no unused configuration leftovers in particular unused init scripts.
#Displays a list of all removed packages that may have configuration files left on the system
$dpkg -l | awk '/^rc/ { print $2 }'
#Alternatively it's easier with aptitude
$aptitude search '~c'
Now purge all found unused packets
$aptitude purge '~c'
However, i’d like to see if there are some manual changes on init.d scripts
dpkg-query --show -f'${Conffiles}' | sed 's, /,\n/,g' | \
grep /etc/init.d | awk 'NF,OFS=" " {print $2, $1}' | \
md5sum --quiet -c
This check says to me that my /etc/init.d/docker script was modified. During the upgrade, the systemd unit file for docker will take precedence over my locally modified init script… So now I know that I have to pay attention to this later.
Upgrading apt source-list
Ok, it seems that the system is prepared for an update in general.
Now let’s switch release codenames from wheezy to Jessie.
sed -i 's/wheezy/jessie/g' /etc/apt/sources.list
#Check cat /etc/apt/sources.list
#
# deb cdrom:[Debian GNU/Linux testing _Wheezy_ - Official Snapshot amd64 NETINST Binary-1 20120204-15:35]/ jessie main
#deb cdrom:[Debian GNU/Linux testing _Wheezy_ - Official Snapshot amd64 NETINST Binary-1 20120204-15:35]/ jessie main
deb http://ftp.de.debian.org/debian/ jessie main non-free contrib
deb-src http://ftp.de.debian.org/debian/ jessie main non-free contrib
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free
#backports
deb http://ftp.debian.org/debian/ jessie-backports main non-free contrib
As you see in the output I have also a backport source (now switcvhet do jessie-backports) Hmmm, it would mean you would get backport from the next testing version, but I don’ want, so I disable it for now.
Be aware there could be more custom source lists in /etc/apt/sources.list.d/ I have to files more:
docker.list nodesource.list
# cat /etc/apt/sources.list.d/docker.list
deb https://get.docker.com/ubuntu docker main
# cat /etc/apt/sources.list.d/nodesource.list
deb https://deb.nodesource.com/node wheezy main
deb-src https://deb.nodesource.com/node wheezy main
The first gives me the latest docker, the latest is the repository for Node.js. Hmm… The jessie docker.io package is to old for me. In the case of docker, I need really stick to the newest versions. So the source list stays like it is. But nodesource needs to be jessie now:
sed -i 's/wheezy/jessie/g' /etc/apt/sources.list.d/nodesource.list
Huh! now it seems that everything is ready! Now Double checking of source lists and start!
Do upgrade
First, the list of available packages for the new release needs to be fetched.
apt-get update
If no problems appeared run
apt-get upgrade
to perform a minimal system upgrade (no packages will be removed at this stage) Everything went smooth. Now finally we do a dist-upgrade.
apt-get dist-upgrade
Both last steps may take i while… And during this, you maybe will be asked about configuration changes. Actually, if any files under /etc/ directory should be replaced by the package maintainer’s version… Well, what to answer? Answering “yes” ensures system consistency. And you can always revert or merge the version since they will be automatically saved with a .dpkg-old extension.
Rebooting
Now we have installed Debian 8 Jessie at least on disk, but we still running wheezy. We need to reboot. Before the reboot, you can again purge packets that were removed during the dist-upgrade.
$aptitude purge '~c'
Also, check config files that were conflicting during the installation.
Restart…
init 6
After Reboot checks
Hey, it uses less ram now… Due systemd it started much faster… Now check your system status according to systemd.
systemctl status
Or find failed units…
systemctl --failed
and check Journal for problems on those…
journalctl -u <unitname>
Hope that this helps somebody.