Skip to content

fix apt cache timestamp logic#261

Open
anarcat wants to merge 1 commit intoprometheus-community:masterfrom
anarcat:cachestamp
Open

fix apt cache timestamp logic#261
anarcat wants to merge 1 commit intoprometheus-community:masterfrom
anarcat:cachestamp

Conversation

@anarcat
Copy link
Copy Markdown
Contributor

@anarcat anarcat commented Feb 25, 2026

I just stumbled upon a host where there is not update-success-stamp at all. Turns out this file is actually site-specific to our environment and is created by a Puppet module we use.

It's not standard: the APT::Periodic feature flags updates with the update-stamp file instead!

So let's split the check into multiple, distinct heuristics:

  1. if the update-success-stamp file exist, use it and disregard the rest

  2. failing that, if APT::Periodic is configured, check update-stamp, which does roughly the same (but won't update on a plain apt update)

  3. failing that, check /var/lib/apt/lists/partial which works but might give a false timestamps when apt-get fails to get an update, as that directory's timestamp is always updated

Because of (3), we still need the other heuristics.

I just stumbled upon a host where there is not `update-success-stamp`
at all. Turns out this file is actually site-specific to our
environment and is created by a Puppet module we use.

It's not standard: the APT::Periodic feature flags updates with the
`update-stamp` file instead!

So let's split the check into multiple, distinct heuristics:

 1. if the `update-success-stamp` file exist, use it and disregard the
    rest

 2. failing that, if `APT::Periodic` is configured, check
    `update-stamp`, which does roughly the same (but won't update on a
    plain `apt update`)

 3. failing that, check `/var/lib/apt/lists/partial` which *works* but
    might give a false timestamps when apt-get *fails* to get an
    update, as that directory's timestamp is always updated

Because of (3), we still need the other heuristics.

Signed-off-by: Antoine Beaupré <anarcat@debian.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant