0

Trying to get Emacs setup on a new install and have copied my config over to ~/.config/emacs/. Its not perfect so I have manually installed auto-compile with M-x package-install auto-compile and similar for direnv.

The configuration works fine on four other systems.

Daemon errors

If I start as a daemon I see the following errors...

192.168.1.39 (default) ❱ journalctl --user -xeu emacs.service                                                                                                                                                                              
Apr 30 22:09:40 crow emacs[44386]: Loading /home/neil/.config/emacs/recentf...                                                                                                                                                             
Apr 30 22:09:40 crow emacs[44386]: Loading /home/neil/.config/emacs/recentf...done
Apr 30 22:09:40 crow emacs[44386]: Cleaning up the recentf list...
Apr 30 22:09:40 crow emacs[44386]: Cleaning up the recentf list...done (0 removed)
Apr 30 22:09:40 crow emacs[44386]:  ■  Warning (initialization): An error occurred while loading ‘/home/neil/.config/emacs/init.el’:
Apr 30 22:09:40 crow emacs[44386]: File is missing: Cannot open load file, No such file or directory, direnv
Apr 30 22:09:40 crow emacs[44386]: To ensure normal operation, you should investigate and remove the
Apr 30 22:09:40 crow emacs[44386]: cause of the error in your initialization file.  Start Emacs with
Apr 30 22:09:40 crow emacs[44386]: the ‘--debug-init’ option to view a complete error backtrace.
Apr 30 22:09:40 crow emacs[44386]: Emacs ready in 7.61 seconds with 34 garbage collections.
Apr 30 22:09:40 crow emacs[44386]: Cannot open load file: No such file or directory, emacs
Apr 30 22:09:40 crow emacs[44386]: Wrote /home/neil/.config/emacs/recentf
Apr 30 22:09:40 crow systemd[871]: emacs.service: Main process exited, code=exited, status=255/EXCEPTION
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ An ExecStart= process belonging to unit UNIT has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 255.
Apr 30 22:09:40 crow systemd[871]: emacs.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit UNIT has entered the 'failed' state with result 'exit-code'.
Apr 30 22:09:40 crow systemd[871]: Failed to start Emacs text editor.
░░ Subject: A start job for unit UNIT has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has finished with a failure.
░░ 
░░ The job identifier is 68155 and the job result is failed.
Apr 30 22:09:40 crow systemd[871]: emacs.service: Consumed 2.852s CPU time, 76.6M memory peak.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit UNIT completed and consumed the indicated resources.
Apr 30 22:09:40 crow systemd[871]: emacs.service: Scheduled restart job, restart counter is at 3711.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ Automatic restarting of the unit UNIT has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Apr 30 22:09:40 crow systemd[871]: Starting Emacs text editor...
░░ Subject: A start job for unit UNIT has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has begun execution.
░░ 
░░ The job identifier is 68173.
Apr 30 22:09:40 crow emacs[44396]: Warning: due to a long standing Gtk+ bug
Apr 30 22:09:40 crow emacs[44396]: https://gitlab.gnome.org/GNOME/gtk/issues/221 
Apr 30 22:09:40 crow emacs[44396]: Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Apr 30 22:09:40 crow emacs[44396]: Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
Apr 30 22:09:40 crow emacs[44396]: Error loading autoloads: (file-missing Cannot open load file No such file or directory /home/neil/.config/emacs/elpa/with-shell-interpreter-20230916.1420/with-shell-interpreter-autoloads)
Apr 30 22:09:40 crow emacs[44396]: Error loading autoloads: (file-missing Cannot open load file No such file or directory /home/neil/.config/emacs/elpa/vertico-20250406.1754/vertico-autoloads)
Apr 30 22:09:40 crow emacs[44396]: Error loading autoloads: (file-missing Cannot open load file No such file or directory /home/neil/.config/emacs/elpa/dash-20250312.1307/dash-autoloads)
Apr 30 22:09:40 crow emacs[44396]: Error loading autoloads: (file-missing Cannot open load file No such file or directory /home/neil/.config/emacs/elpa/direnv-20240314.715/direnv-autoloads)
Apr 30 22:09:40 crow emacs[44396]: Importing package-keyring.gpg...
Apr 30 22:09:40 crow emacs[44396]: Importing package-keyring.gpg...done
Apr 30 22:09:40 crow emacs[44396]: Contacting host: elpa.gnu.org:443
Apr 30 22:09:42 crow emacs[44396]: Contacting host: elpa.gnu.org:443
Apr 30 22:09:43 crow emacs[44396]: Package refresh done
Apr 30 22:09:43 crow emacs[44396]: Failed to download ‘GNU ELPA’ archive.
Apr 30 22:09:43 crow emacs[44396]: Contacting host: elpa.nongnu.org:443
Apr 30 22:09:44 crow emacs[44396]: Contacting host: elpa.nongnu.org:443
Apr 30 22:09:45 crow emacs[44396]: Package refresh done
Apr 30 22:09:45 crow emacs[44396]: Contacting host: stable.melpa.org:443
Apr 30 22:09:46 crow emacs[44396]: Package refresh done
Apr 30 22:09:46 crow emacs[44396]: Failed to download ‘MELPA Stable’ archive.
Apr 30 22:09:46 crow emacs[44396]: Contacting host: melpa.org:443
Apr 30 22:09:47 crow emacs[44396]: Package refresh done
Apr 30 22:09:47 crow emacs[44396]: Failed to download ‘MELPA’ archive.
Apr 30 22:09:47 crow emacs[44396]: Contacting host: jcs-emacs.github.io:443
Apr 30 22:09:48 crow emacs[44396]: Contacting host: jcs-emacs.github.io:443

Plain Emacs --debug-init

If I start Emacs with --debug-init I get the following...

Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "direnv")
  #<subr require>(direnv nil nil)
  apply(#<subr require> (direnv nil nil))
  require(direnv nil nil)
  load-with-code-conversion("/home/neil/.config/emacs/init.el" "/home/neil/.config/emacs/init.el" t t)
  load("/home/neil/.config/emacs/init" noerror nomessage)
  #f(compiled-function () #<bytecode 0x1591854d2977da11>)()
  #f(compiled-function () #<bytecode -0x4307d7bb01d2857>)()
  handler-bind-1(#f(compiled-function () #<bytecode -0x4307d7bb01d2857>) (error) startup--debug)
  startup--load-user-init-file(#f(compiled-function () #<bytecode -0x1c08d798ad3dcdf9>) #f(compiled-function () #<bytecode 0x6ec4ccc424e8bfe>) t)
  command-line()
  normal-top-level()

...which I don't understand as ~/.config/emacs/elpa/direnv-20240314.715 exists although that clearly isn't the problem since the error message doesn't include the date/time of package release...

❱ ls -l ~/.config/emacs/elpa/
192.168.1.39 (default) ❱ l ~/.config/emacs/elpa 
drwxr-xr-x neil neil 4.0 KB Mon Apr 14 20:53:31 2025  .
drwxr-xr-x neil neil 4.0 KB Wed Apr 30 22:06:11 2025  ..
drwxr-xr-x neil neil 4.0 KB Mon Apr 14 20:47:17 2025  archives
drwxr-xr-x neil neil 4.0 KB Mon Apr 14 20:47:47 2025  auto-compile-20250414.1548
drwxr-xr-x neil neil 4.0 KB Mon Apr 14 20:49:48 2025  dash-20250312.1307
drwxr-xr-x neil neil 4.0 KB Mon Apr 14 20:53:31 2025  direnv-20240314.715
drwxr-xr-x neil neil 4.0 KB Mon Apr 14 20:48:55 2025  gnu-elpa-keyring-update-2022.12.1
.rw-r--r-- neil neil 156 B  Mon Apr 14 20:48:55 2025  gnu-elpa-keyring-update-2022.12.1.signed
drwx------ neil neil 4.0 KB Wed Apr 30 22:06:14 2025  gnupg
drwxr-xr-x neil neil 4.0 KB Mon Apr 14 20:50:09 2025  vertico-20250406.1754
drwxr-xr-x neil neil 4.0 KB Mon Apr 14 20:50:18 2025  with-shell-interpreter-20230916.1420

...and direnv is installed...

❱ which direnv
/usr/bin/direnv

I'm stumped as to how to proceed, as mentioned the same config works fine on other systems.

UPDATE

Thanks @db48x and @Philippe Carphin for helping me with this.

I should have linked to my config (sorry was late).

I found there was an errant ~/.emacs.d/ which I've now removed and removed ~/.config/emacs and started again, cloning.

rm -rf ~/.config/emacs
cd ~/.config
git clone [email protected]:nshephard/emacs.git
cd emacs
git switch crow
emacs --debug-init

This got as far as trying to load my configuration from ~/.config/emacs/settings/completion.el. Vertico was installed...

~/.config/emacs ❱ ls -l elpa                                       
drwxr-xr-x neil neil 4.0 KB Thu May  1 09:02:47 2025  .
drwxr-xr-x neil neil 4.0 KB Thu May  1 09:09:15 2025  ..
drwxr-xr-x neil neil 4.0 KB Thu May  1 08:35:30 2025  archives
drwxr-xr-x neil neil 4.0 KB Thu May  1 09:02:44 2025  auto-compile-20250414.1548
drwxr-xr-x neil neil 4.0 KB Thu May  1 09:02:46 2025  gnu-elpa-keyring-update-2022.12.1
.rw-r--r-- neil neil 156 B  Thu May  1 09:02:46 2025  gnu-elpa-keyring-update-2022.12.1.signed
drwx------ neil neil 4.0 KB Thu May  1 09:09:19 2025  gnupg
drwxr-xr-x neil neil 4.0 KB Thu May  1 09:02:47 2025  vertico-20250419.816

...but it crashed out with...

 1 Debugger entered--Lisp error: (void-function vertico-mode)
 2   (vertico-mode)
 3   load-with-code-conversion("/home/neil/.config/emacs/settings/completion.el" "/home/neil/.config/emacs/settings/completion.el" nil nil)
 4   #<subr load>("~/.config/emacs/settings/completion.el")
 5   apply(#<subr load> "~/.config/emacs/settings/completion.el")
 6   load("~/.config/emacs/settings/completion.el")
 7   load-with-code-conversion("/home/neil/.config/emacs/init.el" "/home/neil/.config/emacs/init.el" t t)
 8   load("/home/neil/.config/emacs/init" noerror nomessage)
 9   #f(compiled-function () #<bytecode 0xc2df6fb487cda11>)()
10   #f(compiled-function () #<bytecode -0x4307d7bb01d2857>)()
11   handler-bind-1(#f(compiled-function () #<bytecode -0x4307d7bb01d2857>) (error) startup--debug)
12   startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1830e266c4a4c207>) #f(compiled-function () #<bytecode 0x6ec4ccc424e8bfe>) t)
13   command-line()
14   normal-top-level()

C-h v load-path then fails with....

 1 Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "emacs")
 2   highlight-indent-guides-mode()
 3   run-hooks(change-major-mode-after-body-hook prog-mode-hook lisp-data-mode-hook)
 4   apply(run-hooks change-major-mode-after-body-hook (prog-mode-hook lisp-data-mode-hook))
 5   run-mode-hooks(lisp-data-mode-hook)
 6   lisp-data-mode()
 7   #f(compiled-function () #<bytecode 0xfe453c88994cd1d>)()
 8   help--window-setup("*Help*" #f(compiled-function () #<bytecode 0xfe453c88994cd1d>))
 9   describe-variable(load-path)
10   funcall-interactively(describe-variable load-path)
11   command-execute(describe-variable)
12   recursive-edit()
13   debug(error (void-function vertico-mode) :backtrace-base startup--debug)
14   startup--debug((void-function vertico-mode))
15   (vertico-mode)
16   load-with-code-conversion("/home/neil/.config/emacs/settings/completion.el" "/home/neil/.config/emacs/settings/completion.el" nil nil)
17   #<subr load>("~/.config/emacs/settings/completion.el")
18   apply(#<subr load> "~/.config/emacs/settings/completion.el")
19   load("~/.config/emacs/settings/completion.el")
20   load-with-code-conversion("/home/neil/.config/emacs/init.el" "/home/neil/.config/emacs/init.el" t t)
21   load("/home/neil/.config/emacs/init" noerror nomessage)
22   #f(compiled-function () #<bytecode 0xc2df6fb487cda11>)()
23   #f(compiled-function () #<bytecode -0x4307d7bb01d2857>)()
24   handler-bind-1(#f(compiled-function () #<bytecode -0x4307d7bb01d2857>) (error) startup--debug)
25   startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1830e266c4a4c207>) #f(compiled-function () #<bytecode 0x6ec4ccc424e8bfe>) t)
26   command-line()
27   normal-top-level()
4
  • I have never used Emacs as a service with before. It is unclear to me in the output of journalctl what the output is. It looks like the partial output of two separate attempts to start emacs. If you do emacs --daemon in an interactive shell, what is the output (without --debug-init). Commented Apr 30 at 22:12
  • 1
    Your (require 'direnv) is failing probably because the directory that contains direnv.el is not a member of load-path (C-h v it to check) which seems to be in line with the error message "Error loading autoloads ...direnv-1234/direnv-autoloads". That message is from (package-initialize). Specifically package-activate-1. package-initialize does stuff that ends up calling package-activate-1 for all-ish the directories in your elpa. Looks like something goes wrong in the process so it doesn't get to the part where it adds that directory to load-path. Commented Apr 30 at 22:17
  • The direnv that is not found is not the executable direnv but the file direnv.el from ~/.config/emacs/elpa/direnv-1234. The file probably exists but that directory hasn't been added to load-path. Sorry, I can't see what could be causing the problem so I just told you a bunch of random things that I noticed that felt relevant. Commented Apr 30 at 22:21
  • Yes I found an errant ~/.emacs.d but have still got some problems, have updated original question with more info and current problem. Commented May 1 at 8:04

2 Answers 2

1

...which I don't understand as ~/.config/emacs/elpa/direnv-20240314.715 exists although that clearly isn't the problem since the error message doesn't include the date/time of package release...

It’s running the code (require 'direnv) from your init.el. The fact that it cannot find the correct file to load means that either it doesn’t exist (maybe that directory is empty?), or that directory is not in your load-path variable. The Emacs package manager is supposed to add the directory containing every installed package to the load-path so that require (and similar functions) can find the installed packages. Did you just copy the emacs config directory to your new computer, or did you actually install these packages with M-x install-package? What is the value of load-path?

1
  • I git clone'd my config files, started Emacs. The load-path issue helped me discover that I must have started Emacs as this user early as there was a ~/.emacs.d/ directory that shouldn't have been there. Config should install packages via use-package but after installing can't find the paths, unhelpfully C-h v load-path shows Cannot open load file: No such file or directory, emacs which is related to a problem with vertico. Commented May 1 at 8:03
0

I found the source of my woes which was two fold.

  1. As both @db48x and @Philippe Carphin highlighted, there was an issue with my load-path. I'd unwittingly introduced a ~/.emacs.d/ directory which takes precedence over ~/.config/emacs/ where packages had been installed.

  2. After resolving that I still had errors (see above UPDATE in original post). These were caused because I had a line early in my config to (prog-mode . highlight-indent-guides-mode) before this package had been installed. That is now set under the packages own (use-package highlight-indent-guides-mode ...) and my config works.

Thanks both for your patient help and guidance.

1
  • You should be able to accept your own answer now. Commented May 5 at 16:10

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.