Automating Debian Updates with Unattended Upgrades

The gist of automating the update of a Debian operating system is to use the package unattended-upgrades.

I added the package using

apt install unattendedupgrades

Having previously worked disabling unattended updates I once again reviewed the details within that article to see where I had turned off its actions.

Based on these settings I could make an initial check to see whether the anticipated files 20auto-upgrades and 50unattended-upgrades had been added to the directory /etc/apt/apt.conf.d

Both were present and 20auto-upgrades had both entries set to 1:

APT::Periodic::Update-Package-Lists "1";

APT::Periodic::Unattended-Upgrade "1";

The above can be automatically added using the command

dpkg-reconfigure -plow unattended-upgrades

Within the file 50unattended-upgrades I edited the entries to define the source. By default update is commented.

The operation can be tested using

unattended-upgrades –dry-run –debug

Note I had also added this prior to making an update. Therefore a number of updates would be available and I could expect these to be in the log file at /var/log/apt/history.log

I checked the most recent entries using

tail -f /var/log/apt/history.log

Finding nothing there I left the computer a day before checking the available updates once more.

No updates were available and there were appropriate entries in the log file confirming that the updates were occurring. Just to be sure I confirmed the availability of updates on another computer.

I also set an email address to be notified of the updates. You may require an email package such as ssmtp.