ricZola · 2022-03-17 20:09
I have moved to use Straight.el, everything worked great. I even tried to copy my config into another device, opened Emacs, Straight downloaded all packages automatically and Emacs there worked great too!
Then, I noticed that on the other device there is no `elpa` folder inside `.emacs.d`, I thought this makes sense as I don't use it anymore and disable it by putting `(setq package-enable-at-startup nil)` inside `early-init.el`. So I deleted the `elpa` folder, restarted emacs but now `emacsclient -c` tries to create a new frame but it gets crashed instantly without any error message. Restoring `elpa` folder solves the issue!
There is no mention to `elpa` folder in my configs.
How could I debug the issue?
MagpieMars · 2022-03-17 20:19
Do you still have the emacs daemon running?
I would try killing that, remove the elpa folder and see if the error persists
nv-elisp · 2022-03-17 20:29
Sound advice. OP can also launch Emacs directly from the command line via `emacs --debug-init` to start a fresh instance of Emacs. Hopefully this provides more information.
xircon · 2022-03-17 22:04
What nv-elisp says - it is trial and error, read the errors, use straight to add the package and then rinse and repeat until you get no errors.
ricZola · 2022-03-18 09:19
I restarted the daemon, and then the machine itself, but this did not solve the issue.
I want to add other info:
- Starting `emacs --debug-init` from the command line works just fine, with the following output in the Messages buffer:
````
Loading /home/tareef/.emacs.d/settings.el (source)...
[yas] Prepared just-in-time loading of snippets successfully.
Overriding package-menu--print-info with paradox--print-info
Overriding package-menu--print-info-simple with paradox--print-info
Overriding package-menu--generate with paradox--generate-menu
Overriding package-menu-mode with paradox-menu-mode
Loading /home/tareef/.emacs.d/settings.el (source)...done
Loaded /home/tareef/.emacs.d/settings.el
For information about GNU Emacs and the GNU system, type C-h C-a.
Emacs loaded in 1.59 seconds with 23 garbage collections.
````
- From there I can `M-x server-start` then I can create emacsclients also without any issue.
- Running `emacs --debug-init --fg-daemon` gives this output in the terminal:
````
Warning: due to a long standing Gtk+ bug
https://gitlab.gnome.org/GNOME/gtk/issues/221
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
Loading /home/tareef/.emacs.d/settings.el (source)...
Clearing removed files...
Clearing removed files...done
Processing modified files...
Processing modified files...done
[yas] Prepared just-in-time loading of snippets successfully.
[Treemacs] Warning: coudn’t find default background colour for icons, falling back on #2d2d31.
[Treemacs] Warning: couldn’t find hl-line-mode’s background color for icons, falling back on #2d2d31.
Overriding package-menu--print-info with paradox--print-info
Overriding package-menu--print-info-simple with paradox--print-info
Overriding package-menu--generate with paradox--generate-menu
Overriding package-menu-mode with paradox-menu-mode
.emacs.d/settings.el: Warning: ‘loop’ is an obsolete alias (as of 27.1); use ‘cl-loop’ instead.
[Treemacs] Icons cannot be resized without image transforms or imagemagick support.
Loading /home/tareef/.emacs.d/settings.el (source)...done
Loaded /home/tareef/.emacs.d/settings.el
Turning on magit-auto-revert-mode...
Turning on magit-auto-revert-mode...done
Starting Emacs daemon.
Emacs loaded in 1.77 seconds with 22 garbage collections.
Package cl is deprecated
Package rfc2368 is deprecated
````
Then trying to create emacsclient fails too
ricZola · 2022-03-18 09:47
SOLVED, thanks for mentioning the trial and error approach, I started to delete packages from `elpa` one by one, until I noticed that deleting the `keychain-environment` folder causes the issue!
I noticed that there is no declaration of this package in my config, so I added
(use-package keychain-environment
:init (keychain-refresh-environment))
Then I deleted `elpa` folder, restarted Emacs daemon, created a client and it worked just fine!
BTW, I'm not sure if it's relevant, I have this line in the systemd unit that runs emacs daemon: `Environment=SSH\_AUTH\_SOCK=%t/keyring/ssh`