24

When running emacs, the following output appears:

X protocol error: BadMatch (invalid parameter attributes) on protocol request 139
When compiled with GTK, Emacs cannot recover from X disconnects.
This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715
For details, see etc/PROBLEMS.
X protocol error: RenderBadPicture (invalid Picture parameter) on protocol request 139
When compiled with GTK, Emacs cannot recover from X disconnects.
This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715
For details, see etc/PROBLEMS.
Fatal error 6: Aborted
...
Aborted (core dumped)

Is there a workaround for this issue?

5
  • 1
    What in detail does not work? Could you prive su some error messages?
    – bigbang
    Jul 27, 2015 at 5:25
  • 1
    You need to be more specific if you want help. Also, that is more like a rant than a question. Jul 27, 2015 at 7:04
  • While this question isn't really a question, maybe if someone were to try they could edit or respond anyway. That seems better than blindly closing it.
    – Lewis Goddard
    Jul 27, 2015 at 20:56
  • 1
    @LewisGoddard r3bl posted the error trace above (I can reproduce it too). Since Emacs works on Ubuntu, this seems to be an elementary bug. Jul 27, 2015 at 22:27
  • The problem is still here in Juno with emacs25 Jul 18, 2018 at 6:18

5 Answers 5

40

This is a known bug: Emacs-24 crashes at startup. Although this bug isn't strictly speaking specific to elementary OS, it is an incompatibility between the graphical toolkit used in the Emacs package on elementary OS and certain themes including the elementary theme, so it is far more likely to happen on elementary OS than elsewhere.

Dominic on the discussion of an old GTK+ bug notes that setting the environment variable XLIB_SKIP_ARGB_VISUALS to 1 allows Emacs to start. I can confirm this. From the command line, you can thus run

XLIB_SKIP_ARGB_VISUALS=1 emacs

To conveniently set this variable for Emacs only (don't set it globally as it can cause problem with other applications), you can create a launcher. To do that, open Files, navigate to /usr/share/applications and copy the file “GNU Emacs 24”. Navigate to ~/.local/share/applications and paste the file. If you prefer the command line:

cp /usr/share/applications/emacs24.desktop ~/.local/share/applications

Open the file you just copied (~/.local/share/applications/emacs24.desktop) in a text editor — if Emacs isn't working yet, Scratch will do.

Change the line

Exec=/usr/bin/emacs24 %F

to

Exec=/usr/bin/env XLIB_SKIP_ARGB_VISUALS=1 emacs24 %F

You can now launch “GNU Emacs 24” from the launcher.

Similarly, if you start the Emacs daemon from your session startup, instead of running emacs --daemon, run

XLIB_SKIP_ARGB_VISUALS=1 emacs --daemon
2
  • 2
    Could this be made the default in Elementary OS? It's a terrible user experience that one of the most used (and fundamental) programs through multiple decades doesn't run out of the box.
    – James
    Apr 3, 2017 at 20:33
  • This still seems to be the case today.. May 31, 2021 at 11:20
5

Try running it from the terminal and you'll literally see the link to the bug report. Here's the output:

X protocol error: BadMatch (invalid parameter attributes) on protocol request 139
When compiled with GTK, Emacs cannot recover from X disconnects.
This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715
For details, see etc/PROBLEMS.
X protocol error: RenderBadPicture (invalid Picture parameter) on protocol request 139
When compiled with GTK, Emacs cannot recover from X disconnects.
This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715
For details, see etc/PROBLEMS.
Fatal error 6: Aborted
...
Aborted (core dumped)

Seems to me like this is a 13 years old GTK problem and not the elementary-specific problem.

1
  • 4
    You misread that error trace. The actual error is the first line. The bit about “when compiled with GTK” which is a 13-year old bug is not what causes Emacs to crash, it's another bug that merely prevents Emacs from partially recovering from the crash and continuing to run. Jul 27, 2015 at 22:26
5

XLIB_SKIP_ARGB_VISUALS=1 emacs works properly on my system

You can add the following line in your .bash_aliases file

alias emacs='XLIB_SKIP_ARGB_VISUALS=1 emacs'

and launch it by typing just emacs on your command line

0

I would suggest that you use emacs-nox (Version that runs in the terminal window). There is AskUbuntu link that tells you how to download it: https://askubuntu.com/questions/23645/how-do-i-download-the-command-line-emacs-instead-of-the-gui-one#23647

This version works just fine and is much better IMO since you are most likely using the terminal to do stuff anyway.

1
  • emacs-nox is not a substitute for those of us who are used to the GTK version, since it has a completely different user interface. Better to actually fix this bug in Elementary OS.
    – James
    Apr 3, 2017 at 20:28
0

So there are all sorts of issues surrounding running Emacs on Elementary and you'll find no evidence of an Emacs 25 package anywhere. However Emacs 25.3 will run successfully on Loki without any of the helpful work-arounds suggested above (which will also work - I've tried most of them with the stock Emacs 24). If you get the source packages, currently 25.3, (git clone https://git.savannah.gnu.org/git/emacs.git) then build it for a -nox version and for gui version (--with-x-toolkit=lucid) then installing both will work fine. Of course this does not guarantee that your emacs configuration will work and I have a many year old .emacs file and .emacs.d directory full of modules and configurations to make it work for me.

Although I build debs for both my emacs25-nox and my emacs25 these are in an early stage and overwrite common files. I have a desktop file for emacs25 only (emacs-nox working out of the shell only with no gui so why have it in the desktop). I install it into /usr/local/bin so as to not overwrite the standard emacs. I have early level debs such that emacs25.deb requires emacs25-nox so that it doesn't actually overwrite anything. If/when that works, I'd be willing to share...

Your Answer

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

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