After enabling the sandbox on Ubuntu, apt update warns about duplicate repositories

Where does the bug appear (feature/product)?

Somewhere else…

Describe the Bug

Problem

I was seeing cursor-sandbox errors, so I tried to fix them.

  1. Following only what Cursor’s docs say was not enough to clear the error
    Because of sandbox errors on Ubuntu, I followed:
    https://cursor.com/en-US/docs/agent/tools/terminal

That alone wasn’t sufficient, so I additionally edited /etc/apparmor.d/cursor-sandbox.

  1. apt update started showing duplicate-repository warnings
    When I ran apt update, I got a large number of warnings like:
Warning: ターゲット Packages (main/binary-amd64/Packages) は /etc/apt/sources.list.d/cursor-apparmor.sources:1 と /etc/apt/sources.list.d/cursor.sources:1 で複数回設定されています

# English translation
Warning: Target Packages (main/binary-amd64/Packages) is configured more than once in /etc/apt/sources.list.d/cursor-apparmor.sources:1 and /etc/apt/sources.list.d/cursor.sources:1
  • Disabling the original cursor.sources: On the next Cursor update, cursor.sources comes back and the duplicate warning returns.
  • Disabling cursor-apparmor.sources: The sandbox error comes back.

Steps to Reproduce

Problem 1 Clearing the cursor-sandbox error

# Install cursor-sandbox-apparmor.deb
curl -fsSL https://downloads.cursor.com/lab/enterprise/cursor-sandbox-apparmor_0.4.0_all.deb -o cursor-sandbox-apparmor.deb
sudo dpkg -i cursor-sandbox-apparmor.deb

# Restart Cursor and confirm the error is still present

# Create sysctl config to relax AppArmor’s restriction on unprivileged user namespaces
echo 'kernel.apparmor_restrict_unprivileged_userns = 0' | sudo tee /etc/sysctl.d/99-cursor-sandbox-userns.conf

# Apply the setting immediately
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

# Reload AppArmor
sudo systemctl reload apparmor

# Restart Cursor and confirm the error is still present

# Patch and replace cursor-sandbox
# Please paste the source code provided at the end of this document.
vim cursor-sandbox.apparmor.patched
sudo cp cursor-sandbox.apparmor.patched /etc/apparmor.d/cursor-sandbox
sudo systemctl reload apparmor

# Restart Cursor and confirm the error is gone

# After a few days, confirm duplicate-repository warnings appear
sudo apt update

Problem 2 Addressing duplicate-repository warnings from apt update

# Confirm duplicate-repository warnings appear
sudo apt update

# Confirm there is no difference between the files
sudo diff /etc/apt/sources.list.d/cursor.sources /etc/apt/sources.list.d/cursor-apparmor.sources

# Disable cursor.sources
sudo mv /etc/apt/sources.list.d/cursor.sources /etc/apt/sources.list.d/cursor.sources.disabled

# Confirm duplicate-repository warnings no longer appear
sudo apt update

# After a few days, confirm duplicate-repository warnings appear again
sudo apt update

# Prevent cursor-apparmor.sources from being placed under /etc/apt/sources.list.d/
sudo dpkg-divert --add --local --divert /etc/apt/sources.list.d/cursor-apparmor.sources.pkg-dpkg-new --rename /etc/apt/sources.list.d/cursor-apparmor.sources

# Confirm duplicate-repository warnings no longer appear
sudo apt update

# After a few days, confirm the Cursor sandbox error appears again

# Restore cursor-apparmor.sources
sudo dpkg-divert --remove --local /etc/apt/sources.list.d/cursor-apparmor.sources
sudo mv /etc/apt/sources.list.d/cursor-apparmor.sources.pkg-dpkg-new /etc/apt/sources.list.d/cursor-apparmor.sources

# Confirm duplicate-repository warnings appear again
sudo apt update

/etc/apparmor.d/cursor-sandbox

profile cursor_sandbox /usr/share/cursor/resources/app/resources/helpers/cursorsandbox {
  file,
  /** ix,

  capability sys_admin,
  capability net_admin,
  capability chown,
  capability setuid,
  capability setgid,
  capability setpcap,

  userns,

  signal (send, receive) peer=cursor-system,

  network unix dgram,
  network unix stream,

  mount,
  remount,
  umount,

  /usr/share/cursor/resources/app/resources/helpers/cursorsandbox mr,
}

profile cursor_sandbox_remote /home/*/.cursor-server/bin/*/*/resources/helpers/{cursor-sandbox,cursorsandbox} {
  file,
  /** ix,

  capability sys_admin,
  capability net_admin,
  capability chown,
  capability setuid,
  capability setgid,
  capability setpcap,

  userns,

  signal (send, receive) peer=cursor-system,

  network unix dgram,
  network unix stream,

  mount,
  remount,
  umount,

  /home/*/.cursor-server/bin/*/*/resources/helpers/{cursor-sandbox,cursorsandbox} mr,
}

Expected Behavior

Neither the sandbox error nor duplicate-repository warnings on apt update should occur.

Screenshots / Screen Recordings

Operating System

Linux

Version Information

Version: 2.6.20
VSCode Version: 1.105.1
Commit: b29eb4ee5f9f6d1cb2afbc09070198d3ea6ad760
Date: 2026-03-17T01:50:02.404Z
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Linux x64 6.17.0-19-generic

Additional Information

Does this stop you from using Cursor

No - Cursor works, but with this issue

1 Like

Hey, thanks for the detailed report. The repro steps are really solid.

This is a packaging bug. The cursor-sandbox-apparmor postinst script creates cursor-apparmor.sources with the same contents as cursor.sources from the main Cursor .deb, and neither checks if the other one already exists. I’ve passed this to the team.

Temporary workaround: You can safely delete one of the files and keep only cursor.sources:

sudo rm /etc/apt/sources.list.d/cursor-apparmor.sources

Cursor will keep getting updates via cursor.sources. When you update the cursor-sandbox-apparmor package, the file may come back. If it does, just delete it again.

About the incomplete AppArmor profile with missing network unix rules, that’s also a known issue and the team is aware. Your patch looks like a correct workaround.

Also, you’re on apparmor deb version 0.4.0. 0.6.0 is already available in the repo, so it’s worth upgrading:

sudo apt update && sudo apt install --only-upgrade cursor-sandbox-apparmor

Let me know if you need anything else.

2 Likes

Thanks for your reply.
Since it doesn’t affect the cursor’s functionality, I’ll wait for the updated version.

1 Like