You are not logged in.
I found instructions on EmacsWiki for a systemd service file for running the emacs daemon at startup. It works just fine on my desktop, but for some reason it doesn't work on my laptop. Here's the service file (/etc/systemd/system/emacs@.service):
[Unit]
Description=Emacs: the extensible, self-documenting text editor
[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
Restart=always
User=%1
[Install]
WantedBy=multi-user.target
When I run "systemctl start emacs@<username>", it fails:
$ sudo systemctl status emacs@<username>.service
emacs@<username>.service - Emacs: the extensible, self-documenting text editor
Loaded: loaded (/etc/system/emacs@.service; enabled)
Active: failed (Result: start-limit) since Tue, 2013-01-01 09:19:09 AST; 4min 25s ago
Process: 5621 ExecStart=/user/bin/emacs --daemon (code=exited, status=217/USER)
CGroup: name=systemd:/system/emacs@.service/<username>
Any ideas why the exact same service file might start on one computer and fail on another? If I just run "emacs --daemon" manually (or in ~/.xinitrc) it starts just fine.
Thanks.
Last edited by ibrunton (2013-03-06 21:05:17)
Offline
You're not actually typing <username> are you?
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
You're not actually typing <username> are you?
Goodness, no. I'm putting my actual username there. I also did run "sudo systemctl enable emacs@<username>".
Offline
Good, sorry I had to ask, one never does know. Beyond that I don't have relevant experience.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
My output:
<username>.service - Emacs: the extensible, self-documenting text editor
Loaded: loaded (/etc/systemd/system/emacs@.service; enabled)
Active: active (running) since Tue, 2013-01-01 14:07:07 EST; 7min ago
Process: 4822 ExecStart=/usr/bin/emacs --daemon (code=exited, status=0/SUCCESS)
Main PID: 4823 (emacs)
CGroup: name=systemd:/system/emacs@.service/<username>
|-4823 /usr/bin/emacs --daemon
`-4833 /usr/bin/aspell -a -m -B --encoding=utf-8 --sug-mode=ultra
Have you tried running it with the default .emacs.d & init.el?
Offline
My output:
<username>.service - Emacs: the extensible, self-documenting text editor Loaded: loaded (/etc/systemd/system/emacs@.service; enabled) Active: active (running) since Tue, 2013-01-01 14:07:07 EST; 7min ago Process: 4822 ExecStart=/usr/bin/emacs --daemon (code=exited, status=0/SUCCESS) Main PID: 4823 (emacs) CGroup: name=systemd:/system/emacs@.service/<username> |-4823 /usr/bin/emacs --daemon `-4833 /usr/bin/aspell -a -m -B --encoding=utf-8 --sug-mode=ultra
Have you tried running it with the default .emacs.d & init.el?
Same result: failed, status=217/USER.
Offline
What is the output of ps -aux | grep emacs ?
Offline
What is the output of ps -aux | grep emacs ?
$ ps aux | grep emacs
ian 729 0.0 0.0 12112 1108 tty1 S+ 13:21 0:00 grep emacs
Offline
In that case, I can't be much help. I hoped the problem was related to the daemon already running.
While you look for a proper solution, you might be best off using
emacsclient -c -a ""
by binding it to something in your wm/de, or by making an alias for it in your .bashrc. It will start an emacs daemon if one isn't already running, then proceed to create a client window. (or emacsclient -t -a "" for in terminal)
Offline
[Unit] Description=Emacs: the extensible, self-documenting text editor [Service] Type=forking ExecStart=/usr/bin/emacs --daemon ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))" Restart=always User=%1 [Install] WantedBy=multi-user.target
That should be
User=%i
instead of
User=%1
You're welcome.
Offline