2

I was running Emacs in daemon server mode when my computer was force rebooted. After reboot was complete, I could not start the Emacs server again, receiving the error message:

Starting Emacs daemon.
Unable to start the daemon.
Another instance of Emacs is running the server, either as daemon or interactively.

How do I remedy this?

1
  • 2
    C-h f server-start says: To force-start a server, do M-x server-force-delete and then M-x server-start.
    – NickD
    Commented Mar 30, 2022 at 18:42

1 Answer 1

5

To prevent multiple daemon sessions with the same name running, Emacs daemon server uses a lock file. Normally when the daemon stops (say by running kill-emacs), it deletes this file as part of cleanup, but in the case of a forced PC restart or shutdown (say via power loss) the lock file may remain despite no daemon running. This will prevent a new daemon from starting.

There are a few ways to resolve this.

Solution #1: start up Emacs without a daemon, run M-x server-force-delete to delete the lockfile, then start the daemon (say via M-x server-start).

Solution #2: delete the lockfile, typically stored under ~/.emacs.d/server/server or /run/user/<uid>/server. (The exact name of the lockfile may differ if you name your sessions.)

1
  • 1
    It can also end up in /run/user/<uid>/server.
    – db48x
    Commented Mar 30, 2022 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.