Deluge error after restart Ubuntu(I need to delete 2 files)

I added Deluge in Startup applications and sometimes after restart or shutdown, Deluge won't start. If I try to run it in terminal then I get the next error:

vas@LenovoZ580:~$ deluge
[ERROR   ] 11:18:36 ipcinterface:156 Deluge restart failed: Couldn't listen on any:/home/vas/.config/deluge/ipc/deluge-gtk: Cannot acquire lock.

If I delete /home/vas/.config/deluge/ipc/deluge-gtk and /home/vas/.config/deluge/ipc/deluge-gtk.lockthen Deluge starts normally.

How can I set that when I restart or shutdown the laptop, these 2 files to be deleted if they exist?


You could make a script that deletes the two files and set it to run at start-up.

Something like this:

#!/bin/bash
rm /home/vas/.config/deluge/ipc/deluge-gtk
rm /home/vas/.config/deluge/ipc/deluge-gtk.lock

You'll need to place your scripts in /etc/init.d/.

See: https://superuser.com/questions/155476/how-do-i-make-a-script-run-upon-startup-of-the-ubuntu-machine

Also here is a short tutorial on how to bash script: https://help.ubuntu.com/community/Beginners/BashScripting


This is a common error when Deluge don't exit cleanly. Some symbolic link gets broken and Deluge doesn't know what to do. But I do.

rm /home/vas/.config/deluge/ipc/deluge*

Then start Deluge.


There is an open bug ticket #2234 that would resolve the stale file issue.

An alternative to putting Deluge in startup apps would be to run the daemon in the background using upstart script and then connect with thinclient.