I want to run Emacs as a service and connect to it with a client. I followed the instructions here:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html and ran the command systemctl --user enable emacs This apparently creates a file at ~/.config/systemd/user/default.target.wants/emacs.service whose contents are: [Unit] Description=Emacs text editor Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ [Service] Type=notify ExecStart=/usr/local/bin/emacs --fg-daemon # Emacs will exit with status 15 after having received SIGTERM, which # is the default "KillSignal" value systemd uses to stop services. SuccessExitStatus=15 # The location of the SSH auth socket varies by distribution, and some # set it from PAM, so don't override by default. # Environment=SSH_AUTH_SOCK=%t/keyring/ssh Restart=on-failure [Install] WantedBy=default.target The directions also say: (If your Emacs was installed into a non-standard location, you may need to copy the emacs.service file to a standard directory such as ~/.config/systemd/user/.) I built this emacs distribution from source and installed it using "sudo make install"; the executable is at /usr/local/bin/emacs, so I don't think it is installed in a non-standard location, and so I did not follow these instructions. I modified the [Service] command above to include the -Q flag for the purposes of this bug report. After activating the service, restarting, etc., my journalctl output is as follows: Sep 07 12:52:45 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: emacs.service: start operation timed out. Terminating. Sep 07 12:52:45 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: emacs.service: Failed with result 'timeout'. Sep 07 12:52:45 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: Failed to start emacs.service - Emacs text editor. Sep 07 12:52:46 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: emacs.service: Scheduled restart job, restart counter is at 1. Sep 07 12:52:46 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: Starting emacs.service - Emacs text editor... Sep 07 12:52:46 patrick-ThinkPad-X1-Carbon-Gen-10 emacs[183514]: Starting Emacs daemon. Sep 07 12:54:16 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: emacs.service: start operation timed out. Terminating. Sep 07 12:54:16 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: emacs.service: Failed with result 'timeout'. Sep 07 12:54:16 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: Failed to start emacs.service - Emacs text editor. Sep 07 12:54:16 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: emacs.service: Scheduled restart job, restart counter is at 2. Sep 07 12:54:16 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: Starting emacs.service - Emacs text editor... Sep 07 12:54:16 patrick-ThinkPad-X1-Carbon-Gen-10 emacs[183623]: Starting Emacs daemon. Sep 07 12:55:46 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: emacs.service: start operation timed out. Terminating. Sep 07 12:55:46 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: emacs.service: Failed with result 'timeout'. Sep 07 12:55:46 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: Failed to start emacs.service - Emacs text editor. Sep 07 12:55:47 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: emacs.service: Scheduled restart job, restart counter is at 3. Sep 07 12:55:47 patrick-ThinkPad-X1-Carbon-Gen-10 systemd[2704]: Starting emacs.service - Emacs text editor... Sep 07 12:55:47 patrick-ThinkPad-X1-Carbon-Gen-10 emacs[183684]: Starting Emacs daemon. etc., etc., every ninety seconds. For some reason emacs is not successfully communicating to systemd that it has launched successfully, and so systemd terminates emacs. In GNU Emacs 29.4 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-08-30 built on patrick-ThinkPad-X1-Carbon-Gen-10 System Description: Ubuntu 24.04.1 LTS Configured using: 'configure --with-native-compilation=aot --with-tree-sitter --with-gif --with-png --with-jpeg --with-rsvg --with-tiff --with-pgtk --with-imagemagick --with-x-toolkit=gtk3 --with-xwidgets' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ IMAGEMAGICK JPEG JSON LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr misearch multi-isearch emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp byte-compile cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads xwidget-internal dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo gtk pgtk lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 77452 8067) (symbols 48 7163 0) (strings 32 19673 2120) (string-bytes 1 600176) (vectors 16 15676) (vector-slots 8 327945 14726) (floats 8 44 40) (intervals 56 233 0) (buffers 984 12))