Automatic APT Update: Where is it logged?

Required Information

  • DietPi version:
G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=12
G_DIETPI_VERSION_RC=1
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
G_LIVE_PATCH_STATUS[0]='applied'
  • Distro version: bullseye
  • Kernel version: Linux OdroidN2 6.0.13-meson64 #22.11.2 SMP PREEMPT Sun Dec 18 16:52:19 CET 2022 aarch64 GNU/Linux
  • SBC model: Odroid N2 (aarch64)
  • Power supply used: 12V/2A power supply EU plug
  • SD card used: n.a. (eMMC)

Problem Description & Steps to reproduce

I have enabled Automatic APT Update check and Upgrade by editing the respective setting in /boot/dietpi.txt:

# Daily check for APT package updates: 0=disable | 1=check only | 2=check and upgrade automatically
# - Upgrade logs can be found at: /var/tmp/dietpi/logs/dietpi-update_apt.log
CONFIG_CHECK_APT_UPDATES=2

I also have Full Log System enabled. I assume that daily APT checks are performed now, but I’m looking for a way to verify this. So I first looked into /var/tmp/dietpi/logs/dietpi-update_apt.log, but this doesn’t seem to log the daily APT checks. Furthermore, it doesn’t contain any timestamps and has been changed last time on December 28th.

I looked then into /var/log, but I also couldn’t find a log file in there documenting the daily APT check:

maddin@OdroidN2:/var/log$ ls -ltr
total 6152
drwx------ 2 root root     40 Nov 20 22:14 private
drwxr-xr-x 3 root root     60 Dec  3 22:33 runit
-rw-r----- 1 root root      0 Dec  4 00:17 lynis-report.dat
-rw-r----- 1 root root      0 Dec  4 00:17 lynis.log
-rw-r--r-- 1 root root      0 Dec 18 02:17 alternatives.log
-rw-rw---- 1 root utmp      0 Dec 28 15:07 btmp.1
-rw-r----- 1 root adm     512 Dec 28 17:48 debug.1
-rw-r--r-- 1 root root   2853 Dec 28 17:48 dpkg.log.1
-rw-r----- 1 root adm   17014 Dec 31 23:17 auth.log.1
-rw-r----- 1 root adm  634902 Dec 31 23:58 ufw.log.1
-rw-r----- 1 root adm  670643 Dec 31 23:58 messages.1
-rw-r----- 1 root adm  671153 Dec 31 23:58 kern.log.1
-rw-r----- 1 root adm  684377 Jan  1 00:00 syslog.1
-rw-r----- 1 root adm    4327 Jan  1 00:00 daemon.log.1
-rw-r----- 1 root adm       0 Jan  1 00:00 debug
-rw-rw---- 1 root utmp      0 Jan  1 00:00 btmp
drwxr-xr-x 2 root root    140 Jan  2 20:54 apt
-rw-r--r-- 1 root root   1250 Jan  2 20:54 dpkg.log
-rw-r----- 1 root adm    6069 Jan  5 01:25 daemon.log
-rw-rw-r-- 1 root utmp   1600 Jan  5 10:58 wtmp
-rw-rw-r-- 1 root utmp 296592 Jan  5 10:58 lastlog
-rw-r----- 1 root adm   27251 Jan  5 15:21 auth.log
-rw-r----- 1 root adm  879203 Jan  5 15:24 ufw.log
-rw-r----- 1 root adm  898297 Jan  5 15:24 syslog
-rw-r----- 1 root adm  879353 Jan  5 15:24 messages
-rw-r----- 1 root adm  879203 Jan  5 15:24 kern.log

Sorry, if I miss something very obvious here. I’m just looking for way to verify (with a log preferrably) that the daily APT check is performed successfully. Thanks in advance for pointing me in the right directtion. :slight_smile:

 Upgrade logs can be found at: /var/tmp/dietpi/logs/dietpi-update_apt.log

I think it only logs the upgrades, not the checks? because you know it will check every day, why would you want to log this?

Exactly, that’s my point. How can I be sure that the APT checks have been performed successfully? For example, if there are network connectivity issues, I have no way to see that APT checks have been impacted by this. Other solutions, like unattended-upgrades, log their daily checks.

The log will become available if updates have been applied only.

The update check is part of the daily cron job /etc/cron.daily/dietpi. The job should be visible at journalctl.

Jan 05 01:25:01 DietPiProd CRON[15567]: (root) CMD (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; })

@Joulinar Thanks for that hint. :+1: I see now how that script is executed daily:

maddin@OdroidN2:~$ sudo journalctl | grep cron.daily
[sudo] password for maddin: 
Dec 29 01:25:01 OdroidN2 CRON[3479]: (root) CMD (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; })
Dec 30 01:25:01 OdroidN2 CRON[4413]: (root) CMD (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; })
Dec 31 01:25:01 OdroidN2 CRON[5288]: (root) CMD (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; })
Jan 01 01:25:01 OdroidN2 CRON[6189]: (root) CMD (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; })
Jan 02 01:25:01 OdroidN2 CRON[7087]: (root) CMD (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; })
Jan 03 01:25:01 OdroidN2 CRON[8590]: (root) CMD (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; })
Jan 04 01:25:01 OdroidN2 CRON[9555]: (root) CMD (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; })
Jan 05 01:25:01 OdroidN2 CRON[10474]: (root) CMD (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; })
Jan 06 01:25:01 OdroidN2 CRON[11550]: (root) CMD (test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; })

I had a look at the script /etc/cron.daily/dietpi, but I’m reaaly a noob in bash scripting. How does that script handle error situations, for example, sources misconfiguration or DNS resolve issues? Would I be able to see that in journalctl as well?

I guess @MichaIng could explain the error handling better than I

The APT updates are indeed not logged, the upgrades only. And cron itself has no logging/forwarding of executed scripts’ output. But if there was an error, journalctl -u cron would show that a script exited with error. Since there is no such hint in your case, everything seems to work fine.

If there were any issues, DietPi update and software installs as well as G_AGUP and apt update would fail as well, btw.

2 Likes

@MichaIng Thanks a lot for the for the explanation. This clarifies my question. And thanks again for your work on this great project! :heart:

1 Like