Gmail Filters for unattended-upgrades Reboots

I’m a big fan of Ubuntu & Debian’s unattended-upgrades package. I can install and configure it to automatically update packages and email me results every night. Sure, I’m aware of and can immediately address the high-profile security bulletins & fixes. But what about the more subtle, less severe problems? No worries! unattended-upgrades will take care of them for me automatically… except it’s a little spammy. Here’s how I’ve wrangled Gmail to help me out.

When does unattended-upgrades email me?

Right now I have unattended-upgrades configured to email me whenever it installs a security update. I do not want to be alerted when an update is applied that does not require my attention. But I do want to be alerted when I need to manually reboot the system to finish a package installation. Sadly, I’m unaware of how to directly configure it only for this case.

Gmail filters to the rescue.

Of course, one of Gmail’s key features is helping separate the signal from the noise. In this case, since the unattended-upgrades emails are not spam or phishing, I’m not going to use Gmail’s spam or phishing features. Instead I’ll use filters.

Here are my needs:

  • I do want unattended-upgrades to automatically install new security updates.
  • I do not want to know about updates that do not require human intervention.
  • I do want to know when an upgrade does need my attention—namely, to reboot the system.

It’s taken me about a year to get my Gmail filters configured just right such that they meet the above needs. Below is the configuration I ended up with, along with images of how it looks on my screen.

  • From: the email address emails are coming from. In my case, this is [email protected].
  • Subject: unattended-upgrades -{‘reboot required’}
  • Don’t include chats: checked
  • Skip the Inbox (Archive it): checked
  • All other fields are blank or unchecked.

Page 1 of Gmail filter configuration.
Page 1 of Gmail filter configuration. Image credit : me.

Page 2 of Gmail filter configuration.
Page 2 of Gmail filter configuration. Image credit : me.

The Subject field is what took me a lot of trial & error to figure out – as I made changes, I needed to wait for the next set of emails, at an unspecified time in the future, to find out if my changes worked.

Better testing next time?

I have some ideas for how to better test Gmail filter the next time I need to deal with it. What have you done? How have you tested your filters? What works and what doesn’t?

I hope this post has helped future searchers find a quicker route to filtered unattended-upgrades emails. Enjoy!