A few years ago, the Raspberry Pi was introduced as a cheap single-board computer aimed at teaching the basics of computer science for students and in developing countries.
Although it doesn’t include peripherals like a case, keyboard or mouse, Raspberry Pi has become a hugely popular tool (partly thanks to its price, ranging from $5 to $35).
The processor speed for Raspberry Pi’s ranges from 700 MHz to 1.4 GHz, with on-board memory between 256 MB and 1 Gb RAM. It’s capable of HDMI or composite video, with a 3.5mm phono jack for audio and an 8P8C Ethernet port (on the B-model), Wi-Fi and Bluetooth.
The Raspberry Pi has seen several upgrades and iterations since its introduction in 2012 – variations have included changes and upgrades in peripheral device support and hardware, among other things.
One of the newer options includes third-party Ubuntu, Windows 10 Io% Core, RISC OS and Raspbian, which is a Debian-based Linux distribution that’s downloadable through the Raspberry Pi Foundation.
What Is Raspbian?
Put simply, Raspbian is an OS for Raspberry Pi, with several versions that include Raspbian Jessie and Raspbian Stretch. It’s optimized for the CPU of the Raspberry Pi and its limited processor speed and memory.
Raspbian’s website offers a zip file for installation, easily downloaded here.
For a newer Raspberry Pi with Hynix or a Samsung memory, it’s recommended that you replace the kernel and bootload that comes with the installer, and upgrade to a more recent version from the Raspberry Pi Foundation.
The SD media card that the installer uses to update Raspbian has a reputation for very slow performance. There are tens of thousands of small files that the installer needs to write to various locations in the root file system, and even a minimal installation of Raspbian on an SD card can take an hour and a half or more.
An installation that incorporates the Debian desktop environment, which has an additional 800 or so packages, can take more than 8 hours to complete, depending on the speed of the SD card. With this in mind, it’s advisable to install onto other media, such as a USB hard drive.
Installing Raspbian to USB Flash Drive or Hard Drive
- Make sure that the external drive is being detected by the installer – you will have to set up partitions manually
- You’ll need to keep the RasPi boot partition on the SD card
- You won’t be able to mount this partition as /boot – instead, mount the FAT32 partition as /rpiboot
- Post-install script will term this as /boot after installation
- Place any other partitions on an external drive
- The root partition block device needs a specific name – edit cmdline.txt kernel options to direct rootfs when installation is complete
Doing the Update
So, we know that it’s a good idea to update Raspbian software and keep it totally current, since bugs in older iterations of Raspbian can be the source of a lot of problems.
There are a couple of ways to perform these updates, some easier than others.
You’ll then be asked if you need to reboot – be sure your work is saved, and then answer Y for Yes.
Here’s another method for an update:
Enter these commands in this order, and wait for each of them to complete:
Sudo apt-get update
Sudo apt-get upgrade
Sudo apt-get update will bring all the package indexes up to date. This command won’t update any software on the Pi itself, but instead provides updates on where the latest software can be found for download.
“Update” needs a minute or two to work while it downloads the updated package lists.
Sudo apt-get upgrade is the command that actually initiates software upgrades on the Raspberry Pi. Usually it will inform you how many downloads are needed and how much space will be required, then it will ask you if you want to continue with the process.
Depending on how fast of an internet connection you have and how long ago your last upgrade was, this step can take several minutes or perhaps longer.
NOTE: On occasion, the packaged “raspberrypi-bootloader” will be part of the updates. This update includes new firmware for Raspberry Pi, replacing the existing kernel with a newer, more stable version.
“Rpi-update” can help you obtain the newest releases of the kernel and firmware, but it’s recommended that you avoid this command. If there’s a problem with the firmware, it can render your machine un-boot-able, with some consequences that can be difficult to fix.
Sudo reboot is what reboots the machine, letting you restart with all-new firmware. You’ll need to reboot the machine to finalize the update and bring everything all the way up to speed.
Upgrading from Raspberry Pi Jessie to Raspbian Stretch 9
This upgrade is a fairly simple process, but you’ll still need to use caution. The fewer third-party packages and services you install, the better the chances are that you’ll be able to successfully upgrade your Raspbian Linux system and get updates.
On the other hand, if you go too far with third-party packages, there’s a chance of breaking the entire system.
NOTE: The default SQL database in Debian 9 Stretch is now MariaDB. It features a new database binary data file format, which isn’t fully compatible with you’re the Debian 8 Jessie format.
Databases will be automatically upgraded during this process, but you will not be able to revert back should you run into any problems during the upgrade or after. That’s why it’s crucial for you to back up any current databases before going any farther with a Debian 9 Stretch upgrade.
Begin Your Upgrade
These are the first steps for a Stretch package to update your Raspbian system:
# apt-get update
To upgrade any held-back packages:
# apt-get dist-upgrade
Now, check for any system issues and perform a database consistency check. This should find any missing, obsolete or partly-installed packages:
# dpkg -C
Now, you can check for any packages that are held back:
# apt-mark showhold
Any packages “on hold” will not upgrade, and in fact might cause inconsistencies after the upgrade to Stretch. It’s recommended to fix any issues that are brought to light by these commands before moving ahead.
Now, you can upgrade the package depository to include any new Stretch repositories:
# sed -i ‘s/jessie/stretch/g’ /etc/apt/sources.list
This command will enable new Stretch repositories by replacing any Jessie keyword occurrences. When your /etc/apt/sources.list is fully updated to include Stretch repositories, your local package indes can be updated with:
#apt -get update
To do a dry run of the upgrade, enter the command:
# apt-get – simulate upgrade
Now it’s time to start on the actual Jessie upgrade to update Raspbian. You may see this message:
There are services installed on your system which will need to be restarted when certain libraries, such as libpam, libc and libssl, are upgraded. Since these restarts may cause interruptions of service for the system, you will normally be prompted on each upgrade for the list of services you wish to restart.
You can choose this option to avoid being prompted; instead, all necessary restarts will be done for you automatically, so you can avoid being asked questions on each library upgrade.
This message, in other words, gives you the choice of restarting the services automatically while the system is upgraded, restarting them manually or waiting until after the system upgrade to Stretch is fully completed.
Ready? These commands will execute the Debian Stretch upgrade process:
# apt-get upgrade
# apt-get dist-upgrade
Now You Know How to Update Raspbian
That’s it! Reboot your system and you’ll be completely upgraded.
We hope that this step-by-step guide helps you understand and enjoy Raspbian even more.