Add opt-in HarmonyOS proot compat switch (PROOT_NO_SECCOMP=1), fix #1128 - #5
Draft
lzmd66 wants to merge 6 commits into
Draft
Add opt-in HarmonyOS proot compat switch (PROOT_NO_SECCOMP=1), fix #1128#5lzmd66 wants to merge 6 commits into
lzmd66 wants to merge 6 commits into
Conversation
Read the proot_no_seccomp_compat boolean from terminal_settings in buildEnvironment(). When enabled, inject PROOT_NO_SECCOMP=1 so that proot does not install its seccomp filter. This works around ENOSYS failures on chdir/getcwd/shebang/static execve seen on HarmonyOS NEXT (AAswordman/Operit#1128). Default remains off, no behavior change for other devices.
Mirror the existing chroot_enabled pattern: a boolean stored in the terminal_settings SharedPreferences plus a StateFlow for the UI.
New settings card mirroring the chroot/shared_tmp switch style, placed next to the chroot mode card.
Author
|
Correction to my earlier note: I said the PR would stay in draft "until CI confirms it compiles" — turns out this repo has no CI workflows configured, so there is nothing to wait for on that front. What I did instead (static verification, since I have no local Gradle build on the phone):
Keeping this as a draft anyway since a human compile run is still the real gate — will mark it ready once that happens (or feel free to flip it / squash-merge with review fixes). Also happy to attempt a full Gradle build on a PC side if useful. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in, default-off setting that injects
PROOT_NO_SECCOMP=1into the terminal environment when enabled, fixing proot startup failures on HarmonyOS NEXT.Fixes #1128 (tracked in AAswordman/Operit#1128)
Background
On HarmonyOS NEXT (hosted on Mate devices via HarmonyOS NEXT + 卓易通/Android compatibility layer), proot's seccomp filter causes commands to fail with
ENOSYS(Errno 38) onchdir,getcwd, shebang execution and static ELFexecve. Terminal sessions either fail to initialize or intermittently hang.Verified workaround: injecting
export PROOT_NO_SECCOMP=1before proot starts. The only reliable injection point is the shell scripts sourced beforeexec proot(setup_fake_sysdata.sh/common.sh), becausebuildEnvironment()whitelists env vars and the Kotlin code overwrites these files on every init.What this PR does
LocalTerminalProvider.ktbuildEnvironment()readsproot_no_seccomp_compatfromterminal_settingsprefs and injectsenv["PROOT_NO_SECCOMP"] = "1"when enabledSettingsViewModel.ktchroot_enabledpatternSettingsScreen.ktvalues/strings.xml/values-en/strings.xmlDesign notes:
buildEnvironment()(rather than patching shell scripts) means the fix survives asset re-extraction and app updates — no persistence issueReal-device verification (HarmonyOS NEXT, Mate 80 Pro / 卓易通)
Tested against both release v1.12.1 and nightly v1.12.1+6:
PROOT_NO_SECCOMP=1Reproduction data: the patched shell scripts were wiped by app updates 3 times (each Operit upgrade re-extracts assets and overwrites
setup_fake_sysdata.sh), each time breaking the terminal again — which is exactly why this needs to live in app code rather than a user-side patch.Merge readiness
I can't run the Gradle build locally (Android phone environment), so CI is the arbiter for compile correctness. Happy to adjust naming, wording, or the switch placement per maintainer preference. The issue reporter (me) is available for further real-device testing of any follow-up build.
cc @3316891527