openmediavault/openmediavault · warning · OMV\AssertException

The package archive is held by another process. Please try…

Error message

The package archive is held by another process. Please try again later.

What it means

Thrown by \OMV\System::assertIsNotLocked() (apt state check) when the exclusive flock on /var/cache/apt/archives/lock is held by another process, meaning an apt/dpkg operation is concurrently modifying the package archive cache. The library raises this preemptively so callers fail fast instead of hanging or corrupting apt state. It is a transient contention error, not a configuration problem.

Solutions

  1. Wait for the other apt process to finish and retry the operation
  2. Identify the lock holder: check `fuser -v /var/cache/apt/archives/lock` or `lsof /var/cache/apt/archives/lock` and stop/kill it if stale
  3. Disable or reschedule unattended-upgrades / OMV scheduled update tasks to avoid overlap
  4. Only as a last resort for a dead process, remove stale lock files (/var/cache/apt/archives/lock) after confirming no apt/dpkg process is running

Example fix

// before: fire-and-forget call fails under lock contention
$omvSystem->update();

// after: poll for lock release, then act
while (is_locked('/var/cache/apt/archives/lock')) {
    sleep(5);
}
$omvSystem->update();
Defensive patterns

Strategy: retry

Validate before calling

<?php
if (is_locked('/var/cache/apt/archives/lock') ||
    is_locked('/var/lib/dpkg/lock-frontend')) {
    // defer the operation; another apt/dpkg run is active
}

Type guard

null

Try / catch

try {
    $system->assertIsNotLocked();
    $system->update();
} catch (\OMV\AssertException $e) {
    sleep(30); // or log & reschedule
}

Prevention

When it happens

Trigger: Calling \OMV\System::assertIsNotLocked() (or any API that invokes it, e.g. update/upgrade/install helpers in \OMV\System\Apt) while another process (apt-get, aptitude, unattended-upgrades, omv-aptclean, a previous OMV task) holds /var/cache/apt/archives/lock.

Common situations: Scheduled unattended-upgrades running while the web UI triggers a plugin install; two OMV UI update requests racing; a hung apt-get from an earlier failed run still holding the lock; a cron job and manual CLI apt invocation overlapping.

Related errors


AI-assisted analysis of openmediavault/openmediavault@dce610eb66 (2026-09-15). Data as JSON: /api/errors/96691517bec24ea0. Report an issue: GitHub.

Appendix: source

Thrown at deb/openmediavault/usr/share/php/openmediavault/system/apt.inc:55

     * @throw \OMV\AssertException
     */
    public static function assertNotLocked(): void
    {
        if (is_locked("/var/lib/dpkg/lock")) {
            throw new \OMV\AssertException(
                "The package database is held by another process. ".
                "Please try again later."
            );
        }
        if (is_locked("/var/lib/apt/lists/lock")) {
            throw new \OMV\AssertException(
                "The storage area for state information for each ".
                "package resource is held by another process. ".
                "Please try again later."
            );
        }
        if (is_locked("/var/cache/apt/archives/lock")) {
            throw new \OMV\AssertException(
                "The package archive is held by another process. ".
                "Please try again later."
            );
        }
    }
}

View on GitHub (pinned to dce610eb66)