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.)
C-h f server-start
says:To force-start a server, do M-x server-force-delete and then M-x server-start.
– NickD Mar 30 '22 at 18:42