75

How can I perform an upgrade from Raspbian Wheezy to Jessie?

Fragmentation Needed
  • 1,362
  • 1
  • 10
  • 12

7 Answers7

82

How brave do you feel? It's safest to make a fresh install on a new SD card.

The braver way I'd use is:

  1. Backup any files which are important to you.

  2. With your new or existing install.

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    

    to make sure wheezy is fully up to date.

  3. Edit /etc/apt/sources.list and change wheezy to jessie. There may also be files in /etc/apt/sources.list.d/ that also need updating, to replace wheezy with jessie.

  4. Then update and upgrade again

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    
X-Cubed
  • 103
  • 4
joan
  • 71,024
  • 5
  • 73
  • 106
  • 3
    With Jessie now officially out, and running on my desktop, is this still the correct answer for my Raspbian Wheezy Pi? – Wayfaring Stranger May 01 '15 at 19:14
  • 2
    It's still a reasonable approach and is what I would do and have done. Fragmentation Needed points out that there are other source repositories you might want to update at the same time. In the past I've removed those repositories as I don't use their software. – joan May 01 '15 at 19:26
  • 2
    @Wayfaring Stranger The raspbian images have not been updated to jessie so far, so this is still the way to go. Unfortunately. – Fragmentation Needed May 05 '15 at 12:09
  • @FragmentationNeeded I tried it. It does work, but is slow to start up and leaves some defaults, such as web browser choice pointed to nonfunctional Apps. If I was willing to beat on it hard, I'm sure I could bend the UI into proper shape, but then the raspbian images will just come out... I've gone back to officially stable Raspbian wheezy so as to work problems out of my barometer App without having to wonder if it's some custom-Jessie-install-weirdness that's making things buggy. – Wayfaring Stranger May 05 '15 at 12:19
  • @Warfaring Stranger Using the RasPi as console-only I encountered no issues by upgrading to Jessie. However, I'll do a fresh install after the official images get available. Just to compare them with the upgraded install. – Fragmentation Needed May 05 '15 at 12:23
  • It's probably just GUI troubles, but coming from OS-X-land, I LIKE GUI. – Wayfaring Stranger May 05 '15 at 13:28
  • By the way: the Foundation discourages updates to Jessie, one shall install Jessie right away. – Fragmentation Needed Oct 05 '15 at 18:42
  • 2
    why upgrade then dist-upgrade? – Jaromanda X Nov 21 '15 at 09:27
  • 4
    @JaromandaX To try to minimise the amount of packages to be updated at any one time and to try to keep the system in a stable state. At the end of the upgrade you should have the earlier version at its most up to date stable release. That seems (to me) to be the best start point for an upgrade to a later release. – joan Nov 21 '15 at 10:29
  • @joan - I'm confused, because it's upgrade then dist-upgrade before changing to jessie, then it's upgrade then dist-upgrade again for jessie. I'm in the middle of doing it now, I was just wondering if there was a reason not to do dist-upgrade only – Jaromanda X Nov 21 '15 at 10:31
  • @JaromandaX upgrade and dist-upgrade do slightly different things. It's not the case that the dist-upgrade updates from, say, wheezy to jessie. See apt-get, i.e. man apt-get, for a description. – joan Nov 21 '15 at 11:36
  • @joan I did read the man page, I was hoping for some further insight. It's no big deal, all instructions say the same thing, I was just curious – Jaromanda X Nov 21 '15 at 11:38
  • @JaromandaX dist-upgrade will try to do some smart dependency resolving stuff. It may also remove packages. upgrade will try to just bring packages to the newest version without any further magic. You want to use both in the above shown order to quickly get your system up to date and then assist you in resolving any remaining issues AND get rid of packages that are not needed any more. (at least that's what I think its for). – Fragmentation Needed Jan 03 '16 at 19:12
  • This worked for me with a headless RPi. The only issue I found was with the static IP. It was falling to dhcp so I had to re-create /etc/network/interfaces. The config I used in wheezy was not being picked by jessie for some reason. – ppvi Jan 05 '16 at 11:55
  • 1
    Following this answer, I noticed old Wheezy kernel image was kept (Linux version 3.18) instead of the new one from Jessie (version 4.1). How can I update the kernel, too? – lvella Apr 27 '16 at 04:58
39

I hope this may help others in the next time: Basically, an upgrade works like this:

  1. adjusting the sources to "jessie"
  2. update the package lists and upgrade the packages

adjusting the sources

  • You can either simply replace every "wheezy" in /etc/apt/sources.list (and /etc/apt/sources.list.d/*) with "jessie"
  • Or you use sed to do the work for you:

    sudo sed -i /deb/s/wheezy/jessie/g /etc/apt/sources.list
    sudo sed -i /deb/s/wheezy/jessie/g /etc/apt/sources.list.d/*.list
    

update the package lists

This may take quite a while, since everything has to be downloaded and all dependencies need to be rebuilt. Also, the upgrade and dist-upgrade parts require some interaction:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
Fragmentation Needed
  • 1,362
  • 1
  • 10
  • 12
  • There is a repository here that seems not to have been updated lately and that does not contain any jessie packages: /etc/apt/sources.list.d/raspi.list – Fragmentation Needed Feb 20 '15 at 11:45
  • 2
    I used this procedure to update Wheezy (In Nov 2015) to Jessie. As written, it performed an incomplete upgrade. Adding deb http://archive.raspberrypi.org/debian/ jessie main ui to /etc/apt/sources.list.d/raspi.list and again running apt-get update/upgrade solved the problem. – bobthechemist Nov 07 '15 at 14:49
  • The modification I mention above solved a problem with the menus in raspi-config not being updated (preventing the ability to boot to console) and installing wolfram/Mathematica. – bobthechemist Nov 07 '15 at 14:51
  • Although this isn't the recommended way of doing things, this is the one that worked for me. – FaCE Apr 09 '20 at 11:22
8
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo sed -i /deb/s/wheezy/jessie/g /etc/apt/sources.list
sudo sed -i /deb/s/wheezy/jessie/g /etc/apt/sources.list.d/*.list
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

There may be an error after upgrade. Make sure you press N, not Y on prompts related to systemd, lightdm, dbus and other booting related things(Doesn't matter on other programs you can press y) on dist-upgrade to jessie.

7

Just an addition for users that could land here looking for the upgrade procedure, like me!

On the official Raspberry Pi website the update from Wheezy to Jessie is discouraged. Instead they recommend to make a clean Jessie install.

From https://www.raspberrypi.org/blog/raspbian-jessie-is-here/:

Starting with a clean image is the recommended way to move to Jessie. If you really need to update a Wheezy image, we have tried an unsupported upgrade path which is documented on the forums here. This has been shown to work on a vanilla Wheezy image, but we can’t predict what effect it may have on any packages or data that you have installed, so this is very much at your own risk.

And for those who are brave, this is the forum post where all the passages for the update are explained.

https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=121880

Cheshire Cat
  • 203
  • 3
  • 9
1

On my raspberry Pi2, after each upgrade, the login service failed, preventing to logon locally. Fortunately I was able to logon remotely through SSH.

Based on my investigation, I found an issue with the dbus service which didn't start anymore after the upgrade.

The workaround I used:

  1. Reinstall the RaspBian
  2. Remove the dbus service ==> apt-get remove dbus
  3. Upgrade to Jessie

Hope it helps.

Ghanima
  • 15,855
  • 15
  • 61
  • 119
Olivier C
  • 11
  • 1
1

I found this thread in a Google search. I'm adding my "answer" in case there are others, like myself, still wandering in the wilderness with a now very old, and probably insecure, version of Raspbian. Here goes:

I followed the approach given by Bex (over 3 years ago now!), and it worked :) I did have a minor issue with some failed dependencies at one point, but was able to resolve those by following the suggestions offered in the error message from Raspbian.

All of that said, I feel the "best" approach for most people will be to follow the recommendations in Raspberry Pi's forums, and do a clean install. I've not experienced any issues yet, but my RPI is mostly "stock", being used for the odd experiment now and again. There may still be issues lurking somewhere in my system.

Subsequent to Bex's post, this was posted in the RPI forums:

How to upgrade a Wheezy image to Jessie (both defunct and replaced versions of Raspbian)

And so for anyone who stumbles across this thread while searching for a formula to use in upgrading, I respectfully submit this is the "best" answer.

Seamus
  • 21,900
  • 3
  • 33
  • 70
0

Cause I'm too lazy and just want to copy'n'paste from now on - the same for Jessie to Stretch:

  1. Update before and clean up

    sudo apt update
    sudo apt full-upgrade
    sudo apt autoremove
    
  2. Adjust the repository sources:

    sudo sed -i /deb/s/jessie/stretch/g /etc/apt/sources.list
    sudo sed -i /deb/s/jessie/stretch/g /etc/apt/sources.list.d/*.list
    
  3. Upgrade

    sudo apt update
    sudo apt upgrade
    sudo apt full-upgrade
    
Fragmentation Needed
  • 1,362
  • 1
  • 10
  • 12