opencode icon indicating copy to clipboard operation
opencode copied to clipboard

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

Open falko-apheris opened this issue 1 month ago • 2 comments

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

falko-apheris avatar Dec 06 '25 20:12 falko-apheris

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] avatar Dec 06 '25 20:12 github-actions[bot]

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 avatar Dec 06 '25 20:12 falko-apheris