I'm on Windows 10 Pro 10.0.21337 (windows insider program) and installed WSL with Ubuntu 20.04. From within ubuntu I said

apt-get update
apt-get upgrade
apt-get install emacs
dpkg -l emacs
||/ Name           Version           Architecture Description
ii  emacs          1:26.3+1-1ubuntu2 all          GNU Emacs editor (metapackage)

after installing I could launch emacs from the ubuntu bash and from the windows start menu. It worked fine for a while but suddenly it crashed (I was measuring the effective keyboard delay rate in emacs by keeping the space bar pressed for up to 5 s, when it crashed, so I'm sure I didn't invoke anything special)
Since then, when I start it via the start menu nothing happens. It doesn't appear in the windows task manager but ps auxww lists a running process /usr/bin/emacs with 0% CPU.
When I start it on cmd line and press Ctrl-C it prints an unreadable character and then Display :0 unavailable, simulating -nw. (after the latest update it stopped printing that message).

I renamed my .emacs and .emacs.d, uninstalled and reinstalled it (including apt autoremove), with no success.

Then I tried command line options:
emacs -Q makes no difference.
emacs --debug-init prints nothing.
emacs -nw works: it starts the text version, so only the gui version is broken.

UPDATE: I kept two emacs processes (one started from start menu, one from cmd line) running while putting the laptop through sleep + wakeup a couple of times. Once on waking up two emacs windows were visible! On the next wakeup they were invisible again. ps still shows the two processes. This means that it's indeed a window manager problem like @jue assumed or, say, a process manager problem. I'll keep investigating.

  • 1
    So probably not Emacs is broken, but some windows feature or service. Display :0 unavailable means Emacs Gui can not connect to the display server. This could be due to a crashed display server or broken permissions. I do not know which window server Windos is using in conjunction with WSL. But surely you can google that. – jue Mar 21 at 0:36
  • Which xserver are you using? How is it configured? The following two tutorials helped me quite a bit: - github.com/hubisan/emacs-wsl#changes-needed-for-wsl2 - elecming.medium.com/… – Tom Purl Mar 21 at 15:00

Your Answer

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

Browse other questions tagged or ask your own question.