27 January 2018

Setting up Raspbian OS full unattended updates

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.
sudo apt-get install unattended-upgrades

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";

Now run the following command to test it:
sudo unattended-upgrades -d

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";

To ensure that the service is enabled and operational run:
service unattended-upgrades status

No comments: