Upgrade Debian 6 Squeeze to 7 Wheezy

One of the advantages of Debian operating system is the ability to live update a production server from current to next release. Under normal circumstances you do not have to re-setup the system. So you avoid downtime, something critical for server systems.

There are possibilities this procedure to fail, so you must take a full system backup before.

The same procedure can be applied to desktop machines. There is more complexity in this case, due to graphical desktop environment.

Here I describe a successful upgrade of a Debian LAMP server system from Squeeze to Wheezy.

1. Backup your system

Take a full system backup.

2. Perform a full system update

Use:

apt-get update && apt-get -V upgrade

3. Change repositories

Replace “squeeze” with “wheezy” in /etc/apt/sources.list, for example

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

deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free

# wheezy-updates, previously known as 'volatile'
deb http://ftp.gr.debian.org/debian/ squeeze-updates main contrib non-free
deb-src http://ftp.gr.debian.org/debian/ squeeze-updates main contrib non-free

# webmin
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

will become

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

deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free

# wheezy-updates, previously known as 'volatile'
deb http://ftp.gr.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.gr.debian.org/debian/ wheezy-updates main contrib non-free

# webmin
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

4. Update package list

Use:

apt-get update

5. Update minimal system

Use:

apt-get upgrade

The result will be something like this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common apt apt-utils aptitude base-files bash bind9-host binutils
  bsdmainutils bzip2 ca-certificates console-setup coreutils cpp cpp-4.4 curl dmsetup dnsutils dpkg e2fslibs e2fsprogs exim4 exim4-base
  exim4-daemon-light file fwsnort g++ g++-4.4 gcc gcc-4.4 gcc-4.4-base gettext-base git grub-common grub-pc heirloom-mailx htop ifupdown info
  initramfs-tools initscripts iproute iptables iputils-ping keyboard-configuration klibc-utils less libacl1 libalgorithm-diff-xs-perl
  libapache-mod-security libapache2-mod-php5 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapt-pkg-perl libattr1 libauthen-pam-perl
  libbit-vector-perl libblkid1 libbsd0 libbz2-1.0 libc-bin libc-dev-bin libc6 libc6-dev libc6-i386 libcap2 libclamav6 libcomerr2 libcurl3
  libcurl3-gnutls libcwidget3 libdbd-mysql-perl libdbi-perl libdevmapper1.02.1 libedit2 libexpat1 libfreetype6 libgcc1 libgcrypt11 libgdbm3
  libglib2.0-0 libgnutls26 libgomp1 libgpg-error0 libgpgme11 libgpm2 libgssapi-krb5-2 libgssglue1 libgssrpc4 libhtml-parser-perl libidn11
  libio-pty-perl libiptables-chainmgr-perl libk5crypto3 libkeyutils1 libklibc libkrb5-3 libkrb5support0 libldap-2.4-2 liblocale-gettext-perl
  liblockfile1 libltdl7 liblua5.1-0 liblzo2-2 libmagic1 libmpfr4 libncurses5 libncursesw5 libnet-ssleay-perl libnewt0.52 libnfsidmap2
  libpam-modules libpam0g libpcap0.8 libpci3 libpcre3 libpkcs11-helper1 libpopt0 libreadline5 libreadline6 librpcsecgss3 libsasl2-2
  libsasl2-modules libselinux1 libsepol1 libsigc++-2.0-0c2a libslang2 libsqlite3-0 libss2 libssh2-1 libstdc++6 libstdc++6-4.4-dev libtasn1-3
  libtext-charwidth-perl libtext-iconv-perl libudev0 libunix-syslog-perl libusb-0.1-4 libuuid-perl libuuid1 libwrap0 libwww-perl libxapian22
  libxml2 libyaml-syck-perl linux-image-2.6-amd64 locales lsb-release man-db mc module-init-tools mount mutt mysql-common mysql-server nano
  ncurses-bin netbase nfs-common nmap ntp openssh-client openssh-server openssl openvpn passwd pciutils perl perl-base perl-modules php5
  php5-adodb php5-cli php5-common php5-mysql php5-tidy procps psad psmisc python python-apt python-minimal python-reportbug python2.6
  python2.6-minimal reportbug resolvconf rsync rsyslog s3cmd screen sgml-base sysvinit tasksel trickle udev util-linux vim-common vim-tiny
  w3m wget whiptail xml-core xz-utils zlib1g
The following packages will be upgraded:
  acpi acpi-support-base acpid adduser apt-listchanges apt-show-versions apticron at awstats base-passwd bash-completion bc bsdutils busybox
  chkrootkit clamav clamav-base clamav-freshclam cpio cpulimit cron dash dc dctrl-tools debconf debconf-i18n debian-archive-keyring
  debian-faq debian-goodies debianutils diffutils discover dmidecode doc-debian dpkg-dev eject exim4-config fail2ban fakeroot findutils
  firmware-bnx2 ftp geoip-database git-core gnupg gpgv grep groff-base gzip host hostname insserv install-info installation-report
  isc-dhcp-client isc-dhcp-common iso-codes john john-data kbd libapr1 libdate-calc-perl libdate-manip-perl libdiscover2 libdpkg-perl
  libgc1c2 libgeoip1 libglib2.0-data libhtml-format-perl libhtml-template-perl libhtml-tree-perl libiptables-parse-perl libmailtools-perl
  libnet-daemon-perl libnfnetlink0 libopts25 libpam-runtime libqdbm14 libtidy-0.99-0 libtommath0 liburi-perl linux-base linux-libc-dev login
  logrotate logwatch lsb-base lsof m4 make manpages manpages-dev mawk mime-support mlocate ncurses-base ncurses-term net-tools
  netcat-traditional nikto oinkmaster openssh-blacklist openssl-blacklist openvpn-blacklist os-prober p7zip-full patch php-gettext procmail
  python-apt-common python-central python-support readline-common rkhunter sed sensible-utils shared-mime-info snort-rules-default ssl-cert
  sudo sysv-rc sysvinit-utils tar tasksel-data tcpd texinfo tiger time traceroute tzdata ucf unhide update-inetd update-notifier-common
  wamerican whois xinetd xkb-data
138 upgraded, 0 newly installed, 0 to remove and 210 not upgraded.
Need to get 54.4 MB of archives.
After this operation, 16.7 MB disk space will be freed.
Do you want to continue [Y/n]?

6. Update the rest system

Use:

apt-get dist-upgrade

The result will be something like this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  console-terminus libept1 mod-security-common mysql-client-5.1 mysql-server-5.1 mysql-server-core-5.1 php5-suhosin portmap
The following NEW packages will be installed:
  aptitude-common console-setup-linux cpp-4.7 dbus firmware-linux-free fontconfig fontconfig-config fonts-droid fonts-liberation g++-4.7
  gcc-4.7 gcc-4.7-base ghostscript git-man gnuplot gnuplot-nox groff grub-pc-bin grub2-common gsfonts hicolor-icon-theme imagemagick
  imagemagick-common kmod krb5-locales libaio1 libapache2-modsecurity libapt-inst1.5 libapt-pkg4.12 libasprintf0c2 libavahi-client3
  libavahi-common-data libavahi-common3 libbind9-80 libblas3 libblas3gf libboost-iostreams1.49.0 libcairo2 libclass-isa-perl libcroco3
  libcups2 libcupsimage2 libdatrie1 libdb5.1 libdbus-1-3 libdjvulibre-text libdjvulibre21 libdns88 libencode-locale-perl libept1.4.12
  libevent-2.0-5 libexiv2-12 libffi5 libfile-listing-perl libfontconfig1 libfuse2 libgd2-noxpm libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common
  libgfortran3 libgmp10 libgs9 libgs9-common libhtml-form-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl
  libhttp-message-perl libhttp-negotiate-perl libice6 libijs-0.35 libilmbase6 libio-socket-ip-perl libio-socket-ssl-perl libisc84 libisccc80
  libisccfg82 libitm1 libjasper1 libjbig0 libjbig2dec0 libjpeg8 libkmod2 liblcms1 liblcms2-2 liblensfun-data liblensfun0 liblinear-tools
  liblinear1 liblockfile-bin liblqr-1-0 liblwp-mediatypes-perl liblwp-protocol-https-perl liblwres80 liblzma5 libmagickcore5
  libmagickcore5-extra libmagickwand5 libmount1 libmpc2 libmysqlclient18 libnet-http-perl libnet-ip-perl libnetaddr-ip-perl libnetpbm10
  libopenexr6 libp11-kit0 libpam-modules-bin libpango1.0-0 libpaper-utils libpaper1 libpipeline1 libpixman-1-0 libpng12-0 libprocps0
  libquadmath0 librsvg2-2 librsvg2-common librtmp0 libsemanage-common libsemanage1 libsm6 libsocket-perl libsocket6-perl libssl1.0.0
  libstdc++6-4.7-dev libsvm-tools libswitch-perl libsystemd-login0 libthai-data libthai0 libtiff4 libtinfo5 libtirpc1 libtokyocabinet9
  libustr-1.0-1 libwmf0.2-7 libwww-robotrules-perl libx11-6 libx11-data libxau6 libxaw7 libxcb-render0 libxcb-shm0 libxcb1 libxdmcp6 libxext6
  libxft2 libxmu6 libxpm4 libxrender1 libxt6 linux-image-3.2.0-4-amd64 linux-image-amd64 mc-data modsecurity-crs multiarch-support
  mysql-client-5.5 mysql-server-5.5 mysql-server-core-5.5 netpbm poppler-data psutils python-chardet python-debian python-debianbts
  python-fpconst python-soappy python2.7 python2.7-minimal rpcbind ttf-dejavu-core ufraw-batch unzip x11-common
The following packages will be upgraded:
  apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common apt apt-utils aptitude base-files bash bind9-host binutils
  bsdmainutils bzip2 ca-certificates console-setup coreutils cpp cpp-4.4 curl dmsetup dnsutils dpkg e2fslibs e2fsprogs exim4 exim4-base
  exim4-daemon-light file fwsnort g++ g++-4.4 gcc gcc-4.4 gcc-4.4-base gettext-base git grub-common grub-pc heirloom-mailx htop ifupdown info
  initramfs-tools initscripts iproute iptables iputils-ping keyboard-configuration klibc-utils less libacl1 libalgorithm-diff-xs-perl
  libapache-mod-security libapache2-mod-php5 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapt-pkg-perl libattr1 libauthen-pam-perl
  libbit-vector-perl libblkid1 libbsd0 libbz2-1.0 libc-bin libc-dev-bin libc6 libc6-dev libc6-i386 libcap2 libclamav6 libcomerr2 libcurl3
  libcurl3-gnutls libcwidget3 libdbd-mysql-perl libdbi-perl libdevmapper1.02.1 libedit2 libexpat1 libfreetype6 libgcc1 libgcrypt11 libgdbm3
  libglib2.0-0 libgnutls26 libgomp1 libgpg-error0 libgpgme11 libgpm2 libgssapi-krb5-2 libgssglue1 libgssrpc4 libhtml-parser-perl libidn11
  libio-pty-perl libiptables-chainmgr-perl libk5crypto3 libkeyutils1 libklibc libkrb5-3 libkrb5support0 libldap-2.4-2 liblocale-gettext-perl
  liblockfile1 libltdl7 liblua5.1-0 liblzo2-2 libmagic1 libmpfr4 libncurses5 libncursesw5 libnet-ssleay-perl libnewt0.52 libnfsidmap2
  libpam-modules libpam0g libpcap0.8 libpci3 libpcre3 libpkcs11-helper1 libpopt0 libreadline5 libreadline6 librpcsecgss3 libsasl2-2
  libsasl2-modules libselinux1 libsepol1 libsigc++-2.0-0c2a libslang2 libsqlite3-0 libss2 libssh2-1 libstdc++6 libstdc++6-4.4-dev libtasn1-3
  libtext-charwidth-perl libtext-iconv-perl libudev0 libunix-syslog-perl libusb-0.1-4 libuuid-perl libuuid1 libwrap0 libwww-perl libxapian22
  libxml2 libyaml-syck-perl linux-image-2.6-amd64 locales lsb-release man-db mc module-init-tools mount mutt mysql-common mysql-server nano
  ncurses-bin netbase nfs-common nmap ntp openssh-client openssh-server openssl openvpn passwd pciutils perl perl-base perl-modules php5
  php5-adodb php5-cli php5-common php5-mysql php5-tidy procps psad psmisc python python-apt python-minimal python-reportbug python2.6
  python2.6-minimal reportbug resolvconf rsync rsyslog s3cmd screen sgml-base sysvinit tasksel trickle udev util-linux vim-common vim-tiny
  w3m wget whiptail xml-core xz-utils zlib1g
210 upgraded, 175 newly installed, 8 to remove and 0 not upgraded.
Need to get 240 MB of archives.
After this operation, 352 MB of additional disk space will be used.
Do you want to continue [Y/n]?

7. Reboot

Use:

reboot

8. Check new system

Check new release:

lsb_release -a

The result must be something like this:

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 7.0 (wheezy)
Release:        7.0
Codename:       wheezy

Check new kernel:

uname -a

The result must be something like this:

Linux mos.medisign.gr 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux

If kernel has been not upgraded, check your current kernel, using

dpkg -l | grep linux-image

The more likely it is to have 2.6 kernel, so, in a 64bit system give the following command:

apt-get install linux-image-2.6-amd64

The result must be something like this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
firmware-linux-free linux-image-3.2.0-4-amd64 linux-image-amd64
Suggested packages:
linux-doc-3.2 debian-kernel-handbook
The following NEW packages will be installed:
firmware-linux-free linux-image-2.6-amd64 linux-image-3.2.0-4-amd64 linux-image-amd64
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.4 MB of archives.
After this operation, 108 MB of additional disk space will be used.
Do you want to continue [Y/n]? y

In a 32bit system

apt-get install linux-image-2.6-686

9. Install systemd (optional)

Use:

apt-get install systemd

Update grub and reboot

nano /etc/default/grub

Modify GRUB_CMDLINE_LINUX_DEFAULT adding init=/bin/systemd

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset init=/bin/systemd"

Finally

update-grub && reboot

Summary

Here is a summary of the steps to upgrade Squeeze to Wheezy:

  • Backup your system
  • Full system update apt-get update && apt-get -V upgrade
  • Replace “squeeze” with “wheezy” in /etc/apt/sources.list and update repositories apt-get update
  • Minimal system upgrade apt-get upgrade
  • Rest system upgrade apt-get dist-upgrade
  • Reboot
  • Check new release lsb_release -a and new kernel uname -a