Background Agent clock discrepancy preventing apt-get update

Describe the Bug

Hi there - I’ve been running into issues with background agents today. It is failing during environment setup - and I’ve narrowed it down to the system clock being off by several+ hours on the container – and that causing apt-get commands to fail.

Has anyone ran into this before and/or have any suggested work arounds?

Steps to Reproduce

  1. Configure your project to use a custom Dockerfile (via .cursor/environment.json)
  2. Use a stripped down Dockerfile like:
FROM ubuntu:24.04
RUN date
RUN apt-get update -y

Expected Behavior

  • Date should return an up to date timestamp (instead its 12+ hours behind)
  • Apt-get update should work (not have package list release file “is not valid yet” errors)
  • Dockerfile is able to continue with install packages with apt-get thereafter

Screenshots / Screen Recordings

Operating System

Linux

Current Cursor Version (Menu → About Cursor → Copy)

I’m primarily debugging this on the Web UI for Agents

Additional Information

I’ve been in the process of enabling out Background Agent setup for our projects for the first time - so I can’t speak to whether this is a recent regression or something that has been ongoing.

Additionally I tried different approaches to syncing time - but none of the services or utilities to do this come preinstalled on the minimal container env - and there isn’t permissions to set date time in the container.

Does this stop you from using Cursor

Yes - Cursor is unusable

On Discord - I was offered a workaround by a community member. Posting it here in case no proper resolution is provided - and if anyone else runs into this problem:

RUN echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99disable-check-valid-until \ && echo 'Acquire::Check-Date "false";' >> /etc/apt/apt.conf.d/99disable-check-valid-until

This should be added to the Dockerfile prior to running any apt-get commands - and will effectively sidestep the clock issues.

Same exact problem here. Came here to see if anyone else had experienced this. Trying your fix now, but wanted to just echo that this is still a bug.

Yep, same issue here

I’ve been running into this same issue with a devcontainer config that previously worked fine. I’ve messed around with the workaround above, but I eventually gave up on background agents for the moment. It would be nice if the clock skew could be fixed.

I’ve been having this issue repeatedly across my org.

The exact error is:

[Build] Step 2/8: RUN apt-get update &&     apt-get install -y         postgresql-15         postgresql-client-15         postgresql-contrib-15 &&     rm -rf /var/lib/apt/lists/*
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8793 kB]
Reading package lists...
E: Release file for http://deb.debian.org/debian/dists/bookworm-updates/InRelease is not valid yet (invalid for another 7d 7h 25min 52s). Updates for this repository will not be applied.
E: Release file for http://deb.debian.org/debian-security/dists/bookworm-security/InRelease is not valid yet (invalid for another 7d 7h 59min 56s). Updates for this repository will not be applied.
ERROR: process "/bin/sh -c apt-get update &&     apt-get install -y         postgresql-15         postgresql-client-15         postgresql-contrib-15 &&     rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100
[Build] Status: ------
[Build] Status: > [2/8] RUN apt-get update &&     apt-get install -y         postgresql-15         postgresql-client-15         postgresql-contrib-15 &&     rm -rf /var/lib/apt/lists/*:
[Build] Status: 0.181 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
[Build] Status: 0.190 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
[Build] Status: 0.198 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
[Build] Status: 0.239 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8793 kB]
[Build] Status: 1.248 E: Release file for http://deb.debian.org/debian/dists/bookworm-updates/InRelease is not valid yet (invalid for another 7d 7h 25min 52s). Updates for this repository will not be applied.
[Build] Status: 1.248 E: Release file for http://deb.debian.org/debian-security/dists/bookworm-security/InRelease is not valid yet (invalid for another 7d 7h 59min 56s). Updates for this repository will not be applied.
[Build] Status: ------
[Build] Status: Dockerfile:3
[Build] Status: --------------------
[Build] Status: 2 |
[Build] Status: 3 | >>> RUN apt-get update && \
[Build] Status: 4 | >>>     apt-get install -y \
[Build] Status: 5 | >>>         postgresql-15 \
[Build] Status: 6 | >>>         postgresql-client-15 \
[Build] Status: 7 | >>>         postgresql-contrib-15 && \
[Build] Status: 8 | >>>     rm -rf /var/lib/apt/lists/*
[Build] Status: 9 |
[Build] Status: --------------------
[Build] Status: ERROR: failed to build: failed to solve: process "/bin/sh -c apt-get update &&     apt-get install -y         postgresql-15         postgresql-client-15         postgresql-contrib-15 &&     rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100
Error: Environment failed to start
Details:
Build failed with exit code: 1

+1 on this. Also having the same issue when downloading the base image:

Error: Environment failed to start
Details:
Build failed with exit code: 1
Allocating resources for this agent...
⣻
building with "default" instance using docker driver
[Build] load build definition from Dockerfile
transferring dockerfile: 939B done
DONE 0.0s
[Build] load metadata for mcr.microsoft.com/dotnet/sdk:8.0
ERROR: failed to do request: Head "https://mcr.microsoft.com/v2/dotnet/sdk/manifests/8.0": tls: failed to verify certificate: x509: certificate has expired or is not yet valid: current time 2025-08-16T12:01:04Z is before 2025-08-23T17:41:17Z
[Build] Status: ------
[Build] Status: > [internal] load metadata for mcr.microsoft.com/dotnet/sdk:8.0:
[Build] Status: Dockerfile:1
[Build] Status: --------------------
[Build] Status: 1 | >>> FROM mcr.microsoft.com/dotnet/sdk:8.0
[Build] Status: 2 |
[Build] Status: 3 |     # Fix issue with Cursor's apt-get update later in the setup process
[Build] Status: ERROR: failed to build: failed to solve: mcr.microsoft.com/dotnet/sdk:8.0: failed to resolve source metadata for mcr.microsoft.com/dotnet/sdk:8.0: failed to do request: Head "https://mcr.microsoft.com/v2/dotnet/sdk/manifests/8.0": tls: failed to verify certificate: x509: certificate has expired or is not yet valid: current time 2025-08-16T12:01:04Z is before 2025-08-23T17:41:17Z

In this example for Microsoft Artifact Registry . In this case there’s no workaround(?) due to the SSL being renewed on the August 23, 2025 so all background agents having a clock before this will fail.