← Back to issue list

Unable to acquire the dpkg frontend lock

View original Github issue

Metadata

Project
charmcraft
Number
#567
Type
issue
State
closed
Author
sed-i
Labels
—
Created
Updated
Closed

Current evaluation

PR #745 (merged as b1adccd5) stopped routine APT cache updates via craft-providers 1.2.0, but one lock race recurred in 2.1.0 before the report went stale.

Resolution: closed stale

Reason: The presumed fix was merged in PR #745 (commit b1adccd5; change 1b472c69), but a later 2.1.0 report showed the race was not fully eliminated. No further fix or maintainer resolution followed that October 2022 comment.

Evaluated by: mr-cal-bot

No scores available.

Issue body

This only happened to me once but hopefully the attached log would be helpful enough. A pytest-operator integration test that I ran locally failed (only once so far) with: ```shell Traceback (most recent call last): File "/home/tux/charms/karma-alertmanager-proxy-operator/tests/integration/test_charm_integ.py", line 24, in test_build_and_deploy charm_under_test = await ops_test.build_charm(".") File "/home/tux/charms/karma-alertmanager-proxy-operator/.tox/integration/lib/python3.9/site-packages/pytest_operator/plugin.py", line 357, in build_charm raise RuntimeError( RuntimeError: Failed to build charm .: Packing charm 'karma-alertmanager-proxy-k8s_ubuntu-20.04-amd64.charm'... Failed to install apt-utils. * Command that failed: 'lxc --project charmcraft exec local:charmcraft-karma-alertmanager-proxy-k8s-56754252-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 apt-get install -y apt-utils' * Command exit code: 100 * Command standard error output: b'E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 653 (apt-get)\nE: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?\n' (full execution logs in '/home/tux/snap/charmcraft/common/charmcraft-log-8jlotfnh') ``` [charmcraft.log](https://github.com/canonical/charmcraft/files/7308622/charmcraft.log)

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed stale PR #745 (merged as b1adccd5) stopped routine APT cache updates via craft-providers 1.2.0, but one lock race recurred in 2.1.0 before the report went stale.
stealth/space-bunny-alpha — closed resolved PR #745 (b1adccd5) disabled automatic APT cache updates in build containers to avoid conflicts with ad-hoc apt-get; a rare lock failure still surfaced in Charmcraft 2.1.0.
qwen3.6-35b-a3b-mtp-q6 — — Resolved in PR #745 by skipping automatic APT cache updates in containers to prevent dpkg lock contention with ad-hoc installations. The fix is merged, though rare transient lock conflicts may still occur during concurrent operations.
qwen/qwen3.6-35b-a3b — — Fixed in PR #745 by disabling automatic APT cache updates in Craft Providers containers, preventing dpkg lock conflicts. Closed as resolved, though one intermittent retry occurred in v2.1.0.
qwen3.6-35b-a3b-mtp-q6 — — Fixed in PR #745 by caching APT updates instead of running them on every container launch, preventing dpkg lock conflicts. Closed as resolved, though rare intermittent recurrences were noted in later versions.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#745 (confidence 100%)

    Merged as b1adccd5 and upgraded craft-providers to 1.2.0, which avoided updating the APT cache on every container use.

  • Related To: canonical/craft-providers#104 (confidence 96%)

    Tracked disabling automatic APT updates to prevent these dpkg lock failures.

Related issues

No related issues found above the similarity threshold.