Rollback Debian Upgrade

A single Debian upgrade (apt-get upgrade) can be rolled back with the following command. The upgrade is identified by its date and time, which has to be looked up from /var/log/apt/history.log first.

grep -A 2 'Start-Date: 2016-06-26  17:38:49' /var/log/apt/history.log | tail -1 | sed -r -e "s/Upgrade: //" -e "s/([^:]+):amd64 \(([^,]+), [^,]+\),?/\1=\2/g" | xargs apt-get install