Categories
SysOps

How to determine when package index was updated

Determine when package index was updated.

Ubuntu is using a timestamp file to mark an successfull package index update.

$ cat /etc/apt/apt.conf.d/15update-stamp 
APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};

Inspect current timestamp.

$ stat --format "%y" /var/lib/apt/periodic/update-success-stamp
2022-07-02 17:24:42.233369776 +0000

Update package index.

$ sudo apt update
Hit:1 http://pl.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://pl.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://pl.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:4 http://pl.archive.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

Inspect updated timestamp file.

$ stat --format "%y" /var/lib/apt/periodic/update-success-stamp
2022-07-02 17:30:13.855014199 +0000