How libxi broke my system

After some package updates I could no longer log into my Debian/XFCE system. The display manager (gdm3) would start to load but show only a black screen and rotating/spinning cursor. There was no login box – no way for me to get to a desktop. Digging through the logs I saw no errors in Xorg.0.log.  Dmesg and the kernel logs were no help either.  My first clue was found in the /var/log/gdm3/:0-greeter.log.* logs. Each of these logs had just one line:

*** Error in `/usr/bin/gnome-session’: malloc(): memory corruption: 0x000000000207c620 ***

A memtest run showed no errors. Reinstalling gnome-session didn’t fix things. Looking at ~/.xsession-errors I found lots of Gtk and GLib errors among strange things like “Discarding: 6 over 9” and “** Message: applet now removed from the notification area”. Other errors that might have been related:

polkit-gnome-authentication-agent-1: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.
wicd-client.py: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.

orage: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.
nm-applet: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.

In some log (which I’ve forgotten now) I remember finding more “memory corruption” errors but for applications like nm_applet. I tried switching my display manager to lightdm but I got a similar result. Upon boot, I was greeted with a solid black screen. Logs showed that the x-session was started and the greeter as well. In /var/log/lightdm/x-0-greeter.log I found a familiar error:

*** Error in `/usr/sbin/lightdm-gtk-greeter’: malloc(): memory corruption: 0x00007fe0cd2bcd40 ***

I tried purging and resinstalling the x server but of course, it was working fine. From a console I was able to stop the display manager and invoke an x-session manually with “startx”. In the desktop environment, I noticed my wireless was not connecting automatically and the network manager (nm_applet) and orage icons were missing from by status tray.

I’d like to say I used these clues to determine that the problem was isolated to gtk apps (e.g. lightdm, gdm3, nm_applet, etc.) but I never noticed the connection. I was simply fortunate to stumble upon the solution in this post, courtesy of one dE_logics:

http://forums.gentoo.org/viewtopic-p-6873138.html

While the root cause isn’t described in detail, the simple statement at the end of the post provides the solution: “This’s a bug with libxi. Upgrading it…solves the problem.” I gave it a shot. I found libxi6 in synaptic and upgraded it to the highest version available in Debian’s stable repository. After a reboot, my display managers are working perfectly. My libxi6 version is now 2:1.6.1-1+deb7 according to synaptic.