Language: EN

actualizar-version-raspbian-raspberry-pi

How to update the version of Raspbian on Raspberry Pi

In this post we are going to see how to update the version of Raspbian installed on our Raspberry Pi, when a new version of the operating system is available.

For this, we will use the APT tool, as we saw in the previous post on How to install and update programs with APT.

In fact, the process to update the version of Raspbian is very similar to the normal package update. Only, to update Raspbian, we will use the following instruction:

sudo apt-get -y dist-upgrade

This command performs the same actions as ‘upgrade’, that is, it updates the installed packages to the latest version. But, additionally, ‘dist-upgrade’ is also able to add uninstalled packages or remove obsolete ones.

So, essentially, after updating the version of Raspbian with ‘dist-upgrade’ we will have the system practically the same as if we downloaded and installed the new version of Raspbian from scratch, but keeping our data.

The only difference is the additional packages (extra programs, etc…) that have been included in the new version of Raspbian, which obviously will not be updated because we never had them installed.

If we are interested in these packages we will have to install them manually. Fortunately, in general, we will not be interested in these packages.

Update Raspbian

Let’s see the complete process to update Raspbian. First, we verify the current version with the following command:

uname -a

Next, we run the following commands to update the version of Raspbian:

sudo apt-get -y update
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
sudo apt-get autoclean
sudo reboot

With this we are updating all the system packages, then we clean the local package repository, and finally, we restart the Raspberry Pi.

The complete update process can be long, even costing an hour or two. For this reason we have used the ‘-y’ parameter, which prevents the commands from asking if we want to continue, and the process stops because it is waiting for us to say yes.

Once the update process is finished and the Raspberry Pi has restarted, we check the version of Raspbian installed again with:

uname -a

Ensuring that, indeed, the version of Raspbian has been successfully updated.

Install Experimental Kernel

Additionally, it is possible to update the installed Raspbian version to the latest available version (including unstable ones) of Raspbian with the following command:

rpi-update

Although at first glance this may seem like the “normal” command, it is very important to emphasize that this command installs the latest version of Raspbian available, including the unstable test versions. Therefore, in general, it is not recommended to use this command to update Raspbian or we can turn our Raspberry Pi into a brick, and have to reinstall everything from scratch.

Recover Original Firmware

If at any time you have tried to update Raspbian, and have had the bad luck to have an error, as long as we can start a command console, we can recover the original firmware with the following command:

sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel

If this does not work, you know, brick. We will have to reinstall the operating system from scratch and start over from the beginning.