We have an unattended update setup. To make sure nothing slips, we check for pending security updates and trigger a warning if there is something available but not installed for a week.
Now we have a server with security updates not installed for a while because of the periodic package update failing without any indication of it. We would like to add a trigger to the monitoring to detect this, however, that seems not so simple.
apt update
prints an error and has a non-zero exit status:
# apt update. . . E: Some index files failed to download. They have been ignored, or old ones used instead.# echo $?100
However, the above did set the "success" stamp at:
# ls -l /var/lib/apt/periodic/update-success-stamp-rw-r--r-- 1 root root 0 Oct 11 10:58 /var/lib/apt/periodic/update-success-stamp
Also, despite the error, the systemd service apt-daily.service
is exiting with exit status 0.
How is it possible to detect that the daily package update is failing?
I am running Ubuntu 22.04
cat /etc/lsb-release DISTRIB_ID=UbuntuDISTRIB_RELEASE=22.04DISTRIB_CODENAME=jammyDISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"