can not start opencode on ubuntu /tmp does not allow execution of .so #3361

Open
opened 2026-02-16 17:39:46 -05:00 by yindo · 4 comments
Owner

Originally created by @falko-apheris on GitHub (Dec 6, 2025).

Originally assigned to: @kommander on GitHub.

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

Originally created by @falko-apheris on GitHub (Dec 6, 2025). Originally assigned to: @kommander on GitHub. ### 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
yindo added the opentuibug labels 2026-02-16 17:39:46 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 6, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #4743: [FEATURE]: allow /tmp or $TMPDIR folder access option

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.

@github-actions[bot] commented on GitHub (Dec 6, 2025): This issue might be a duplicate of existing issues. Please check: - #4743: [FEATURE]: allow /tmp or $TMPDIR folder access option 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.
Author
Owner

@falko-apheris commented on GitHub (Dec 6, 2025):

follwing the link of the actions box, I found a fix

BUN_TMPDIR=~/.opencode/tmp opencode --print-logs --log-level DEBUG    

I would still wish that opencode would work out of the box

@falko-apheris commented on GitHub (Dec 6, 2025): follwing the link of the actions box, I found a fix ``` BUN_TMPDIR=~/.opencode/tmp opencode --print-logs --log-level DEBUG ``` I would still wish that opencode would work out of the box
Author
Owner

@kommander commented on GitHub (Dec 20, 2025):

It is a bun issue that is being worked on.

@kommander commented on GitHub (Dec 20, 2025): It is a bun issue that is being worked on.
Author
Owner

@jpcaparas commented on GitHub (Jan 13, 2026):

For *nix users having this issue, here's a drop-in wrapper command based on this answer:

opencode() {
    local tmpdir="$HOME/.opencode/tmp"
    mkdir -p "$tmpdir"
    BUN_TMPDIR="$tmpdir" command opencode "$@"
}
@jpcaparas commented on GitHub (Jan 13, 2026): For *nix users having this issue, here's a drop-in wrapper command based on [this answer](https://github.com/anomalyco/opencode/issues/5175#issuecomment-3621094440): ```bash opencode() { local tmpdir="$HOME/.opencode/tmp" mkdir -p "$tmpdir" BUN_TMPDIR="$tmpdir" command opencode "$@" } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3361