Snapcraft clean fails on root-owned files
Metadata
Current evaluation
Closed without resolution. snapcraft clean failed with a PermissionError when removing root-owned files from the build directory. No fix or discussion was provided.
Suggested action: —
No scores available.
Issue body
I am building a snap using SNAPCRAFT_CONTAINER_BUILDS to 1.
I have a couple of parts in a snap, and because of bug 1741752 I have to run snapcraft clean frequently. When I do, the clean fails for what seems like a permission issue.
lan@hal:~/tmp/dolphin-emu⟫ snapcraft clean
"grade" property not specified: defaulting to "stable"
Deleting local:snapcraft-dolphin-emu
Cleaning up priming area
Cleaning up staging area
Cleaning up parts directory
Traceback (most recent call last):
File "/snap/snapcraft/1021/bin/snapcraft", line 11, in <module>
load_entry_point('snapcraft==2.38', 'console_scripts', 'snapcraft')()
File "/snap/snapcraft/1021/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/snap/snapcraft/1021/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
return ep.load()
File "/snap/snapcraft/1021/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
return self.resolve()
File "/snap/snapcraft/1021/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/snap/snapcraft/1021/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 19, in <module>
run(prog_name='snapcraft')
File "/snap/snapcraft/1021/lib/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/snap/snapcraft/1021/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/snap/snapcraft/1021/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/snap/snapcraft/1021/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/snapcraft/1021/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/snap/snapcraft/1021/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 184, in clean
metadata=config.get_metadata()).clean(parts, step)
File "/snap/snapcraft/1021/lib/python3.6/site-packages/snapcraft/internal/lxd/_project.py", line 182, in clean
lifecycle.clean(self._project_options, parts, step)
File "/snap/snapcraft/1021/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_clean.py", line 174, in clean
_cleanup_common_directories_for_step(step, project_options)
File "/snap/snapcraft/1021/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_clean.py", line 131, in _cleanup_common_directories_for_step
parts)
File "/snap/snapcraft/1021/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_clean.py", line 154, in _cleanup_parts_dir
shutil.rmtree(path)
File "/snap/snapcraft/1021/usr/lib/python3.6/shutil.py", line 474, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/snap/snapcraft/1021/usr/lib/python3.6/shutil.py", line 412, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/snap/snapcraft/1021/usr/lib/python3.6/shutil.py", line 412, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/snap/snapcraft/1021/usr/lib/python3.6/shutil.py", line 432, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/snap/snapcraft/1021/usr/lib/python3.6/shutil.py", line 430, in _rmtree_safe_fd
os.unlink(name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'mbedtls.doxyfile'
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. snapcraft clean failed with a PermissionError when removing root-owned files from the build directory. No fix or discussion was provided. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution or comments. The snapcraft clean permission error on root-owned files was not addressed and appears abandoned or resolved in a later release. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1800119 snapcraft cleanbuild | snapcraft (launchpad) | closed | Closed without resolution. The report details a PermissionError during snapcraft cleanbuild caused by restricted access to the .aptitude directory. With zero comments and no fix applied, the issue was abandoned or marked stale. | |
| #1990551 snapcraft 7 never drops permissions while doing builds invoked with sudo | snapcraft (launchpad) | closed | Closed without resolution due to inactivity. The report identifies a snapcraft 7 regression where sudo builds retain root privileges instead of dropping them, unlike snapcraft 6. No fix or discussion occurred. | |
| #1615060 snapcraft clean is incomplete | snapcraft (launchpad) | closed | Reporting that snapcraft clean skips local .snap files was closed without comments or resolution, indicating the report was abandoned or left unresolved. | |
| #6118 snapcraft changes permissions of some files | snapcraft | closed | Rejected as not a snapcraft bug. Unexpected file permission changes were traced to coreutils or the core-base build process. The author closed the issue and referenced core-base PR 421 for the fix. | |
| #1871109 snapcraft should check file creation permissions and warn/error out instead of generating a non-functional snap | snapcraft (launchpad) | closed | Closed without resolution. The requested permission checks were not implemented, and the issue remains abandoned. | |
| #1719996 Wrong permission on resources when on SNAPCRAFT_CONTAINER_BUILDS=1 | snapcraft (launchpad) | closed | Closed without resolution. Snapcraft created root-owned directories when SNAPCRAFT_CONTAINER_BUILDS=1, preventing safe cleanup. Zero comments and no patches indicate the report was abandoned or marked stale. | |
| #1675516 can't cleanbuild snapcraft itself | snapcraft (launchpad) | closed | Closed without resolution or comments, the report of a failed snapcraft cleanbuild due to missing build-packages was abandoned. | |
| #1567054 Snapcraft clean doesn't remove pkg-config override | snapcraft (launchpad) | closed | Closed without discussion or linked pull request. The report noted snapcraft clean leaves pkg-config override files in part directories. No fix was implemented, indicating the issue was abandoned. | |
| #1800121 sudo snapcraft cleanbuild | snapcraft (launchpad) | closed | Closed without resolution, likely abandoned. Reported a FileNotFoundError during snapcraft cleanbuild when archiving a Firefox cache directory. |