Updating your Raspberry Pi

27.01.2017


Operating Systems: Debian-based Linux
Language: bash / shell
Last Edit: 27.01.2017 - 17:50


Getting Started


Connect to your Raspberry Pi/Debian-based Linux system via ssh using PuTTY (Windows) or a similar program (link can be found in the links section), or, if you are running a desktop linux just open a command window. There are many ways to update a Linux system. We will use the apt-get command line tool to update our packages.



What are packages


On Raspbian and other Debian-based Linux systems you download and install software bundled and compressed into packages. Those packages will be updated from time to time by their creators. So the first thing we need to do now is to update the package lists.



Updating package lists


You need root privileges to update software on your system.
On a Raspbian system you will be in the sudoers list by default. This enables us to use the sudo command like shown below.


sudo apt-get update

sudo allows us to run programs with root privileges without becoming the root user. If you are not using Raspbian, just become root by entering:


su -

After you entered the root password you can now execute the apt-get update command without the sudo prefix. Keep that in mind for the next command as well.



Upgrading packages


Next we will invoke the upgrade command, which will then upgrade all installed packages for which a new version is available.


sudo apt-get upgrade

apt-get will then display all the packages it can upgrade, with information about additional required disk space for the download and a confirmation check if you want to proceed.


After responding with "y" it will upgrade the packages.


Additional Information


You may have noticed in the screenshot that some packages have been marked as kept-back packages. Those are packages which have upgrades available, but whose dependencies may have changed. You could force them to upgrade with the command apt-get dist-upgrade but I highly recommend against it as it may leave your system in a broken state with changed or even removed and thus missing dependencies. Imagine a dist-upgrade like upgrading from Ubuntu 12.04 to Ubuntu 14.04. You should do so by using the official upgrade process and not by using dist-upgrade.