← Back to issue list

Snapcraft crashes when the APT unprivileged user owns the host's source list file instead of root

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1992213
Type
issue
State
open
Author
~brlin
Labels
—
Created
Updated
Closed
—

Current evaluation

Snapcraft 8187 crashed opening a 0600 _apt-owned APT metadata file. The legacy LXD path was removed, but equivalent current apt-cache checks still need review.

Suggested action: needs triage

Reason: The report provides a concrete trigger: apt_pkg.Cache cannot read the shown 0600 _apt-owned InRelease file. Commit ffb164b7a removed the triggering snapcraft_legacy LXD path, but current Snapcraft still calls Repository.is_package_installed, whose craft-parts AptCache opens host lists, so maintainers should determine whether the underlying problem remains reachable. The issue has no labels, assignee, or maintainer response.

Evaluated by: mr-cal-bot

Impact: 48 Quick Win: 15 Complexity: 55 Confidence: 76 Actionability: 68

Issue body

``` File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/cli/lifecycle.py", line 112, in _execute build_provider_class.ensure_provider() File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/internal/build_providers/_lxd/_lxd.py", line 90, in ensure_provider if repo.Repo.is_package_installed("lxd") or repo.Repo.is_package_installed( File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/internal/repo/_deb.py", line 506, in is_package_installed with AptCache() as apt_cache: File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/internal/repo/apt_cache.py", line 58, in __enter__ self.cache = apt.Cache() File "/snap/snapcraft/8187/lib/python3.8/site-packages/apt/cache.py", line 170, in __init__ self.open(progress) File "/snap/snapcraft/8187/lib/python3.8/site-packages/apt/cache.py", line 232, in open self._cache = apt_pkg.Cache(progress) apt_pkg.Error: E:can not open /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_jammy_InRelease - fopen (13: Permission denied), E:The package lists or status file could not be parsed or opened. ``` See the attached file for full traces. It appears that the source file it reads is not world-readable, thus the error: ``` brlin@brlin-mz-530:~/文件/iscan-snap/snap$ LANG=C stat /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_jammy_InRelease File: /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_jammy_InRelease Size: 270087 Blocks: 528 IO Block: 4096 regular file Device: 1ch/28d Inode: 208286 Links: 1 Access: (0600/-rw-------) Uid: ( 105/ _apt) Gid: ( 0/ root) Access: 2022-10-08 07:10:46.083036717 +0800 Modify: 2022-04-22 01:16:39.000000000 +0800 Change: 2022-10-08 07:10:46.059036185 +0800 Birth: 2022-08-11 12:46:23.140062113 +0800 brlin@brlin-mz-530:~/文件/iscan-snap/snap$ LANG=C ls -l /var/lib/apt/lists/ ...stripped... -rw-r--r-- 1 root root 771595 Oct 6 09:36 tw.archive.ubuntu.com_ubuntu_dists_jammy-updates_universe_i18n_Translation-en -rw------- 1 _apt root 270087 Apr 22 01:16 tw.archive.ubuntu.com_ubuntu_dists_jammy_InRelease -rw-r--r-- 1 root root 6779186 Apr 19 08:52 tw.archive.ubuntu.com_ubuntu_dists_jammy_main_binary-amd64_Packages -rw-r--r-- 1 root root 4931270 Apr 19 08:52 tw.archive.ubuntu.com_ubuntu_dists_jammy_main_binary-i386_Packages ``` The `_apt` user supposed to be "unprivileged user for the apt methods"[1], whatever that means. [1]: apt - What is the sandbox user '_apt' on my system - Ask Ubuntu https://askubuntu.com/questions/810202/what-is-the-sandbox-user-apt-on-my-system

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 48
Quick Win: 15
Complexity: 55
Confidence: 76
Actionability: 68
needs triage Snapcraft 8187 crashed opening a 0600 _apt-owned APT metadata file. The legacy LXD path was removed, but equivalent current apt-cache checks still need review.
stealth/space-bunny-alpha
Impact: 42
Quick Win: 27
Complexity: 20
Confidence: 95
Actionability: 80
close stale Snapcraft 8187's legacy LXD setup crashes on a mode-0600 host APT InRelease; the affected snapcraft_legacy implementation has since been removed.
stealth/space-bunny-alpha
Impact: 28
Quick Win: 15
Complexity: 31
Confidence: 89
Actionability: 78
close stale Snapcraft 8.1.7's legacy LXD setup crashes on a 0600, _apt-owned host APT InRelease file; the affected snapcraft_legacy code has since been removed.
qwen3.6-35b-a3b-mtp-q6
Impact: 25
Quick Win: 16
Staleness: 95
Complexity: 35
Confidence: 65
Support Request: 45
close stale Snapcraft crashes when APT source list files have restrictive permissions (owned by _apt user with 0600). Issue is 4 years old with no maintainer response.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 20
Confidence: 80
Support Request: 10
close stale Snapcraft crashes with an apt_pkg permission error when reading host APT list files owned by the unprivileged _apt user. The report is nearly 4 years old, references snapcraft_legacy, and has had no maintainer response or updates.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 40
Confidence: 85
Support Request: 10
close stale Bug report about Snapcraft crashing due to APT file permissions owned by _apt user. Issue is 3.8 years old, no activity, references legacy code.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 20
Confidence: 85
Support Request: 20
close stale Untriaged crash report from 2022 where snapcraft fails due to APT list file permissions. References legacy code and outdated revision 8187. No maintainer engagement.

Update history

Date Change
created

Related issues

Issue Project State Summary Similarity
#5420 Snapcraft 7 fails to launch a LXD container based on host apt sources entries snapcraft closed Closed as a duplicate of canonical/snapcraft#4408; no separate fix was made for this report.
76%
#1583236 snapcraft APT sources checking too strict snapcraft (launchpad) open Snapcraft still turns any apt-get update failure into a package-list refresh error; this old report needs a modern reproducer and a policy for distinguishing harmless source failures.
75%
#1992660 Snapcraft fails if Ubuntu Advantage/Pro is configured snapcraft (launchpad) closed Closed without a code fix: maintainers deemed Ubuntu Pro permissions in legacy destructive builds an environment responsibility; LXD and Multipass builds remained supported.
72%
#1907721 Snapcraft broken on ARM64 snapcraft (launchpad) closed Closed as a configuration issue: a system-wide Python package broke apt-installed Snapcraft, while Multipass lacked ARM64 support; maintainers recommended the Snapcraft snap and --use-lxd.
72%
#1741753 Snapcraft clean fails on root-owned files snapcraft (launchpad) closed Root-owned LXD build files broke snapcraft clean; fixed by merged PR snapcore/snapcraft#1904 (commit 6bd4c9e59), correcting raw.idmap ownership handling.
71%
#1825820 Snapcraft doesn't update the `snapcraft-project` disk source when the path is moved snapcraft (launchpad) open LXD builds reportedly fail after moving a project because the instance retains the old disk source. LXD remains supported, but this untriaged report needs verification against the current craft-providers integration.
71%