ATI driver + kernel update: before you reboot and before you complain...

Here’s what to do right after applying the latest kernel security patch ( to get the ATI driver back to work.

  • Do not reboot yet
  • make sure the update installed the headers and sources for kernel
    rpm -qa | grep should print the files in red on a 64bit system:

And these ones on a 32bit system:


If they are still missing, install them now with the following command (that you can copy/paste in a terminal):

ver= ; mac=$(uname -m) ; flavour=$(uname -r | sed 's|.*-||') ; echo zypper in kernel-{$flavour-devel-$ver.$mac,devel-$ver.noarch,syms-$ver.$mac,source-$ver.noarch}
  • make sure you have gcc and make installed.
    which gcc || zypper in gcc
    which make || zypper in make

  • make sure /usr/src/linux points to the right kernel version (the one you just installed) :

ver= ;  "$(readlink /usr/src/linux)" == "linux-$ver" ] || ln -sfn linux-$ver /usr/src/linux
  • make sure you have the file /usr/bin/
which /usr/bin/ || echo " not found ! Please install fglrx64_7_5_0_SUSE113-8.771-1.x86_64.rpm first"

If you see that message: not found ! Please install fglrx64_7_5_0_SUSE113-8.771-1.x86_64.rpm first
don’t proceed unless you install the fglrx package (the one built from the ATI installer run file. The version might be slightly different though)

  • If you did previously patch the fglrx module (but not if you didn’t), reverse the patch, as it doesn’t seem to be needed anymore. Copy/paste, save to file, execute this script:
#! /bin/bash
cat << EOFMODULEPATCH | patch -b -p0
--- /usr/src/kernel-modules/fglrx/kcl_ioctl.c.orig	2010-10-06 14:26:53.480379335 -0700
+++ /usr/src/kernel-modules/fglrx/kcl_ioctl.c	2010-10-06 14:29:25.054397034 -0700
@@ -193,7 +193,13 @@
 void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
-    return compat_alloc_user_space(size);
+    void __user *ret = arch_compat_alloc_user_space(size);
+    /* prevent stack overflow */
+    if (!access_ok(VERIFY_WRITE, ret, size))
+        return NULL;
+    return (void *)ret;
 #endif // __x86_64__

Answer with y when you see the following message:

Reversed (or previously applied) patch detected! Assume -R [n]**y**
Apply anyway? [n]**y**
  • Now exit X (the graphic card may behave weird otherwise) and load/boot the new kernel in runlevel 3:

eval `sed -n '/|.*kernel \(^ ]*\) root=\(^ ]*\).*|kexec -l \1 --append=root=\2 3|p;/|.*initrd |--initrd=|p' /boot/grub/menu.lst | sort -ru | tr "
" " "` ; kexec -e

As I cannot garantee that the command above will work in any case, here’s what this command is expected to do:

kexec -l /boot/vmlinuz- --append=root=/dev/disk/by-uuid/4946e10e-d727-42fb-9ce4-2d09d49d6a52 3 --initrd=/boot/initrd- ; kexec -e

  • Now recompile the fglrx module

  • Now start X or switch to runlevel 5 or reboot … and Bob’s your uncle ! (I love this expression) :wink:

Wow! That’s a prime example for concepts like plug-and-play, automatic detection and configuration, GUI, user-friendlyness. Just got a flashback from 1993. Great progress!

You’re right. I finally wrote a service to recompile that module (as well as others) automatically. Enough is enough! Why didn’t you tell me that in 1993 already? All this time wasted waiting for your clever advices!
However people who did patch the module still have to unpatch it with the script above or somehow.
Here’s the service : automatically recompile kernel modules after kernel update

Thanks for a complete and timely post!

Having read thru it, I believe the following is a correct statement:
The kernel update to version restores the function references that were removed when the upgrade was installed, which resulted in the compile failures when re-compiling the ATI drivers.
For those of us who patched the kernel to get fglrx up and running, the update to will overwrite the patch we applied to

Can you confirm this is correct interpretation?

Yes, I believe it did. I didn’t compare /usr/src/linux- with /usr/src/linux- But the fact is that no patch is needed anymore.

It you patched the kernel (applied patch 1 described here ATI Driver broke GUI?), it’s irrelevant since the update should install the new kernel sources.
I you patched the module (applied patch 2 described here ATI Driver broke GUI?), you should unpatch it. Installing new kernel sources is not going to restore the original fglrx module sources, as they belong to another package. I haven’t tried to recompile the module without reversing the patch. But there is no point to use a hack which is not necessary.*

Hey, I have a question!!

if I should check if I have the file “/usr/bin/” and the message says that i should install “fglrx64_7_5_0_SUSE113-8.771-1.x86_64.rpm” first, but i have a 32bit system, i have to install the “fglrx64_7_5_0_SUSE113-8.771-1.x86_64.rpm” file anyway?? o.O

sorry by my english, isn’t too good :S

regards from Chile

You cannot have fglrx64_7_5_0_SUSE113-8.771-1.x86_64.rpm unless you built it yourself. So, if you didn’t get it from somebody else which built it on a 64bit system, it will be OK. As far I as know, the original ATI installer is the same file (an has the same extension) for both 32 and 64bit.

emmm… The “fglrx64_7_5_0_SUSE113-8.771-1.i386.rpm” file doesn’t exists?? and i need to search the “fglrx64_7_5_0_SUSE113-8.771-1.x86_64.rpm” file, OK?
so, how can i get this file, in the webpage of ATI?
please i need help, cause i don’t know so much and i’m new in this linux world :S
aps, thanks for response

You need the kernel sources and headers, as well as gcc and make and the ATI installer from ATI Web site.
The atiupgrade script should do all these steps for you. I did post it several times (and kept patching and unpatching stuff). You can try this version. Report if it doesn’t work.

[li]I assume you know how to open a terminal or work in console and become root. This is required here. So become root with : su -l
[/li][li]Make sure you have the latest kernel installed. The command uname -r should output[COLOR=“green”]4-desktop[/COLOR] or[COLOR=“green”]4-default[/COLOR] but NOT something like[COLOR=“red”]3[/COLOR] !
[/li][li] copy/paste the code below in a text file, call it atiupgrade and execute it from the directory where you saved that file with the command: bash atiupgrade

#! /bin/bash
# --------------------------------------------------------------
# What This script does the following :
# - install kernel sources and gcc if needed
# - unload fglrx if needed
# - make a copy of /etc/X11/xorg.conf (if any)
# - download ATI Catalyst 10.9 for your architecture if needed
# - apply asm_compat ati patch for kernel 
# - deinstall the repo driver (x11-video-fglrxG02 ) if it was previously installed
# - run the ATI installer  
# - deinstall any previously installed fglrx
# - install the fglrx package (and compile the kernel module)
# as always ... yuou're using it at your own risk.
# $ Agnelo de la Crotche - 31.08.2010
# --------------------------------------------------------------

mach=`uname -m`
kernel=`uname -r`

# define x86_64 and i686  installer

# don't run in X
# [ "$DISPLAY" ] && exec echo "this script cannot be run in X"

# install kernel headers and sources if not present
for pkg in kernel-source kernel-$krn-devel ; do
	rpm -qa | grep -q  $pkg ||  zypper -n in $pkg

# install devel_basis (gcc) if not present
zypper search -t pattern -i | grep -q devel_basis || zypper -n in -t pattern devel_basis 

# exit in directory /usr/src/linux/$rel not present
[ -d /usr/src/linux-$rel ] || exec echo "directory /usr/src/linux-$rel not found. Make sure that kernel $rel sources are installed."
# make sure the /usr/src/linux -> /usr/src/linux/$rel (in case different kernel sources are installed)	
if [ "$(readlink /usr/src/linux)" != "linux-$rel" ] ; then 
	ln -sfn linux-$rel /usr/src/linux 

# unload fglrx 
# lsmod | grep -q fglrx && modprobe -r fglrx

# exit if fglrx is still loaded 
# lsmod | grep -q fglrx && exec echo "fglrx is still loaded"

# save /etc/X11/xorg.conf (just in case)
[ -f /etc/X11/xorg.conf ] && cp /etc/X11/xorg.conf{,.pta}

# if installer found in current directory, skip downloading
if [ ! -f ./$atiBaseFile ] ; then

	# make sure wget is installed
	which wget > /dev/null 2>&1 || zypper in wget

	# get the ATI installer for your architecture (i686 or x86_64)
	wget ${!mach}


# look for the ATI installer in the current directory
ati_install=(`find . -name "ati-driver*$"`)

# cancel script if 0 or more than 1 installer found
if [ ${#ati_install[li]} -gt 1 ] ; then
[/li]	exec echo "several versions of the ATI installer found. Script aborted."
elif [ ${#ati_install[li]} -eq 0 ] ; then
[/li]	exec echo "no ATI installer found. Script aborted."

# let's doublecheck ! :-)
AtiInstall=`basename ${ati_install[0]}`
[ -f ./$AtiInstall ] || exec echo "no ATI installer found. Script aborted."

# uninstall x11-video-fglrxG02
rpm -qa | grep -q x11-video-fglrxG02 && zypper rm x11-video-fglrxG02

# run ATI installer if x11-video-fglrxG02 successfully removed
rpm -qa | grep -q x11-video-fglrxG02 || sh ./$AtiInstall
# !!! Caution! The command below will deinstall any previously installed fglrx package 
# without asking for confirmation. Comment out this line if you don't want that !
zypper -n rm $(rpm -qa | grep fglrx | grep SUSE | grep $mach) 

# install/reinstall fglrx package 
find . -maxdepth 1 -name "fglrx*$mach.rpm" -exec  zypper -n in "{}" ";"

I did comment out a line to allow you to work in X but if you have another Catalyst driver installed (x11-video-fglrxG02), you MUST exit X. I haven’t tested it and applied some changes. So I don’t garantee it will work, but if it doesn’t we’ll fix it.
[li]again copy/paste the script I poste here automatically recompile kernel modules after kernel update in a text file, save it as modautocompile in the directory /etc/rc.d.
[/li][li]make this script executable and install the service.
[/li]chmod 755 /etc/rc.d/modautocompile
insserv modautocompile

[li] copy/paste the code below in a text file, call it modautocompile.conf and put it in the directory /etc :

# kernel modules to autocompile after kernel update
# name              command
# vboxdrv             service vboxdrv setup
fglrx               /usr/bin/

[li] reboot. If you did installed everything correctly, the fglrx module should get compiled automatically.
[/li][li] alternatively you can skip the 4 last steps, reboot in console mode (runlevel 3) and execute /usr/bin/ , but you will have to do it after each kernel update. If you install and enable the service, it will happen automatically.