`charmcraft build` sometimes fails on `apt install` inside the lxd container
Metadata
Current evaluation
Closed as a duplicate of issue #567. The report details intermittent apt-get lock failures during charmcraft build inside LXD containers, suspected to be caused by unattended-upgrades.
Suggested action: —
No scores available.
Issue body
It seems like it might be `unattended-upgrades` might be getting in the way:
```
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 563 (apt-get)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
```
Longer log:
```
Executing in container: lxc --project charmcraft exec local:charmcraft-ceph-rbd-mirror-258104-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
:: 2022-02-01 20:00:30.065 Requested build-packages: ['git', 'python3-dev', 'python3-pip', 'python3-setuptools', 'python3-venv', 'python3-wheel', 'tox']
3-pip', 'python3-setuptools', 'python3-venv', 'python3-wheel', 'tox'] - (2.2s)
3-pip', 'python3-setuptools', 'python3-venv', 'python3-wheel', 'tox'] \ (2.3s)
3-pip', 'python3-setuptools', 'python3-venv', 'python3-wheel', 'tox'] | (2.4s)
3-pip', 'python3-setuptools', 'python3-venv', 'python3-wheel', 'tox'] / (2.7s)
3-pip', 'python3-setuptools', 'python3-venv', 'python3-wheel', 'tox'] - (2.8s)
3-pip', 'python3-setuptools', 'python3-venv', 'python3-wheel', 'tox']
:: 2022-02-01 20:00:32.908 Marking python3-pip (and its dependencies) to be fetched
:: 2022-02-01 20:00:32.910 package: python3-pip
:: 2022-02-01 20:00:32.957 Marking git (and its dependencies) to be fetched
:: 2022-02-01 20:00:32.958 package: git
:: 2022-02-01 20:00:33.008 Marking python3-venv (and its dependencies) to be fetched
:: 2022-02-01 20:00:33.011 package: python3-venv
:: 2022-02-01 20:00:33.046 Marking python3-setuptools (and its dependencies) to be fetched
:: 2022-02-01 20:00:33.047 package: python3-setuptools
:: 2022-02-01 20:00:33.068 Marking python3-wheel (and its dependencies) to be fetched
:: 2022-02-01 20:00:33.068 package: python3-wheel
:: 2022-02-01 20:00:33.103 Marking tox (and its dependencies) to be fetched
:: 2022-02-01 20:00:33.104 package: tox
:: 2022-02-01 20:00:33.159 Marking python3-dev (and its dependencies) to be fetched
:: 2022-02-01 20:00:33.160 package: python3-dev
:: 2022-02-01 20:00:33.266 Installing packages: git=1:2.25.1-1ubuntu3.2 git-man=1:2.25.1-1ubuntu3.2 libasn1-8-heimdal=7.7.0+dfsg-1ubuntu1 libbrotli1=1.0.7-6ubuntu0.1 libcurl3-gnutls=7.68.0-1ubuntu2.7 liberror-perl=0.17029-1 libexpat1-dev=2.2.9-1build1 libgssapi3-heimdal=7.7.0+dfsg-1ubuntu1 libhcrypto4-heimdal=7.7.0+dfsg-1ubuntu1 libheimbase1-heimdal=7.7.0+dfsg-1ubuntu1 libheimntlm0-heimdal=7.7.0+dfsg-1ubuntu1 libhx509-5-heimdal=7.7.0+dfsg-1ubuntu1 libjs-jquery=3.3.1~dfsg-3 libjs-sphinxdoc=1.8.5-7ubuntu3 libjs-underscore=1.9.1~dfsg-1ubuntu0.20.04.1 libkrb5-26-heimdal=7.7.0+dfsg-1ubuntu1 libldap-2.4-2=2.4.49+dfsg-2ubuntu1.8 libldap-common=2.4.49+dfsg-2ubuntu1.8 libnghttp2-14=1.40.0-1build1 libpsl5=0.21.0-1ubuntu1 libpython3-dev=3.8.2-0ubuntu2 libpython3.8=3.8.10-0ubuntu1~20.04.2 libpython3.8-dev=3.8.10-0ubuntu1~20.04.2 libroken18-heimdal=7.7.0+dfsg-1ubuntu1 librtmp1=2.4+20151223.gitfa8646d.1-2build1 libsasl2-2=2.1.27+dfsg-2 libsasl2-modules-db=2.1.27+dfsg-2 libssh-4=0.9.3-2ubuntu2.2 libwind0-heimdal=7.7.0+dfsg-1ubuntu1 python-pip-whl=20.0.2-5ubuntu1.6 python3-appdirs=1.4.3-2.1 python3-dev=3.8.2-0ubuntu2 python3-distlib=0.3.0-1 python3-distutils=3.8.10-0ubuntu1~20.04 python3-filelock=3.0.12-2 python3-importlib-metadata=1.5.0-1 python3-lib2to3=3.8.10-0ubuntu1~20.04 python3-more-itertools=4.2.0-1build1 python3-packaging=20.3-1 python3-pip=20.0.2-5ubuntu1.6 python3-pkg-resources=45.2.0-1 python3-pluggy=0.13.0-2 python3-py=1.8.1-1ubuntu0.1 python3-pyparsing=2.4.6-1 python3-setuptools=45.2.0-1 python3-six=1.14.0-2 python3-toml=0.10.0-3 python3-venv=3.8.2-0ubuntu2 python3-virtualenv=20.0.17-1ubuntu0.4 python3-wheel=0.34.2-1 python3-zipp=1.0.0-1 python3.8-dev=3.8.10-0ubuntu1~20.04.2 python3.8-venv=3.8.10-0ubuntu1~20.04.2 tox=3.13.2-2 virtualenv=20.0.17-1ubuntu0.4 zlib1g-dev=1:1.2.11.dfsg-2ubuntu1.2
:: 2022-02-01 20:00:33.342 :: E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 563 (apt-get)
:: 2022-02-01 20:00:33.343 :: E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
:: 2022-02-01 20:00:33.345 Parts processing error: Cannot install all requested build packages: git=1:2.25.1-1ubuntu3.2, git-man=1:2.25.1-1ubuntu3.2, libasn1-8-heimdal=7.7.0+dfsg-1ubuntu1, libbrotli1=1.0.7-6ubuntu0.1, libcurl3-gnutls=7.68.0-1ubuntu2.7, liberror-perl=0.17029-1, libexpat1-dev=2.2.9-1build1, libgssapi3-heimdal=7.7.0+dfsg-1ubuntu1, libhcrypto4-heimdal=7.7.0+dfsg-1ubuntu1, libheimbase1-heimdal=7.7.0+dfsg-1ubuntu1, libheimntlm0-heimdal=7.7.0+dfsg-1ubuntu1, libhx509-5-heimdal=7.7.0+dfsg-1ubuntu1, libjs-jquery=3.3.1~dfsg-3, libjs-sphinxdoc=1.8.5-7ubuntu3, libjs-underscore=1.9.1~dfsg-1ubuntu0.20.04.1, libkrb5-26-heimdal=7.7.0+dfsg-1ubuntu1, libldap-2.4-2=2.4.49+dfsg-2ubuntu1.8, libldap-common=2.4.49+dfsg-2ubuntu1.8, libnghttp2-14=1.40.0-1build1, libpsl5=0.21.0-1ubuntu1, libpython3-dev=3.8.2-0ubuntu2, libpython3.8=3.8.10-0ubuntu1~20.04.2, libpython3.8-dev=3.8.10-0ubuntu1~20.04.2, libroken18-heimdal=7.7.0+dfsg-1ubuntu1, librtmp1=2.4+20151223.gitfa8646d.1-2build1, libsasl2-2=2.1.27+dfsg-2, libsasl2-modules-db=2.1.27+dfsg-2, libssh-4=0.9.3-2ubuntu2.2, libwind0-heimdal=7.7.0+dfsg-1ubuntu1, python-pip-whl=20.0.2-5ubuntu1.6, python3-appdirs=1.4.3-2.1, python3-dev=3.8.2-0ubuntu2, python3-distlib=0.3.0-1, python3-distutils=3.8.10-0ubuntu1~20.04, python3-filelock=3.0.12-2, python3-importlib-metadata=1.5.0-1, python3-lib2to3=3.8.10-0ubuntu1~20.04, python3-more-itertools=4.2.0-1build1, python3-packaging=20.3-1, python3-pip=20.0.2-5ubuntu1.6, python3-pkg-resources=45.2.0-1, python3-pluggy=0.13.0-2, python3-py=1.8.1-1ubuntu0.1, python3-pyparsing=2.4.6-1, python3-setuptools=45.2.0-1, python3-six=1.14.0-2, python3-toml=0.10.0-3, python3-venv=3.8.2-0ubuntu2, python3-virtualenv=20.0.17-1ubuntu0.4, python3-wheel=0.34.2-1, python3-zipp=1.0.0-1, python3.8-dev=3.8.10-0ubuntu1~20.04.2, python3.8-venv=3.8.10-0ubuntu1~20.04.2, tox=3.13.2-2, virtualenv=20.0.17-1ubuntu0.4, zlib1g-dev=1:1.2.11.dfsg-2ubuntu1.2
:: 2022-02-01 20:00:33.352 Traceback (most recent call last):
:: 2022-02-01 20:00:33.352 File "/snap/charmcraft/x1/lib/craft_parts/packages/deb.py", line 467, in _install_packages
:: 2022-02-01 20:00:33.353 process_run(apt_command + package_names, env=env, stdin=subprocess.DEVNULL)
:: 2022-02-01 20:00:33.353 File "/snap/charmcraft/x1/lib/craft_parts/packages/deb.py", line 602, in process_run
:: 2022-02-01 20:00:33.354 os_utils.process_run(command, logger.debug, **kwargs)
:: 2022-02-01 20:00:33.354 File "/snap/charmcraft/x1/lib/craft_parts/utils/os_utils.py", line 360, in process_run
:: 2022-02-01 20:00:33.355 raise subprocess.CalledProcessError(ret, command)
:: 2022-02-01 20:00:33.355 subprocess.CalledProcessError: Command '['apt-get', '--no-install-recommends', '-y', '-oDpkg::Use-Pty=0', '--allow-downgrades', 'install', 'git=1:2.25.1-1ubuntu3.2', 'git-man=1:2.25.1-1ubuntu3.2', 'libasn1-8-heimdal=7.7.0+dfsg-1ubuntu1', 'libbrotli1=1.0.7-6ubuntu0.1', 'libcurl3-gnutls=7.68.0-1ubuntu2.7', 'liberror-perl=0.17029-1', 'libexpat1-dev=2.2.9-1build1', 'libgssapi3-heimdal=7.7.0+dfsg-1ubuntu1', 'libhcrypto4-heimdal=7.7.0+dfsg-1ubuntu1', 'libheimbase1-heimdal=7.7.0+dfsg-1ubuntu1', 'libheimntlm0-heimdal=7.7.0+dfsg-1ubuntu1', 'libhx509-5-heimdal=7.7.0+dfsg-1ubuntu1', 'libjs-jquery=3.3.1~dfsg-3', 'libjs-sphinxdoc=1.8.5-7ubuntu3', 'libjs-underscore=1.9.1~dfsg-1ubuntu0.20.04.1', 'libkrb5-26-heimdal=7.7.0+dfsg-1ubuntu1', 'libldap-2.4-2=2.4.49+dfsg-2ubuntu1.8', 'libldap-common=2.4.49+dfsg-2ubuntu1.8', 'libnghttp2-14=1.40.0-1build1', 'libpsl5=0.21.0-1ubuntu1', 'libpython3-dev=3.8.2-0ubuntu2', 'libpython3.8=3.8.10-0ubuntu1~20.04.2', 'libpython3.8-dev=3.8.10-0ubuntu1~20.04.2', 'libroken18-heimdal=7.7.0+dfsg-1ubuntu1', 'librtmp1=2.4+20151223.gitfa8646d.1-2build1', 'libsasl2-2=2.1.27+dfsg-2', 'libsasl2-modules-db=2.1.27+dfsg-2', 'libssh-4=0.9.3-2ubuntu2.2', 'libwind0-heimdal=7.7.0+dfsg-1ubuntu1', 'python-pip-whl=20.0.2-5ubuntu1.6', 'python3-appdirs=1.4.3-2.1', 'python3-dev=3.8.2-0ubuntu2', 'python3-distlib=0.3.0-1', 'python3-distutils=3.8.10-0ubuntu1~20.04', 'python3-filelock=3.0.12-2', 'python3-importlib-metadata=1.5.0-1', 'python3-lib2to3=3.8.10-0ubuntu1~20.04', 'python3-more-itertools=4.2.0-1build1', 'python3-packaging=20.3-1', 'python3-pip=20.0.2-5ubuntu1.6', 'python3-pkg-resources=45.2.0-1', 'python3-pluggy=0.13.0-2', 'python3-py=1.8.1-1ubuntu0.1', 'python3-pyparsing=2.4.6-1', 'python3-setuptools=45.2.0-1', 'python3-six=1.14.0-2', 'python3-toml=0.10.0-3', 'python3-venv=3.8.2-0ubuntu2', 'python3-virtualenv=20.0.17-1ubuntu0.4', 'python3-wheel=0.34.2-1', 'python3-zipp=1.0.0-1', 'python3.8-dev=3.8.10-0ubuntu1~20.04.2', 'python3.8-venv=3.8.10-0ubuntu1~20.04.2', 'tox=3.13.2-2', 'virtualenv=20.0.17-1ubuntu0.4', 'zlib1g-dev=1:1.2.11.dfsg-2ubuntu1.2']' returned non-zero exit status 100.
:: 2022-02-01 20:00:33.356
:: 2022-02-01 20:00:33.356 The above exception was the direct cause of the following exception:
:: 2022-02-01 20:00:33.357 Traceback (most recent call last):
:: 2022-02-01 20:00:33.357 File "/snap/charmcraft/x1/lib/charmcraft/parts.py", line 320, in run
:: 2022-02-01 20:00:33.357 with self._lcm.action_executor() as aex:
:: 2022-02-01 20:00:33.357 File "/snap/charmcraft/x1/lib/craft_parts/executor/executor.py", line 253, in __enter__
:: 2022-02-01 20:00:33.357 self._executor.prologue()
:: 2022-02-01 20:00:33.357 File "/snap/charmcraft/x1/lib/craft_parts/executor/executor.py", line 86, in prologue
:: 2022-02-01 20:00:33.357 self._install_build_packages()
:: 2022-02-01 20:00:33.363 File "/snap/charmcraft/x1/lib/craft_parts/executor/executor.py", line 196, in _install_build_packages
:: 2022-02-01 20:00:33.363 packages.Repository.install_packages(sorted(build_packages))
:: 2022-02-01 20:00:33.363 File "/snap/charmcraft/x1/lib/craft_parts/packages/deb.py", line 436, in install_packages
:: 2022-02-01 20:00:33.363 cls._install_packages(packages)
:: 2022-02-01 20:00:33.364 File "/snap/charmcraft/x1/lib/craft_parts/packages/deb.py", line 469, in _install_packages
:: 2022-02-01 20:00:33.365 raise errors.BuildPackagesNotInstalled(packages=package_names) from err
:: 2022-02-01 20:00:33.365 craft_parts.packages.errors.BuildPackagesNotInstalled: Cannot install all requested build packages: git=1:2.25.1-1ubuntu3.2, git-man=1:2.25.1-1ubuntu3.2, libasn1-8-heimdal=7.7.0+dfsg-1ubuntu1, libbrotli1=1.0.7-6ubuntu0.1, libcurl3-gnutls=7.68.0-1ubuntu2.7, liberror-perl=0.17029-1, libexpat1-dev=2.2.9-1build1, libgssapi3-heimdal=7.7.0+dfsg-1ubuntu1, libhcrypto4-heimdal=7.7.0+dfsg-1ubuntu1, libheimbase1-heimdal=7.7.0+dfsg-1ubuntu1, libheimntlm0-heimdal=7.7.0+dfsg-1ubuntu1, libhx509-5-heimdal=7.7.0+dfsg-1ubuntu1, libjs-jquery=3.3.1~dfsg-3, libjs-sphinxdoc=1.8.5-7ubuntu3, libjs-underscore=1.9.1~dfsg-1ubuntu0.20.04.1, libkrb5-26-heimdal=7.7.0+dfsg-1ubuntu1, libldap-2.4-2=2.4.49+dfsg-2ubuntu1.8, libldap-common=2.4.49+dfsg-2ubuntu1.8, libnghttp2-14=1.40.0-1build1, libpsl5=0.21.0-1ubuntu1, libpython3-dev=3.8.2-0ubuntu2, libpython3.8=3.8.10-0ubuntu1~20.04.2, libpython3.8-dev=3.8.10-0ubuntu1~20.04.2, libroken18-heimdal=7.7.0+dfsg-1ubuntu1, librtmp1=2.4+20151223.gitfa8646d.1-2build1, libsasl2-2=2.1.27+dfsg-2, libsasl2-modules-db=2.1.27+dfsg-2, libssh-4=0.9.3-2ubuntu2.2, libwind0-heimdal=7.7.0+dfsg-1ubuntu1, python-pip-whl=20.0.2-5ubuntu1.6, python3-appdirs=1.4.3-2.1, python3-dev=3.8.2-0ubuntu2, python3-distlib=0.3.0-1, python3-distutils=3.8.10-0ubuntu1~20.04, python3-filelock=3.0.12-2, python3-importlib-metadata=1.5.0-1, python3-lib2to3=3.8.10-0ubuntu1~20.04, python3-more-itertools=4.2.0-1build1, python3-packaging=20.3-1, python3-pip=20.0.2-5ubuntu1.6, python3-pkg-resources=45.2.0-1, python3-pluggy=0.13.0-2, python3-py=1.8.1-1ubuntu0.1, python3-pyparsing=2.4.6-1, python3-setuptools=45.2.0-1, python3-six=1.14.0-2, python3-toml=0.10.0-3, python3-venv=3.8.2-0ubuntu2, python3-virtualenv=20.0.17-1ubuntu0.4, python3-wheel=0.34.2-1, python3-zipp=1.0.0-1, python3.8-dev=3.8.10-0ubuntu1~20.04.2, python3.8-venv=3.8.10-0ubuntu1~20.04.2, tox=3.13.2-2, virtualenv=20.0.17-1ubuntu0.4, zlib1g-dev=1:1.2.11.dfsg-2ubuntu1.2
:: 2022-02-01 20:00:33.365 Full execution log: '/root/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220201-200029.985793.log'
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed as a duplicate of issue #567. The report details intermittent apt-get lock failures during charmcraft build inside LXD containers, suspected to be caused by unattended-upgrades. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as a duplicate of issue #567. The report details intermittent apt install failures in charmcraft build caused by dpkg lock conflicts, likely triggered by unattended-upgrades. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed as duplicate of #567. Report details intermittent apt install failures inside charmcraft LXD containers from dpkg lock conflicts, likely unattended-upgrades. Tracking and resolution moved to the referenced duplicate. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed as a duplicate of issue #567. The report details intermittent apt lock failures during charmcraft builds inside LXD containers, attributed to conflicting unattended-upgrades processes. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #511 `charmcraft pack` fails running `apt update` | charmcraft | closed | Closed as out of scope. The failure stemmed from an LXD container networking bug, not charmcraft. No code changes were implemented; users were directed to external LXD and Discourse discussions for troubleshooting. | |
| #560 Charmcraft pack is giving error frequently | charmcraft | closed | Charmcraft pack failed due to an apt-get network error installing snapd in an LXD container. Maintainers linked it to a known networking issue. The reporter confirmed a workaround failed. Closed without a code fix, likely abandoned. | |
| #1260 Charmcraft hangs or fails with LXD 5.18 | charmcraft | closed | Closed due to an upstream LXD bug. A fix was released for LXD 5.18 compatibility, resolving the hangs and failures. The investigation also uncovered a separate craft-providers issue tracked independently. | |
| #660 `charmcraft pack` fails with error writing to lxd unix socket | charmcraft | closed | charmcraft pack failed due to an LXD socket I/O timeout. The author closed the issue as the error did not recur after a clean rebuild. No code changes were applied. | |
| #736 `charmcraft` lxc container starts failing with `FileNotFoundError` during iterative design | charmcraft | closed | Closed without a fix. Maintainer could not reproduce the LXC container corruption causing FileNotFoundError during charmcraft pack on newer versions. Reopen if reproducible on Charmcraft 2.7 or 3. | |
| #391 LXD issue when build multiple charms in parallel | craft-providers | open | LXD race condition causing parallel charm build failures; reopened by maintainer after resurfacing in modern Charmcraft | |
| #506 Build a charmed failed | charmcraft | closed | charmcraft build failed due to an outdated LXD version lacking project support. Maintainers requested version details. Closed without resolution, likely abandoned, with a request to reopen if the problem persists. |