Xorg seg faults when unable to load driver i965 (AIGLX error: dlopen of i965_dri.so failed)

Warning: New mesa update might have fixed the issue,
So the information here might be wrong
Try updating your system before anything else!
(^ v ^)

In this article I will detail the encounter of a very strange error that made Xorg unusable.

This error was particularly strange because it was, seemingly, not caused by any user interaction. One day everything is fine the next Xorg just seg faults.

Here is the complete story:
(Also if you are wondering: yes it takes some effort to keep breaking your machine in order to write a silly article)

Initial boot/problem

When trying to boot the system when the init system reaches its final step: ” Reached target Graphical Interface. ” it just hangs there and doesn’t launch anything!

(Note how the system is still accessible by switching to a different tty)

Strange…

I didn’t do anything of note to my system lately, not even any new updates!

So I tried to dig deeper to find the cause of the issue

Diagnosing the problem

I thought maybe the issue was something to do with lightdm and not Xorg or maybe it could’ve been a million other things!
So before i did anything else i looked to see if lightdm or Xorg were even running.

Looks like they are not.
So before I checked any logs in particular I just tried to startup my Window Manager using startx.

Cool! Looks like some it’s some silly seg fault error. (This meant that the issue was with Xorg)
Thought just “Segmentation fault” isn’t particularly useful. So I thought to check the Xorgs logs ( /var/log/Xorg.0.log ) because they are way more verbose.

[     9.719] (EE) AIGLX error: dlopen of /usr/lib/dri/i965_dri.so failed (/usr/lib/dri/i965_dri.so: cannot open shared object file: No such file or directory)
[     9.719] (EE) AIGLX error: unable to load driver i965
[     9.732] (EE)
[     9.732] (EE) Backtrace:
[     9.732] (EE) 0: /usr/lib/Xorg (xorg_backtrace+0x2dd) [0x55734e95bc5d]
[     9.732] (EE) 1: /usr/lib/libc.so.6 (__sigaction+0x50) [0x7f7304929710]
[     9.732] (EE) 2: ? (?+0x0) [0x557350828b20]
[     9.732] (EE)
[     9.732] (EE) Segmentation fault at address 0x557350828b20
[     9.732] (EE)
Fatal server error:
[     9.732] (EE) Caught signal 11 (Segmentation fault). Server aborting
[     9.732] (EE)
[     9.732] (EE)
Please consult the The X.Org Foundation support
         at http://wiki.x.org
 for help.
[     9.732] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[     9.732] (EE)
[     9.742] (EE) Server terminated with error (1). Closing log file.

Notice the line:

[     9.719] (EE) AIGLX error: dlopen of /usr/lib/dri/i965_dri.so failed (/usr/lib/dri/i965_dri.so: cannot open shared object file: No such file or directory)

Researching the cause for the error

Now that we have an exact error, it’s time to research the cause!

Source: https://wiki.archlinux.org/title/Xorg
Source: https://wiki.archlinux.org/title/Intel_graphics

Note:

3. Classic OpenGL (non-Gallium3D) drivers for older hardware (Mesa 22.0 and higher have dropped support for i915 classic driver)

And also:

* Install one of the following packages, which provide the DRI driver for 3D acceleration.
    * mesa is the up-to-date Mesa package which includes the modern Gallium3D drivers for Gen 3 hardware and later. This is the recommended choice.
    * mesa-amber is the legacy Mesa package which includes the classic (non-Gallium3D) drivers from Gen 2 to Gen 11 hardware. This driver might have better performance or stability for Gen 7 and older hardware, but is unmaintained.

Cool! So now we know why the error happened.
Mesa >=22.0 dropped support for Gen <=11 hardware.
So instead of using mesa package we need to use the mesa-amber package

Solution

We need to simply install to mesa-amber package.

# pacman -S mesa-amber

You will get a warning saying that the package conflicts with mesa
Accept as this will replace the original mesa package with mesa-amber

Conclusion

Now after rebooting everything should go back to working normally

Additional important notes:

You might also need to replace the lib32 versions if you use them
( Replace lib32-mesa with lib32-mesa-amber )

Pro tip:

In case Xorg ever breaks on you and you need to urgently use a GUI app and/or don’t have time to fix Xorg,
You can temporary use Weston , which is a Wayland compositor.

In this exact situation while Xorg didn’t work, Weston worked just fine.

So even if you don’t use Wayland I still recommend having it installed along with it’s compositor.

Sources/Further reading: