[Lenny] I seem to have broken X...

I have been running Debian Lenny on this current PC for about a year. Since installation, I have had no major issues. Last night, I lazily tapped out:

$ sudo aptitude update
$ sudo aptitude upgrade

I quickly scanned what it said would be changed and did not notice anything that may be problematic (dpkg, some libraries, etc) so paid little attention and just let it run. When I next logged out, however, instead of returning to gdm (I think that is the one I use) I got a black screen. I did not think much of this and just grudgingly hit the power button.

When I next booted, I again got a black screen rather than gdm and again had to reboot. I booted in single user mode this time, tried `startx' and got the same. I checked relevant config files and none have been updated in months. I checked all my logs and nothing shows anything untoward. It is as though everything is working correctly, but nothing displays.

It may be relevant to mention I use an ATI card, but since the issue started on logout there should not be any relevant driver issues (as far as I know). I connect via a HDMI cable (again, probably not relevant).

Is this page any help: ATIProprietary - Debian Wiki

I was already using that driver. I believe I used that very page when I first installed the system.

This Ubuntu page might give you some ideas: X/Troubleshooting/BlankScreen - Ubuntu Wiki

I was just experimenting with changing the resolution and believe I have found something. I decided to redirect STDERR, just in case, and checking it after startx failed again came up with something not in the logs:

(I just hand-wrote this one line, so no full log I am afraid).

Try this page: Problems with fglrx - ThinkWiki

You might need to do this bit: Problems with fglrx - ThinkWiki

I checked that page, but the issue it describes did not seem to be present. Using the information from it, however, I removed and reinstalled the fglrx packages (it said they contain the hacks necessary to ensure this is all correct). This made no difference.

I found this page describing the exact issue on Ubuntu. As per its suggestion, I downloaded the latest driver from ATI and tried to install. I attempted to make a deb, but the script failed on this (cp unable to stat /usr/X11R6/modules/linux error). I then just used the non-distro-specific install. This has allowed me to load X again, but things do not seem to be quite right.

If I attempt to verify the install worked:

$ fglrxinfo 
X Error of failed request:  BadRequest (invalid request code or no such operation)
  Major opcode of failed request:  144 (GLX)
  Minor opcode of failed request:  19 (X_GLXQueryServerString)
  Serial number of failed request:  10
  Current serial number in output stream:  10

On the other hand, `ldd /usr/bin/fglrxinfo' seems to look correct. My window manager (pekwm) is now behaving *very* slowly when I move windows, and I cannot seem to play videos (mplayer). Well, I can play them and the audio stream works, but there is no video stream. Otherwise, X seems normal now (I am able to post this direct from my PC with Iceweasel).

EDIT:
Oh, I almost forgot. I tried to use `module-assistant a-i fglrx' too, but there is an error here too (which seems to be a known bug).

I found a few posts which said that your 'undefined symbol: GlxInitVisuals2D' problem could be fixed on Gentoo using 'eselect opengl set ati.' It was that which led me to the section at Problems with fglrx - ThinkWiki that I posted above.

I have completely removed everything related to fglrx and begun reinstalling from scratch. I believe I have found the cause of the original problem. There is no package for the module for amd64: you have to build it yourself. When everything else was updated, this package needed to be updated manually (hence why the module no longer loads). I tried to build an up-to-date version using `m-a a-i fglrx', but get the following error:

(...SNIP...)
  CC [M]  /usr/src/modules/fglrx/kcl_agp.o
  CC [M]  /usr/src/modules/fglrx/kcl_debug.o
  CC [M]  /usr/src/modules/fglrx/kcl_ioctl.o
/usr/src/modules/fglrx/kcl_ioctl.c: In function
�KCL_IOCTL_AllocUserSpace32�:
/usr/src/modules/fglrx/kcl_ioctl.c:196: error: implicit declaration of
function �compat_alloc_user_space�
/usr/src/modules/fglrx/kcl_ioctl.c:196: warning: return makes pointer
from integer without a cast
make[3]: *** [/usr/src/modules/fglrx/kcl_ioctl.o] Error 1
make[2]: *** [_module_/usr/src/modules/fglrx] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-2.6.26-2-amd64' 
make[1]: *** [build] Error 2
make[1]: Leaving directory `/usr/src/modules/fglrx' 
make: *** [kdist_image] Error 2           

Googling this error, I get mixed messages. Some places say it is already fixed, others say it is a known bug with a not-yet-available fix. I found a manual solution for Ubuntu, but this does not appear to work on Debian.

What version of fglrx are you using? The page at ATIProprietary - Debian Wiki says to use 'Catalyst 8.12 (fglrx 8.561)' on Lenny.

Yes, I am using that version, through the fglrx-source package. Interestingly, the last deb I built (when I first installed) was also that version, so it looks as though this package has not been updated in a while. There has been a change in kernel, however, which necessitates a rebuild of the module (and explains why the old build no longer works).

Try using a later version of fglrx. Is this post any help: fglrx 9-6 to 9-11 Installation and Debian testing with 2.6.26-2-686-bigmem � Blog Archive � Jotschi�s Blog

I gave that a go, but it does not build the packages. Perhaps because of differences between Lenny and Squeeze? It did not seem to find things where it was looking for them (looking in /lib/X11R6/lib86, which does not exist).

I have continued playing around with the Ubuntu manual solution I mentioned before and managed to tweak it for Debian (kludged the kludge: I need a shower). I have managed to build 8.12 against the current kernel and installed the package. Things still do not seem to work, however. If I reboot with the xorg.config file set for ATI, X fails to load with errors of the driver not existing. Seems obvious enough: make sure the module is loaded.

$ sudo modprobe fglrx
FATAL: Error inserting fglrx (/lib/modules/2.6.26-2-amd64/misc/fglrx.ko): Cannot allocate memory
$ dmesg
(...SNIP...)
[   68.225514] fglrx: module license 'Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY' taints kernel.
[   68.271664] [fglrx] Maximum main memory to use for locked dma buffers: 2870 MBytes.
[   68.271664] [fglrx:drm_alloc] *ERROR* [driver] Allocating 0 bytes
[   68.271664] [fglrx:firegl_init_device_list] *ERROR* Out of memory when allocating device heads
[   68.271664] [fglrx:firegl_init_module] *ERROR* firegl_init_devices failed

I only use about 5% of my memory, so I doubt I am out. Reading around on Google, I found references to this issue with older cards, but mine is fairly recent and this is the same source as the module I used perfectly fine all year.

I have currently reverted to the default xorg.config (not using the fglrx driver). The low res is ugly, but at least I can copy errors across to Iceweasel.