Fixing rtorrent: Could not lock session directory

By | June 11, 2009

rTorrent is a very cool torrent client used in *nix based systems. I have been using it on my Apple TV now for a few weeks with very good results.

Recently the weather here in St. Louis has been stormy and it knocked out my electricity. When the power came back on, I couldn’t get rTorrent started and I was getting this error:

rtorrent: Could not lock session directory: “/Users/frontrow/.rtorrent_session/”, held by “appletv:+189”.

The fix was pretty easy, I went into the .rtorrent_session directory and removed the rtorrent.lock file.

cd ~/.rtorrent_session/
rm -f rtorrent.lock

That was all there was to it, once I removed the lock file I was able to start rTorrent.

30 thoughts on “Fixing rtorrent: Could not lock session directory

  1. FullProof

    I read a bunch of complicated solutions before getting to this one. First to actually work, and it did so perfectly!

  2. Miguel

    Thanks! I wonder if there’s a way to detect and delete “stale” lock files in this case.

  3. BobbyBooey

    Thanks!! And now I know where all the cool command line kids hang out!! 😉

  4. joe

    run this command at startup
    rm “/home/jb/Downloads/torrent/.session/*.lock”

    or (to load rtorrent as well) run this command at startup
    rm “/home/jb/Downloads/torrent/.session/*.lock” ;rtorrent

    or (to load rtorrent in background) run this command at startup
    rm “/home/jb/Downloads/torrent/.session/*.lock” ;screen -d -m -S rtorrent rtorrent

  5. Ryukia

    After removing the .lock file I still couldn’t start rtorrent and got the different message “couldn’t lock directory .session”. Turned out I couldn’t start rtorrent while I was still in the .session directory. After switching to ~home I could start rtorrent normaly.

  6. Keith Slater Post author

    Yep, I ran into this exact issue a few weeks ago and referred back to here to remember what I did to fix it.

  7. Roman

    Thanks man! Added this line to systemd daemon. Works like a charm 🙂

  8. just some guy

    I’m having this issue, but I don’t have any files in the session directory. I’m trying to run rTorrent in a podman container, with the session directory being mounted in the host system. I have no idea why the permissions aren’t working since the owner is 1000:1000 (the user that runs the rTorrent binary in the container, and also the host system’s user). The permissions are drwxr-xr-x. I have also mounted the volume with the “z” option, so in my understanding it should automatically use the proper SELinux context as well. I wish there was a way to get a more detailed error message on why exactly the permissions don’t work.

  9. just some guy

    Well, I fixed it. Apparently rTorrent does not like if the directory already exists by the time it is launched. I removed the mount from my compose file and it works now.

Leave a Reply

Your email address will not be published. Required fields are marked *