The era of waiting for a blue screen and manually installing security updates is over, at least for Linux users. Using the UnattendedUpgrade package, our devices can install security and other importand upgrades automatically!

In order to install the UnattendedUpgrade along with the apt-listchanges package, we use the following command. The apt-listchanges package will report what has been changed during an upgrade.

apt update -y && apt install unattended-upgrades apt-listchanges -y

Next, we want to make sure that the right packages are upgraded using the command below.

nano /etc/apt/apt.conf.d/50unattended-upgrades

This file should contain at least these contents.

Unattended-Upgrade::Origins-Pattern {
    Unattended-Upgrade::Mail "root";

Next, we use the following command to create and populate the required configuration file.

dpkg-reconfigure -plow unattended-upgrades

Use the following command to check this file's contents.

nano /etc/apt/apt.conf.d/20auto-upgrades

Check whether these first two lines have been added, and add optionally you might want to add the last line APT::Periodic::Verbose "2"; to make reports verbose.

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::Verbose "2";

Next, inspect the following file for list change notification.

nano /etc/apt/listchanges.conf

Make sure these notifications will be sent to the user root.


Finally, you may want to run unattended-upgrades manually to check if your configuration is working:

unattended-upgrade -d

That's it, your device will now automatically grab the latest security and other update! 🎉

Post image by Steve Kotecki