# GNU Emacs error on elementary OS

Problem: GNU Emacs-24 crashes at startup on elementary OS. This is due to incompatibility between the graphical toolkit used in the Emacs package.

```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.
Fatal error 6: Aborted
Backtrace:
emacs[0x4f74cb]
emacs[0x4dcf3e]
emacs[0x4f7513]
emacs[0x4b219b]
emacs[0x4b420c]
emacs[0x4b426d]
/usr/lib/x86_64-linux-gnu/libX11.so.6(_XError+0x12b)[0x7f78f57b654b]
/usr/lib/x86_64-linux-gnu/libX11.so.6(+0x3b5e7)[0x7f78f57b35e7]
/usr/lib/x86_64-linux-gnu/libX11.so.6(+0x3b695)[0x7f78f57b3695]
/usr/lib/x86_64-linux-gnu/libX11.so.6(+0x325e0)[0x7f78f57aa5e0]
...
Aborted (core dumped)
```

Solution: Setting the environment variable `XLIB_SKIP_ARGB_VISUALS=1` allows Emacs to start. So use this command line to start Emacs in the terminal:

`XLIB_SKIP_ARGB_VISUALS=1 emacs`

Or better yet, create a launcher in `~/.local/share/applications` by copying the `emacs24.desktop` file, and change the `Exec` line to

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