Sometimes it's useful to be able to set up a computer and simply leave it, content in the knowledge that it will update automatically. I've found this to be particularly helpful in my Raspberry Pi based appliance-like projects that, once set up, I rarely want to think about again.

On Debian based systems and, by extension, Raspberry Pi OS (Raspbian), this can be achieved using Unattended Upgrades. There are many helpful guides explaining how to enable Unattended Upgrades (this one from TechnoZeal forms the basis of this post), but most focus solely on enabling security and critical updates. There are good reasons to minimise exposure to non-critical updates, but sometimes you just want everything. This post describes how to achieve exactly that.

  1. Install Unattended Upgrades:

    sudo apt update
    sudo apt upgrade --yes
    sudo apt install unattended-upgrades
    
  2. Ensure you receive all updates by editing the relevant configuration file (sudo nano /etc/apt/apt.conf.d/50unattended-upgrades) and amending (or adding) the following section1:

    Unattended-Upgrade::Origins-Pattern {
       "origin=*";
    }
    

    This ensures that Unattended Upgrades will consider packages from all sources, including any third-party repositories you have added.

  3. Update the schedule (sudo nano /etc/apt/apt.conf.d/20auto-upgrades), adding the following tasks:

    APT::Periodic::Update-Package-Lists "1";
    APT::Periodic::Download-Upgradeable-Packages "1";
    APT::Periodic::Unattended-Upgrade "1";
    APT::Periodic::Verbose "1";
    APT::Periodic::AutocleanInterval "7";
    
  4. Enable Unattended Upgrades:

    sudo dpkg-reconfigure --priority=low unattended-upgrades
    

Having set up Unattended Upgrades, you can check that everything is behaving correctly by performing a dry run:

sudo unattended-upgrade -v --dry-run

Thanks to TechnoZeal for the original post.


  1. Ubuntu-based systems use the Unattended-Upgrade::Allowed-Origins section in preference to Unattended-Upgrade::Origins-Pattern so you will need to add this section in its entirety. Thankfully the two sections work together, so you don't need to change anything else in the file.