Where does the bug appear (feature/product)?
Cursor CLI
Describe the Bug
Hi Cursor team,
I’m reporting a reproducible Linux issue with Cursor Agent CLI sandbox preflight on a shared Ubuntu-style host. It blocks normal agent sandbox run / workspace sandboxing, but the same command succeeds when wrapped in strace -f -o /dev/null. This
looks like an interaction between cursorsandbox, user namespaces, and AppArmor’s unprivileged-userns restriction, not a simple “kernel doesn’t support namespaces” problem.
Environment
• OS: Linux (shared cluster login node), user is not in sudoers.
• Cursor Agent CLI / cursorsandbox path (example):
~/.local/share/cursor-agent/versions/2026.05.07-42ddaca/cursorsandbox
• uname / distro: Linux iwashi 6.8.0-79-generic #79-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 12 14:42:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
• Agent version: 2026.05.07-42ddaca
Kernel / AppArmor
• sysctl kernel.unprivileged_userns_clone → 1
• /proc/sys/kernel/apparmor_restrict_unprivileged_userns → 1
• sysctl kernel.unprivileged_userns_apparmor_policy → (not present / empty on this kernel)
Control tests
• Manual Bubblewrap:
bwrap --unshare-user --ro-bind / / --proc /proc --dev /dev true → OK (namespaces work in principle from this user).
• Fails (preflight EPERM):
agent sandbox run --sb-debug -- ls -la
Error (abridged): Linux preflight exit 2; Landlock + Bubblewrap paths both fail at user namespace step: Failed to unshare namespaces: EPERM.
• Succeeds:
strace -f -o /dev/null agent sandbox run --sb-debug -- ls -la
→ exit 0, sandbox debug dirs created, command runs.
• Does not fix:
/usr/bin/time -v agent sandbox run --sb-debug -- ls -la → fails (so this is not explained by “generically slower”).
Namespace / AppArmor evidence (when run succeeds under strace)
From inside the sandbox wrapper (successful run):
• Host /proc/self/attr/current: unconfined
• Inside sandbox: cursor_sandbox_agent_cli (enforce)
• Host user ns inode vs inside: different (readlink /proc/self/ns/user changes)
• uid_map inside: 0 1348 1 mapping host UID to namespace root; id shows uid=0(root) inside userns.
So the success path is a real user namespace + expected AA profile, not a spurious exit code.
Ask
- Please treat this as a CLI / cursorsandbox preflight bug on systems with apparmor_restrict_unprivileged_userns=1, possibly involving profile attachment order vs userns_create, or an unintended sensitivity to ptrace (timing / task context).
- Guidance for shared HPC / locked-down hosts: recommended AppArmor policy knobs or a supported way to run Agent with reliable sandbox when this sysctl is on.
I can provide full strace excerpts, cursorsandbox paths, and stdout/stderr from debug dirs on request.
Steps to Reproduce
-
On a Linux host where /proc/sys/kernel/apparmor_restrict_unprivileged_userns is 1 (and kernel.unprivileged_userns_clone is 1), install/use Cursor Agent CLI so it uses the bundled helper, e.g.
~/.local/share/cursor-agent/versions//cursorsandbox.
-
From your normal user shell (not under strace), run:
agent sandbox run --sb-debug – ls -la
-
Observe the command fail during Linux sandbox preflight with an error like:
Failed to unshare namespaces: EPERM (Landlock and Bubblewrap paths both reporting namespace setup failure), and a non-zero exit status.
-
Without changing AppArmor/sysctl, run the same command under strace with trace output discarded:
strace -f -o /dev/null agent sandbox run --sb-debug – ls -la
-
Observe this succeeds: exit code 0, sandbox debug output under /tmp/cursor-sandbox-*, and normal “command success” messaging.
-
(Optional control) Confirm namespaces work in principle for the user:
bwrap --unshare-user --ro-bind / / --proc /proc --dev /dev true
and that slowing the command without ptrace does not fix it, e.g.:
/usr/bin/time -v agent sandbox run --sb-debug – ls -la
still fails.
Expected Behavior
• agent sandbox run should consistently pass Linux sandbox preflight when the host allows unprivileged user namespaces under policy (as verified by independent checks such as bwrap … true succeeding and unprivileged_userns_clone=1).
• Behavior should not depend on whether the process tree is run under strace/ptrace (e.g. strace -f -o /dev/null should not be required for preflight to succeed).
• When the sandbox starts, the workload should run under Cursor’s intended confinement (e.g. AppArmor shows cursor_sandbox_agent_cli (enforce) inside the sandbox, with a new user namespace and sensible uid_map, e.g. 0 <host_uid> 1 for a
single-UID map)—and that same outcome should be achievable from a plain agent sandbox run invocation, not only under strace.
Operating System
Linux
Version Information
2026.05.07-42ddaca
Does this stop you from using Cursor
Sometimes - I can sometimes use Cursor