One of the biggest steps you can take to ensure your security online is to keep the software on your devices up to date and install any software updates that come out. This advice doesn’t just apply to your computers and phones, but also internet of things devices like a Raspberry Pi or BeagleBone Black. Luckily this is an easy process with the help of one important software package.
In Raspbian and other Debian-based Linux systems, the unattended-upgrades
package automates the process of downloading and installing software updates on your system. You can configure it to either download only security updates or also download general software updates and it will run silently in the background keeping your software up to date. Here’s how to install it on a Raspberry Pi.
Installing unattended-upgrades
We’ll be working from the terminal, so start a shell if you aren’t already working from the command line.
To install unattended-upgrades on your system, all you need to do is install it using apt:
sudo apt-get update
sudo apt-get install unattended-upgrades
These commands will install unattended-upgrades, but it still needs to be tested and enabled before it can be used.
Testing unattended-upgrades
Once you’ve installed unattended-upgrades, it’s a good idea to test that everything is working using a dry run. This will check for software which can be updated but will stop short of actually downloading and installing any updates.
To trigger a dry run, type the following:
sudo unattended-upgrade -d -v --dry-run
In the output, you’ll see your system connect to the package servers, download the latest versions of all your packages, and then if updates are available for your system they’ll be listed here. The most important thing to look for is the absence of any errors. If you’re getting errors now, you’ll need to diagnose what’s preventing this from working before proceeding.
Enabling unattended-upgrades
Lastly, to enable unattended-upgrades so it automatically runs on your system, type:
sudo dpkg-reconfigure --priority=low unattended-upgrades
You’ll be presented with a confirmation screen that you want to enable automatic software updates. Select Yes
to proceed.
After that you’re good to go.
From now on your Raspberry Pi will automatically download and install the latest software updates as they become available.
Thank you! I have been looking for this for the six months since I set up my first pi for HomeGenie. I want this pie to do everything without interference on a non stop basis. Now to setup automatic reboot.
Thanks for this. Is there a way you can create a video which shows us how we can get an email when a pi has been updated?
Dunno if it’s polite to link to a different blog, but I found the mail function here:
https://www.zealfortechnology.com/2018/08/configure-unattended-upgrades-on-raspberry-pi.html
Best and simple explanation how to get this working. Like a charm, THANX!
Thank you. As a recent convert to pi, I truely appreciate the directions.
Thanks 😊