/Raspbian

Upgrade Raspbian from Jessie to Stretch

It's recommended to download a fresh image of Raspbian Stretch from official Raspbian website, but if for whatever reason you don't want to do that, you can still upgrade from Jessie to Stretch.

1. Disk space

Check available disk space and make sure you have at least 1.5GB of free space.

df -h

2. Update current system

Before upgrading, make sure all your packages are up to date.

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

3. Update package lists

Update your package lists to use Stretch repositories. In both below files, change every occurrence of the word ‘jessie’ to ‘stretch’.

vim.tiny /etc/apt/sources.list
vim.tiny /etc/apt/sources.list.d/raspi.list

4. Update packages

Be aware this may take a while, depending on your internet connection and available resources. I'd say, around two hours.

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

During installation, you'll be asked to confirm changes to configuration files. I suggest pressing D to see differences and then following with Y or N to accept or reject changes.
Especially when it comes to configuration file /etc/dhcpcd.conf be sure you don't loose your static IP address configuration if you had one set up.

5. Clean up after yourself

Below will remove no longer needed packages and save you up some disk space. In my case it was 1GB.

sudo apt-get autoremove
sudo apt-get autoclean