Unable to connect to Linux Server, Error: Could not acquire lock after multiple attempts

Describe the Bug

I have attempted to connect to Linux Server using Anysphere Remote SSH. I have previously been able to connect to this server using VS Code Remote SSH on a different computer but no luck with Anysphere Remote SSH.
The Server is Linux, I believe Ubuntu.

Steps to Reproduce

unsure

Operating System

Linux

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.1.6
VSCode Version: 1.96.2
Commit: 5b19bac7a947f54e4caa3eb7e4c5fbf832389850
Date: 2025-06-25T02:13:33.781Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Linux x64 6.14.2-surface-1

Additional Information

Here is the log (I can dm the rest if need be):


2025-07-01 11:36:29.374 [info] (ssh_tunnel) stderr: touch: cannot touch '/run/user/1004/cursor-remote-lock.1819e56f57308d17c326f9ea8b2f716a.target': No such file or directory
ln: failed to access '/run/user/1004/cursor-remote-lock.1819e56f57308d17c326f9ea8b2f716a.target': No such file or directory

2025-07-01 11:36:30.434 [info] (ssh_tunnel) stdout: Install in progress, sleeping for a bit...

2025-07-01 11:36:30.434 [info] (ssh_tunnel) stderr: touch: cannot touch '/run/user/1004/cursor-remote-lock.1819e56f57308d17c326f9ea8b2f716a.target': No such file or directory
ln: failed to access '/run/user/1004/cursor-remote-lock.1819e56f57308d17c326f9ea8b2f716a.target': No such file or directory

2025-07-01 11:36:31.464 [info] (ssh_tunnel) stdout: 0a504880ff860acd0f84cfc1: start
exitCode==1==
nodeExecutable==/home/--redacted--/.cursor-server/bin/5b19bac7a947f54e4caa3eb7e4c5fbf832389850/node==
multiplexListeningOn====
multiplexConnectionToken====
codeListeningOn====
errorMessage==Could not acquire lock after multiple attempts==
isFatalError====
codeConnectionToken====
detectedPlatform==linux==
arch==x64==
SSH_AUTH_SOCK====
0a504880ff860acd0f84cfc1: end

2025-07-01 11:36:31.465 [info] Server install command exit code:  1
2025-07-01 11:36:31.466 [error] Error installing server: Couldn't install Cursor Server, install script returned non-zero exit status: Could not acquire lock after multiple attempts
2025-07-01 11:36:31.467 [info] Deleting local script /tmp/cursor_remote_install_6394.sh
2025-07-01 11:36:31.467 [info] (ssh_tunnel) stderr: debug1: client_input_channel_req: channel 2 rtype exit-status reply 0
debug1: channel 2: free: client-session, nchannels 3
debug1: channel 0: free: port listener, nchannels 2
debug1: channel 1: free: port listener, nchannels 1
Transferred: sent 28476, received 14920 bytes, in 30.5 seconds
Bytes per second: sent 932.7, received 488.7
debug1: Exit status 1

2025-07-01 11:36:31.469 [error] Error resolving SSH authority Couldn't install Cursor Server, install script returned non-zero exit status: Could not acquire lock after multiple attempts
2025-07-01 11:36:31.469 [info] (ssh_tunnel): exit: code=1 signal=null

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hi @yubbygithubby, on your remote machine, could you try running killall bash? It sounds like there might be a leftover process that is holding onto the lockfile from a previous installation.

Could you also check that you have permission to write to /run/user/1004/? (E.g., in a terminal, does touch /run/user/1004/test.txt work?)

Hey @ravirahman,
Thanks for the quick reply.
I have no bash processes running.
/run/user/1004/ no directory.
I can’t make that directory either as I don’t have permissions.
Is there a way to change the location of the lock file cursor writes to?

The /run/user/1004 comes from the XDG_RUNTIME_DIR env var. It sounds like this is being set incorrectly. Could you try setting this explicitly in your .bashrc, .bash_profile, or .profile (on your remote machine) to /tmp by adding the following line (assuming that /tmp exists)?

export XDG_RUNTIME_DIR=/tmp

That worked Thanks

1 Like

For those looking at this later, these are the instructions from ChatGPT.

  1. Choose which file to edit:
   - ~/.bashrc — runs for interactive non-login shells
   - ~/.bash_profile — runs for login shells
   - ~/.profile — also for login shells, sometimes sourced by .bash_profile
  1. Edit the file:

    echo 'export XDG_RUNTIME_DIR=/tmp' >> ~/.bash_profile
    OR
    nano ~/.bash_profile → Then add the line: export XDG_RUNTIME_DIR=/tmp

  2. Reload the file: source ~/.bash_profile

  3. Verify with: echo $XDG_RUNTIME_DIR

    • Output should be: /tmp

It works. Thanks!

Thanks @yubbygithubby for reporting this issue and for the workaround. We fixed this issue in version 1.0.20 of the extension – we’ll fall back to /tmp if the directory set in XDG_RUNTIME_DIR is not writable or doesn’t exist.