heyer.systems Open Source

Automatic update (nightly)

Runs the full update every night between 02:00 and 02:30 – Debian packages, app, modules and iac, without a reboot – and restarts the services that still run with replaced libraries. Log: journalctl -u iac-auto-update

auto-update LXCVM preselected for new guests

Add to a guest

In the guest as root – container and VM alike:

update --add-modules auto-update

Runs a normal update and installs the module on the way.

From the Proxmox node, without logging in:

pct exec <ID> -- update --add-modules auto-update   # container
ssh root@<IP> update --add-modules auto-update

Choose when creating a guest

Without a dialog, on the Proxmox node:

IAC_NONINTERACTIVE=1 var_modules=auto-update \
  bash -c "$(curl -fsSL https://iac.heyer.systems/<app>/ct.sh)"

var_modules replaces the app's preselection – keep auto-update in the list if you want it. Interactive: choose “advanced” in the dialog, or tick the module in the generator on the app page.

Remove

update --remove-modules auto-update

Removes the module's packages, services, firewall rules and configuration again. Data stays.

Details

Runs the full update every night between 02:00 and 02:30 (local time of the guest): Debian packages, app, modules and iac – exactly like running it by hand, without a reboot and without a release upgrade. Each guest has its own fixed time in that half hour, so not all of them load at once; a guest that was off at that time catches up when it starts.

The module is preselected for new guests. If you do not want it, deselect it when you create the guest or remove it later with update --remove-modules auto-update. Existing guests get it with update --add-modules auto-update.

systemctl list-timers iac-auto-update.timer   # next run
journalctl -u iac-auto-update                 # output of the last runs

Services with replaced libraries

After the Debian upgrade, services can still run with the old libraries in memory – a fixed vulnerability stays open in them until they restart. The nightly run restarts them (needrestart -r a), before the app and the modules are updated; the guest itself is never rebooted (a new kernel: field Reboot needed, tag iac-reboot-now). An update by hand only lists them.

Services that must not restart at night go into /etc/iac/settings.env, then update:

auto_update_restart_exclude=postgresql mariadb   # names match from the start
auto_update_restart_exclude=all                  # restart nothing, only list

Never restarted: iac-auto-update itself – the update runs in it – and what Debian’s needrestart leaves out on its own (dbus, getty …) – they wait for the next reboot. systemd-logind and unattended-upgrades are restarted, although Debian leaves them out too. Which services wait: needrestart -b or the security report.

If an update is running by hand, the nightly run waits for it. An active backup only starts once the update has finished.