Automatic updates, maintenance window, e-mail notifications

The John Smith Ltd appliance must stay up to date without anyone having to remember: Debian's security fixes, new versions of Argos, the inspection engine. The workshop, though, also works in the…

Situation

The John Smith Ltd appliance must stay up to date without anyone having to remember: Debian’s security fixes, new versions of Argos, the inspection engine. The workshop, though, also works in the evening, and a reboot cannot happen at eleven in the morning. Laura White, the IT administrator, wants:

  • updates installed every night, at 03:10;
  • an automatic reboot, when an update requires one, at 03:30;
  • an e-mail to it@johnsmith.test every time a run installs something or fails;
  • the option to update at once, by hand, when an urgent fix comes out.

For the technician The updates are installed by unattended-upgrades, Debian’s standard component. Argos writes its configuration (the drop-ins /etc/apt/apt.conf.d/20auto-upgrades and 52argos-unattended-upgrades, plus two drop-ins for apt’s timers) and does not keep it in argos.json. The list of allowed origins includes those Debian allows by default (stable and security updates), the EDON repository (so Argos updates itself) and Debian backports, from which the inspection engine’s Suricata 8 comes. Nothing else is installed from backports: the archive is NotAutomatic, and only the packages taken from there are upgraded.

What you need

  • A console account, from the office LAN.
  • The details of the outgoing mail server (the SMTP relay) the appliance can send through: in the example smtp.johnsmith.test, port 587 with STARTTLS, user argos@johnsmith.test with its password.
  • The time when a reboot of a few minutes disturbs nobody.

Steps

The relay for e-mails

Without a relay the appliance sends nothing: neither the update report nor the other notices (certificates about to expire, failed renewals). An appliance has no mail server of its own.

  1. Open System → E-mail notifications.

  2. Switch on “Send notifications”.

  3. Fill in:

    • “Relay host”: smtp.johnsmith.test;
    • “Port”: 587;
    • “Security”: “STARTTLS (587)”;
    • switch on “Authenticate with username and password”, then “Username” argos@johnsmith.test and “Password”;
    • “Sender”: argos@johnsmith.test;
    • “Recipients”: it@johnsmith.test (one address per line).
  4. Press “Send test e-mail”. The test uses the values you typed, even if you have not saved them yet. “Test e-mail sent” appears: check that it arrives.

  5. Press “Save”. “Relay settings saved” appears.

The E-mail notifications blockThe E-mail notifications block
The E-mail notifications block

The notifications are written in the language of the console you saved the relay from. The relay password does not end up in argos.json: it is in a separate file, readable by root only, and the page shows only “(unchanged)”.

The schedule

  1. Open System → Updates.
  2. Check that “Install updates automatically” is on. On a new installation it already is: updates every day, no automatic reboot, maintenance time 05:30.
  3. “Interval (days)”: leave 1, one run a day.
  4. “Report recipient”: type it@johnsmith.test. The field appears only with the relay switched on; without it, the page reminds you to configure it. If you leave root, the report goes to the relay’s “Recipients”.
  5. Switch on “Reboot automatically when required”. The appliance reboots only if an update requires it (a new kernel, a new libc).
  6. “Maintenance time”: 03:30. From this the schedule is fixed: the package lists refresh at 02:50 (40 minutes before), the upgrade starts at 03:10 (20 minutes before) and the reboot, if any, happens at 03:30.
  7. Press “Save”. “Automatic updates saved” appears. The effect is immediate: there is nothing to apply in the firewall.
The Updates blockThe Updates block
The Updates block

Warning A reboot interrupts the network for a few minutes: everything that goes through the appliance (internet, the VPN to the branch, the phones) stops until it is back. On reboot the appliance reloads the last confirmed rules. Choose a time when no shift is working. If you do not want automatic reboots, leave “Reboot automatically when required” off and reboot yourself when the Status page asks for it (step 16).

Updating now

When an urgent fix comes out there is no need to wait for the night.

  1. In System → Updates press “Update now”. The console downloads the package lists and installs whatever there is, then switches to the “Updating…” page.
  2. Wait. If the update includes Argos, the console restarts: the page keeps waiting and goes back to the settings on its own as soon as the console answers again (“Back online”).
The waiting page during an updateThe waiting page during an update
The waiting page during an update
  1. At the end an e-mail arrives with the outcome: how many packages were installed, or that there was nothing to install, or that the update failed.

The update runs in a separate system service, not inside the console: it carries on even if the console restarts halfway, and closing the page does not stop it. If one is already running, the button answers “An update is already running” and starts nothing.

Warning Do not press “Update now” while a firewall apply is waiting for confirmation (the “Keep the new ruleset?” window is open). If the update restarts the console, the rules on trial are rolled back: confirm or cancel first.

The pending reboot

  1. If the automatic reboot is off and an update requires one, the System → Updates block shows “A reboot is pending to finish applying the installed updates.” and the “Reboot now” button. Press it when you can afford a few minutes of downtime: the console switches to the “Rebooting…” page and comes back on its own when the appliance answers. The same reboot can be started from the power menu in the header (“Reboot”).

Verification

  • System status → Status, “Updates” panel: “Pending” says “Up to date” when there is nothing to install, otherwise how many packages are waiting, with “Security” separately. Below: “Automatic updates” “Enabled”, “Last upgrade” (the last time something was installed), “Last run” and “Next run” of the nightly run, in relative time: the next run is the 03:10 one, so at 18:10 it says “in 9 hours”. The panel’s “Open Updates” link leads to the System → Updates block.
The Updates panel of the Status pageThe Updates panel of the Status page
The Updates panel of the Status page
  • In the “Services” panel of the same page, “Automatic updates” is “Running”.
  • The “Attention” strip does not show “Automatic updates are off”. If it shows, for example, “3 security updates are waiting”, tonight’s run will install them; if you do not want to wait, use “Update now”.
  • The morning after a run that installed something, it@johnsmith.test receives the report with the list of packages. A run that found nothing sends no e-mail.
  • Events and diagnostics → System: type apt-daily-upgrade in the filter and press “Filter” to read what happened in the nightly run.

If something goes wrong

  • “Installing unattended-upgrades failed”. The package is missing and could not be installed. Check that the appliance reaches the internet (Events and diagnostics → Diagnostics, “Ping” to the gateway 203.0.113.9 and “DNS lookup” of an external name), then save again.
  • “the apt timers kept their previous schedule (see the journal)”. The settings are saved, but the timers’ schedule did not change. The reason is in Events and diagnostics → System.
  • “Time must be HH:MM”. Write the time with two digits for the hours and two for the minutes: 03:30.
  • “Not a valid e-mail address or local account”. The “Report recipient” must be an e-mail address, or a local account such as root.
  • “The update could not be started (see the journal)”. systemd did not accept the update service: nothing started. Read Events and diagnostics → System.
  • No e-mail. Check in System → E-mail notifications that “Send notifications” is on, then “Send test e-mail”. Remember that the automatic run writes only when it installed something or failed.
  • The waiting page stays stuck and says the console no longer answers. During the update the console may have renewed its self-signed certificate (this happens when the addresses change): the browser asks you to trust the new one only when it loads a page. Press “Open the console” and accept the certificate. If instead the console’s HTTPS front (nginx) did not come back, the same page offers the console in plain http: http://192.168.10.1/ or, if a reverse proxy or a publication holds port 80, http://192.168.10.1:8000/. In the example the website’s reverse proxy holds 80, so the console answers on 8000. This is direct mode: the Status page says nginx is down and how to put it back in front; see Recovering access.
  • “Still waiting”. The appliance did not come back within the expected time. Check it on site (screen, lights), then press “Retry”.
  • The “Attention” strip says “A reboot is needed to finish installing updates”. An update (usually the kernel) is waiting for a reboot. Use “Reboot now” (step 16) or switch the automatic reboot on.
LET’S TALK INFRASTRUCTURE

Control starts with a conversation.

Tell us about your infrastructure. Let’s start with what you actually need.

Talk to an engineer