Just a quick note to self for the future. The instructions in this post will set-up automatic update of all packages (as opposed to security-only). It has been tested on Raspbian Stretch.

Install Unattended Upgrades Link to heading

sudo apt-get install unattended-upgrades

Configure Origins Pattern Link to heading

As root, edit /etc/apt/apt.conf.d/50unattended-upgrades and add the lines below to the Unattended-Upgrade::Origins-Pattern section:

Unattended-Upgrade::Origins-Pattern {
  "origin=Raspbian,codename=${distro_codename},label=Raspbian";
  "origin=Raspberry Pi Foundation,archive=stable";
};

Test the Configuration Link to heading

Now run the following command to test it:

sudo unattended-upgrades -d

Optional Additional Settings Link to heading

Also consider changing the following lines in 50unattended-upgrades, which includes removing unused packages and rebooting automatically regardless of logged in users at a set time if needed, e.g. after a kernel upgrade:

Unattended-Upgrade::Remove-Unused-Dependencies "true";

Unattended-Upgrade::Automatic-Reboot "true";

Unattended-Upgrade::Automatic-Reboot-WithUsers "true";

Unattended-Upgrade::Automatic-Reboot-Time "06:30";

Verify Service Status Link to heading

To ensure that the service is enabled and operational run:

sudo systemctl status unattended-upgrades

Originally published at https://jensenmo.blogspot.com/2018/01/setting-up-raspbian-unattended-updates.html