My Emacs usually works well, but sometimes it freezes, to be more specific:

  1. It only freezes after pressing ESC.
  2. When the freeze begins, it will always freeze after pressing ESC: I kill Emacs, restart it, press ESC, then it freeze again. Unless I restart the the computer. After restarting, Emacs goes to normal again.
  3. I can do nothing to bring it back to normal, including C-g, pkill -USR2 emacs, even emacsclient -nw in the terminal freezes.
  4. Emacs -Q still freezes after pressing ESC.

Is there any way to find out the reason and solve it?

I'm using archlinux with GNU Emacs 27.1, this is uname -a:

Linux archlinux 4.19.18-1-lts #1 SMP Sat Jan 26 13:20:43 CET 2019 x86_64 GNU/Linux
  • 1
    Try strace -p <PID> when it's frozen: you get the pid with ps or top or ... That should tell you where it is frozen, but that's only one small thing in trying to figure out the problem. But you have to start somewhere...
    – NickD
    Oct 9 '20 at 13:26
  • 1
    If you don't see the problem when you start Emacs using emacs -Q then bisect your init file to hopefully find the culprit, i.e., to narrow the possibilities.
    – Drew
    Oct 9 '20 at 19:22
  • In a terminal, in a GUI, or both? Does it also do this in another terminal or in another graphical environment? Oct 9 '20 at 21:32
  • 1
    Yes. Use emacs -Q to start Emacs without using your init file. If you don't see the problem then, then it's caused by something in your init file. In that case, bisect your init file to find the problem. You can use command comment-region to comment out a block of code in your init file (and with C-u it uncomments the region). Comment out 1/2, then 3/4, 7/8, 15/16, 31/32, etc. to find just the part that is problematic. If the needed fix is not clear then update your question, narrowing it to just the problematic code.
    – Drew
    Oct 10 '20 at 16:58
  • 1
    @Gilles'SO-stopbeingevil': Oh, right; sorry. In that case, OP should maybe consider filing a bug report: M-x report-emacs-bug.
    – Drew
    Oct 11 '20 at 1:05

I solved the problem by upgrading the Linux Kernel from 4.19 to 5.4. Not a perfect answer I know. But in case it's helpful for someone, I posted the answer here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.