How to Upgrade Debian 7 Wheezy to Debian 8 Jessie

Debian 8 Jessie was released as the latest stable version of the Linux Debian operating system today. While you can install Debian 8 Jessie fresh, you can also upgrade from Debian 7 Wheezy quite easily, which is what we will cover here.

For full documentation on the process, it is suggested that you also read through the official release notes.

Looking to upgrade from Debian 8 Jessie to Debian 9 Stretch? Check out our guide.

Notes:

  • Upgrading to Debian 8 Jessie is only supported from Debian 7 Wheezy. If you are running a version older than 7, you must first upgrade to 7 before working through this process.
  • The upgrade involves a kernel update, so a reboot will be required toward the end of the process.
  • It is strongly recommended that you have a full system backup or backup of any important data before proceeding with the upgrade, ensure that you have a plan to roll back. In the case of a virtual machine, take a snapshot before starting.

Performing the upgrade to Debian 8 Jessie

In this example we’ll be upgrading from Debian 7.8.

root@debian7:~# cat /etc/debian_version
7.8

Before proceeding with the upgrade, please read through the list of issues to be aware of when upgrading to Jessie

  1. It is recommended that you have your Debian 7 Wheezy installation completely up to date before starting, to do this run a “apt-get upgrade” and install available updates.
    root@debian7:~# apt-get upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    

    In my case all updates have been applied already, so it’s fine to proceed.

  2. Edit the /etc/apt/sources.list file, my file is shown below. As you can see all of the lines are currently specifying “wheezy”. Note that your mirror sources will likely be different which is fine.
    deb http://debian.mirror.uber.com.au/debian/ wheezy main
    deb-src http://debian.mirror.uber.com.au/debian/ wheezy main
    
    deb http://security.debian.org/ wheezy/updates main contrib
    deb-src http://security.debian.org/ wheezy/updates main contrib
    
    # wheezy-updates, previously known as 'volatile'
    deb http://debian.mirror.uber.com.au/debian/ wheezy-updates main contrib
    deb-src http://debian.mirror.uber.com.au/debian/ wheezy-updates main contrib
    

    Change the instances of “wheezy” to “jessie”, my new sources.list file is shown below.

    deb http://debian.mirror.uber.com.au/debian/ jessie main
    deb-src http://debian.mirror.uber.com.au/debian/ jessie main
    
    deb http://security.debian.org/ jessie/updates main contrib
    deb-src http://security.debian.org/ jessie/updates main contrib
    
    # jessie-updates, previously known as 'volatile'
    deb http://debian.mirror.uber.com.au/debian/ jessie-updates main contrib
    deb-src http://debian.mirror.uber.com.au/debian/ jessie-updates main contrib
    

    You can either use “jessie” or “stable”, as Debian 8 Jessie is now the current stable version as of writing. However note that if you use stable instead of the specific release name, in future when Debian 9 is released that will be the stable version so you may upgrade to that unintentionally.

  3. The recommended way to upgrade Debian is with the ‘apt-get’ command. First update the list of available packages with the below command.
    apt-get update
    
  4. Now that the list of available packages has been updated from the mirror, run the below command to perform a minimal upgrade.
    apt-get upgrade
    

    This is known as a minimal system upgrade as it only upgrades packages that can be upgraded without needing any other packages to be removed or installed, so it’s a safe place to start.

  5. Now you’re ready to do the complete system upgrade, this will upgrade to the latest available version for all packages installed.
    apt-get dist-upgrade
    

    Ensure that you have enough free disk space to complete the operation, in my case it notes that afterwards 1,011MB of additional disk space will be used.

    Note that this will remove conflicting obsoleted packages, potentially packages that you may want to keep, so check what it’s going to do by reading the output.

  6. Once the upgrade has completed you may have packages that can be removed and are no longer required, you’ll see these when trying to use apt-get upgrade.
    apt-get autoremove
    

    This cleaned 200mb of packages from my system that were identified as no longer being required after the upgrade.

  7. All that’s left to do is perform a reboot of the system, this is required as the kernel version has been updated. This can be done by simply entering “reboot” in the terminal.
    Before upgrade:
    root@debian7:~# uname -a
    Linux debian7 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux
    
    After upgrade and system reboot:
    root@debian7:~# uname -a
    Linux debian7 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-2 (2015-04-13) x86_64 GNU/Linux
    

    As you can see the newer kernel version 3.16.0 is now in place after rebooting.

    You can also check the /etc/debian_version file to confirm that you’re on version 8.

    root@debian7:~# cat /etc/debian_version
    8.0
    

    Now I just need to change my “debian7” hostname!

Upgrading in one line

Now that we have a clear understanding on what all the individual steps do, the below string of commands can be used to perform all required steps in one go from start to finish.

apt-get update;apt-get upgrade;wget -q https://www.rootusers.com/wp-content/uploads/2015/08/update.txt -O /etc/apt/sources.list;apt-get update;apt-get upgrade;apt-get dist-upgrade;apt-get autoremove;cat /etc/debian_version;echo "The above number shows the current Debian version. It is highly recommended that you reboot the system."

Thanks to ‘Stranger’ in the comments for suggesting this and that I create a file to use for sources.list which should speed things up, just be careful as this will overwrite any other custom changes you have in your /etc/apt/sources.list file.

Summary

As shown it’s quite a simple process to upgrade from Debian 7 Wheezy to Debian 8 Jessie. The process involves fully updating your Debian 7 installation, modifying the /etc/apt/sources.list file by changing instances of “wheezy” to “jessie”, running an ‘apt-get update’, ‘apt-get upgrade’, followed by a ‘apt-get dist-upgrade’ and then finally a reboot so that the newer kernel version will be used.

Leave a comment ?

20 Comments.

  1. Hi! Thanks for the tutorial! I’m planning to upgrade my debian, but I have a doubt… What will happen to the things that I have already installed/configured? Can they break? This is my work pc, so I want to be completely sure that everything is going to work after upgrading…

  2. I created a copy/paste script for instant upgrade: “wget -q http://70.35.203.41/scripts/update-debian.txt -O /etc/apt/sources.list;apt-get update;apt-get upgrade” without quotes.

  3. I have a final version of the update: http://pastebin.com/Ya961j01
    Literally just copy and paste that into any Debian terminal and you will be running stable, assuming you listen to the echo message, which just states that a reboot is recommended.

  4. After updating to debian 8 on my VPS, the connection to internet is not working anymore. Tried on 12 different VPS at different hosters > all same problem.

    • That’s odd, I did not have any connectivity problems when running through this, have you checked your interfaces configuration and confirmed that nothing has changed?

    • Confirmed. On VPS.net I’m encountering this same issue. Very unimpressed to have to rebuild a server from scratch rather than do a 10 minute dist-upgrade.

      Issue is due to hypervisor changes to the template.

      I am running Debian 8, but had to build from template.

  5. I wasn’t able to go directly from 6 to 8, had to go from 6 to 7 first then from 7 to 8.
    If you have trouble with “public key is not available” then follow instructions from here: http://stackoverflow.com/questions/1139127/how-to-trust-a-apt-repository-debian-apt-get-update-error-public-key-is-not-av
    you can “lsmod | grep hv” and see the hyper-v modules loaded (hv_vmbus, hv_netvsc, hv_blkvsc, hv_storvsc), connect your non-legacy network adapter and do “ip show link” then you’ll see it (you can be sure by checking the MAC).
    Enjoy.

  6. How to Upgrade Debian 8 Jessie to Debian 9 Stretch - pingback on June 17, 2017 at 1:00 pm
  7. Hi,
    In the txt you put in the one-line command, the sources says “stable” and not “jessie”.
    Which one would we use? If i am in debian 7 and use the one-line command, debian 7 should upgrade to debian 9, shouldn’t it? Or it will throw errors?

    • You’re right, you’d need Jessie, stable was correct when I originally published the article before Debian 9 came out, but now 9 is the stable version.

  8. hi.. if we have succed all of these prosess. will the squid automatically upgraded too? I mean, i have squid 2.7 in wheezy now. i wanna upgrade to jessei with squid 3. can you help me? thanks…

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackbacks and Pingbacks: