mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4889] [TUI] doctor: say when the old Docker seccomp profile, not the bundled Python, is what fails #5238
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5238
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4889
Author: @XiaoBinGan
Created: 11/1/2026
Status: 🔄 Open
Base:
main← Head:feat/doctor-container-check📝 Commits (1)
9174af8Add a container and permissions section tostrata doctor📊 Changes
3 files changed (+165 additions, -2 deletions)
View changed files
📝
strata_cli/cli.py(+4 -1)📝
strata_control/doctor.py(+72 -1)➕
tests/terminal/test_doctor_container.py(+89 -0)📄 Description
Problem and result
On a Docker daemon older than 20.10, the daemon's default seccomp profile denies
access(X_OK), so thelauncher's
[ -x ]test answers no for a bundled Python that is present and runs. Issue #4309 measured it fourways: the same image and the same command start with
--security-opt seccomp=unconfined, and without it thecontainer start says "The engine in this image does not match this computer's graphics card" and, underneath,
strata: no usable Python found. Both are wrong, and nothing instrata doctortold "the runtime is missing"apart from "the permission test is not allowed".
After this change
strata doctorhas a container and permissions section. It says whether this process lookslike a container, and for a bundled runtime that
os.access(path, os.X_OK)denies while an actual[path, "-V"]start succeeds, it prints one sentence with the cause and the one option that fixes it; when thetwo tests agree it prints only the container line. Read-only: no download, no engine start, no settings change;
the exit code and every existing check are unchanged.
--output jsonadds onecontainerobject to theexisting report.
On this Windows checkout (not a container),
python strata.py doctorprinted:For a runtime that is denied but starts,
container_lines()prints (this is the output of that function forthe report the unit test builds):
Related discussion
#4309 — the report with the four-way A/B evidence and the container-start log. Scope was posted before this
pull request: https://github.com/Niko1221/Strata/issues/4309#issuecomment-6555466830 — a read-only section in
strata doctor, shown by default rather than behind a new flag, because the people it helps have just beenmisled and will not look for a flag. The launcher and entrypoint fix is #4312; this is the diagnostic half for
the same cause, not a competing fix.
Approach
container_report()andcontainer_lines()instrata_control/doctor.py, called frominspect();strata_cli/cli.pyprints the lines forstrata doctoronly, so the sharedcomponents verifyhuman outputdoes not gain them.
--output jsoncarries the report./.dockerenv,/run/.containerenv, acontainer=environment variable,/proc/1/cgroupmarkers, and
STRATA_*variables. The official image setsSTRATA_IN_DOCKER=1in its runtime stage(Dockerfile), so the image is detected from the environment it actually sets.
bin/strata'spick_pythonprefers beside the terminal packages:python/bin/python3,python/bin/python,python/python.exe.os.accessis trusted only for the positiveanswer; a negative one is confirmed by actually starting the runtime with
-V, and only "denied but runs"prints the seccomp sentence. A runtime that cannot start is not blamed on seccomp and prints nothing extra.
ok, the exit code is computedas before, and a source checkout (no bundled
python/directory) reportsContainer: nowith no runtimes.Validation
Python 3.11.16 on Windows; base: upstream main
c62d5e3a.Passed:
python -m pytest tests/terminal/test_doctor_container.py -q→4 passed in 0.19s. The four cases:container hints from files/environment/cgroup; access denied while the runtime starts names the old profile and
the
--security-opt seccomp=unconfinedfix; a healthy runtime and one that cannot start add no warning;strata doctorprints the section and--output jsoncarries it.Passed: the new file with the neighbouring doctor files:
python -m pytest tests/terminal/test_doctor_container.py tests/terminal/test_profiles.py tests/terminal/test_component_start.py tests/terminal/test_issues_022.py tests/terminal/test_archive_gaps.py tests/terminal/test_cpu_pack_avx512.py -q→
77 passed, 2 skipped, 3 subtests passed in 20.74s.Passed: the A/B — with
strata_control/doctor.pyandstrata_cli/cli.pyrestored to upstream main, thenew file fails 4/4 (
AttributeError: module 'strata_control.doctor' does not have the attribute 'container_report'); with the change it is 4/4 passed.Passed: the decision path with real, unmocked
os.accessandsubprocess.run, using a real standaloneCPython copied into a fake bundled-runtime layout.
container_report(fake_root)returned{"detected": false, "evidence": [], "runtimes": [{"path": "...\\python\\python.exe", "access_x_ok": true, "runs": true, "version": "Python 3.11.16", "permission_mismatch": false}]}and the lines were
Container: no(no warning). With the image'sSTRATA_IN_DOCKER=1added to theenvironment:
detected: true, linesContainer: yes (STRATA_* environment (STRATA_IN_DOCKER)), still nowarning.
Passed:
python strata.py doctorprinted the four lines above and exited 0;python strata.py doctor --output jsoncontained"container": {"detected": false, "evidence": [], "runtimes": []}and exited 0.Failed: none from this change. In a wider run that also included
tests/terminal/test_recipes.py,RecipeTests::test_recipe_file_cannot_inject_shell_kind_or_symlinkfails withOSError: [WinError 1314](asymlink needs a privilege this Windows account does not hold). It fails the same way on the unmodified tree, so
it is this account, not this change.
Not run: the case this is for — a real container on a Docker daemon older than 20.10 whose default profile
denies
access(X_OK). This checkout is Windows; it cannot produce that seccomp decision or run the Linuxbundled runtime, so the denial path is driven by an injected
os.accessand a mocked start in the unit tests,not by measurement. The cause itself is #4309's evidence, which I did not reproduce here.
Not run: a real
strata doctorinside the official image, and the fulltests/terminaldirectory (thedoctor-family files above are the regression set for what this touches).
Limits
STRATA_*variable (for exampleSTRATA_DATA_DIR)is reported as
Container: yes. That is a wording signal only; no check or exit code depends on it.STRATA_PYTHONoverride or apython3found on PATH (thelauncher's other candidates). A host interpreter denied by the same profile but not bundled is not reported.
-V) wheneverdoctorruns: one short process start added toa diagnostic command.
the launcher,
strata doctorneeds a way in (#4312, or a direct interpreter invocation such asdocker run --entrypoint /opt/strata/terminal/python/bin/python3 IMAGE /opt/strata/strata.py doctor). It isthe explanation for those hosts, not a workaround for the refusal.
tests; the docs note fits with the launcher fix (#4312) or its own docs change.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.