can not start opencode on ubuntu /tmp does not allow execution of .so #5175
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui
Description
Description
When trying to run opencode it tries to execute/use a shared object file from the /tmp directory, however execution of shared object files on Ubuntu is blocked for security reasons.
> TMPDIR=~/.opencode/tmp opencode --print-logs --log-level DEBUG <region:eu-central-1>
INFO 2025-12-06T20:19:48 +153ms service=default version=1.0.134 args=["--print-logs","--log-level","DEBUG"] opencode
ERROR 2025-12-06T20:19:48 +362ms service=acp-command promise={} reason=Failed to initialize OpenTUI render library: Failed to open library "/tmp/.1b7ffdebf6a76fe6-00000001.so": /tmp/.1b7ffdebf6a76fe6-00000001.so: failed to map segment from shared object Unhandled rejection
ERROR 2025-12-06T20:19:48 +0ms service=default e=Failed to initialize OpenTUI render library: Failed to open library "/tmp/.1b7ffdebf6a76fe6-00000001.so": /tmp/.1b7ffdebf6a76fe6-00000001.so: failed to map segment from shared object rejection
ERROR 2025-12-06T20:19:48 +0ms service=default Error: Failed to initialize OpenTUI render library: Failed to open library "/tmp/.1b7ffdebf6a76fe6-00000001.so": /tmp/.1b7ffdebf6a76fe6-00000001.so: failed to map segment from shared object
it would be nice if the tmp directory could be specified or a common directory like ~/.local/share/opencode could be used on systems with standard security hardening.
OpenCode version
1.0.134
Steps to reproduce
sudo snap install bun-js
bun install -g opencode-ai
TMPDIR=~/.opencode/tmp opencode --print-logs --log-level DEBUG
Operating System
> cat /etc/issue Ubuntu 24.04.3 LTS \n \l
Terminal
kitty
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui
Activity
github-actions commentedon Dec 6, 2025
This issue might be a duplicate of existing issues. Please check:
This is a feature request to allow write access to /tmp or specify a custom TMPDIR, which would address the security hardening issue you're experiencing on Ubuntu. Feel free to ignore if your specific case requires a different solution.
falko-apheris commentedon Dec 6, 2025
follwing the link of the actions box, I found a fix
I would still wish that opencode would work out of the box
kommander commentedon Dec 20, 2025
It is a bun issue that is being worked on.
jpcaparas commentedon Jan 14, 2026
For *nix users having this issue, here's a drop-in wrapper command based on this answer:
thdxr commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
nkedel commentedon May 11, 2026
Issue is not just Ubuntu:
Add me to the bunch of users who are hitting this issue; I've worked around it, but here's gemini helping me describe what I hit:
Title: [Bug] Indefinite hang on startup when /tmp is mounted noexec (WSL/Hardened Linux)
Description:
On systems where /tmp is mounted with the noexec flag (common in WSL and hardened Linux environments), opencode hangs indefinitely during the initialization of the OpenTUI render library.
Behavior Analysis:
Tracing the process via strace shows that the main process and its child enter an infinite loop of thread synchronization attempts (a "futex storm"). The logs confirm that OpenTUI fails to map its native library from /tmp because of the noexec restriction:
ERROR service=default e=Failed to initialize OpenTUI render library:
Failed to open library "/tmp/.7bef6dbfdf7f5fbd-00000001.so":
failed to map segment from shared object rejection
Instead of exiting with a fatal error, the process blocks indefinitely on an epoll_pwait2 call, waiting for an event from a native worker that never successfully initialized.
Steps to Reproduce:
Workaround:
Directing temporary file extraction to a location with execution permissions resolves the issue:
export TMPDIR=~/tmp && opencode
Technical Environment:
Suggested Fix: