Install and debug AMD catalyst graphics driver in Elementary OS / Ubuntu 12.04

Most modern laptops with intel processors after sandy bridge, comes with its own graphics card (or graphics memory). If you happen to purchase such laptop with discrete graphics card from AMD or Nvidia, your configuration becomes a hybrid graphics setup. Hybrid graphics cards have long and painful history under Linux. Therefore, if you don’t follow the usual channel (your operating system provided) of installing it, you might run into lots of problems because of inconsistencies between Xorg/mesa, graphics vendor drivers and the kernel. In this tutorial, I will talk about different approaches I take while installing the driver. This tutorial is valid for Elementary OS/Ubuntu and other ubuntu derivatives as well.

Before starting here is my hardware specs

Processor: Intel® Core™ i5-2410M CPU @ 2.30GHz × 4
Memory: 4 GiB
Graphics: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
 Advanced Micro Devices [AMD] nee ATI Seymour [Radeon HD 6400M Series] (rev ff)
Operating Systems: Ubuntu 13.04 / Elementary OS Luna

a. Installation using the official route.

I have already written a tutorial on how to install catalyst driver in ubuntu 12.04.2. Follow the tutorial, and live happily ever after.

b. Manually installing the driver downloaded from AMD's website.

As an example, for this tutorial, I am going to use the 13.8 beta driver, because versions before that had incompatibility problems with mesa drivers in ubuntu 13.04. I have talked about how to install catalyst driver in ubuntu 13.04 and possibly deal with that error. If you are on ubuntu 13.04, you should follow that tutorial instead of this one. If you are on ubuntu 12.04 or Elementary OS, you don't have to go there. Execute all the commands in this tutorial using a terminal (Ctrl + Alt + T).

Step 1: Enable repositories and update your OS

Go to Software Center -> Edit -> Software Sources and enable all the checkboxes in Ubuntu Software tab. In Other Software, enable Canonical Partners and in Updates check Unsupported updates (precise-backports).

enable-backport

Next, open Update Manager and press the Check button to update the repositories, and then press Install Updates to install all the updates.

install-updates

Step 2: Install kernel headers, mesa drivers and necessary library.

sudo apt-get install ia32-libs lib32gcc1 libc6-i386 build-essential cdbs fakeroot dh-make debhelper debconf libstdc++6 dkms libqtgui4 wget execstack libelfg0 dh-modaliases linux-headers-generic xserver-xorg-core libgcc1

In the past, I used to suggest lts-raring backported kernel and mesa drivers. Since the last update, kernel and graphics drivers have been updated to newer versions. Therefore, those packages are not required anymore. Still, if you want to maximize the chances of getting more games work under intel graphics card, you can update your open source drivers using xorg-edgers ppa. Before proceeding, I want to say, this step is optional and is not required for catalyst driver to work. To install newer open source drives, using xorg-edgers execute following commands.

sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get dist-upgrade

One of the common problems using xorg-edgers is, you often end up using kernel version and xserver that is not yet supported by catalyst driver. If using these packages conflicts with catalyst driver or does not improve gaming performance, you can always remove it using following command.


sudo ppa-purge xorg-edgers 

Step 3: Install catalyst driver

Download catalyst driver from AMD's website. For this tutorial, I am going to go with the beta driver, because it is compatible with above drivers and kernel version 3.8. In future, you should also always check what kernel and xorg versions are supported in the release notes found on the driver's download site.

sudo sh ./amd-*.run --buildpkg Ubuntu/precise
sudo dpkg -i fglrx*.deb
sudo aticonfig --initial -f
sudo reboot

If you have played with vgaswitcheroo switch command, second last command might not execute properly. In that case, you can always run the command in a terminal (Ctrl + Alt + F1), next time before you login. After executing above command, instead of login, it is better to reboot. Instead of throwing you to a terminal or login screen, if the computer locks up with black screen, boot using the recovery mode, execute above command and reboot.

You can switch between the graphics cards using following commands.

sudo aticonfig --px-igpu # for integrated intel card
sudo aticonfig --px-dgpu # for discrete amd card
aticonfig --pxl  # list currently active card

After switching the graphics card, you have to logout and login to activate the driver. If during logout, you computer frequently freezes, you can also reboot the computer. If your computer completely locks, hold PrntScr + Alt keys and press R, E, I, S, U, B (opposite for busier) to reboot rather than pressing and holding the power button.

Step 4: Remove catalyst driver

If you know, how to install catalyst driver, you also need to know how to remove it.

sudo apt-get remove --purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev*
sudo rm /etc/X11/xorg.conf
sudo apt-get install --reinstall xserver-xorg-core xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri libgl1-mesa-glx:i386 libgl1-mesa-dri:i386
sudo dpkg-reconfigure xserver-xorg
sudo reboot

Step 5: Fix graphics errors

Graphics drivers have this recursive effect, where removal of a single package might remove lots of common system software. As a result, you might end up with a broken system. If you have login access, your first route of investigation should always be looking at /var/log/Xorg.0.log file

cat /var/log/Xorg.0.log

If there is some keyword like ati, intel your first defense mechanism should always be re-installation of xserver-xorg packages relating to that error. E.g If the message says problem loading intel module, I always install xserver-xorg-video-intel package. If there is an error on ati package, I install xserver-xorg-video-ati. In situations where you are not sure which packages to install, you can always use the tab completion feature of bash or install synaptic and install the related packages.

Next command to look for errors would definitely be dmesg

dmesg

It is too verbose, but errors with keywords fglrx, intel, ati always stand out.

In most cases running following command will fix the operating system.

In elementary OS

sudo apt-get install elementary-desktop

In Ubuntu

sudo apt-get install ubuntu-desktop

These are meta packages that take care of lot of things. If it still does not fix the error, remove fglrx install libgl1-mesa-glx (or packages from remove section above) . Install libraries from Step 2, and finally re-install these meta packages to complete the installation.

If you don't have login access, you can boot using a liveusb (your installation media), or your dual boot Linux (if you have that) and chroot to your elementary or ubuntu installation using following commands. For this example let us assume the OS you want to fix is at /dev/sda4. Use sudo blkid or sudo fdisk -l commands to find the drives and mount /dev/sdaX /media/Somedir to mount them, if you are not sure about the installation drive.

mkdir -p /media/Elementary
mount /dev/sda4 /media/Elementary
mount -t proc none /media/Elementary/proc
mount --rbind /sys /media/Elementary/sys
mount --rbind /dev /media/Elementary/dev
chroot /media/Elementary

If you cannot use the internet in chroot environment, you might have to copy /etc/resolv.conf to /media/Elementary/etc/resolv.conf before running the chroot command

Step 6: Some tips

Above commands are not always sequential. You might have to jump from one section to another in order to fix things. If your programs lag, games fail to start, have awful texts and images, chances are there is a fault in open source driver installation. Before you install the propitiatory driver, you need to fix the open source drivers first, because if you don't, those problems will persist even after installation.

One of the common cause of these problems is the breakage of ia32-libs and its dependency ia32-libs-multiarch:i386 packages. To get both of these installed properly, you have to do a little trick as discussed in this tutorial. See Install ia32-libs section to fix the error. Original source of that fix can be found in askubuntu.com

I hope this tutorial has provided you with enough information to play with catalyst driver. If you have some more information, if there is some error in this post or if there is a better way to approach these problems, you are more than welcome.

Cheers !!

About these ads

21 Comments

Filed under Uncategorized

21 responses to “Install and debug AMD catalyst graphics driver in Elementary OS / Ubuntu 12.04

  1. I tried every driver since 13.1 to 13.8 and I can’t use any opengl application on fullscren, but If I change gala for mutterr, all run ok, I think that gala had an horrible bug with catalyst.

    • Apart from AMD’s graphics performance, I did not have any problem. Performance seems to be not good as in ubuntu 13.04, even with lts kernel and mesa drivers. I have played steam games in fullscreen, therefore it works for me.

      Seems like a weird bug.

  2. I installed the driver and all the steps worked correctly.
    but when i restarted the computer i noticed two things :-
    1- I can’t adjust the screen brithness and it is set to maximum level.
    2- i cant find Catalyst control center
    any help please?!

  3. sorry man but your solution on point 1
    didn’t work for me and the brithness level is still maximum…i feel that my eyes gonna burn :(
    heeeeeeeeeelp!

  4. I installed backlight but in vain :(
    the problem is still exist
    i have toshiba l655-149 with Luna OS

    • This is very laptop specific question, because each laptop handles it differently. Mostly, brightness is set by setting appropriate value in brightness file that is under one of the sub-directories under /sys/class/backlight. In my case there are 3 directories (acpi_video0, acpi_video1 and intel_backlight) and “brightness” file under acpi_video0 directory works for me. You can see the brightness value with following command

      sudo su
      cd /sys/class/backlight/acpi_video0
      cat brightness

      E.g If the value is 3000, you need to set it to say 1500 or similar value. If the value is 15, you need to set it to say 12, with following command

      echo 12 > brightness

      If that works, you might try setting it in /etc/rc.local or using laptop-mode-tools settings as described in second link in my previous response. Apart from those suggestions, I don’t have any other answer. Anyways, thanks for the response.

  5. echo 12 > brightness
    it outputs
    bash: echo: write error: Invalid argument

  6. the backlight command that i inserted it in the startup apps
    worked for me only when the computer goes to sleep and wakeup :D

  7. Unfortunately, this solution didn’t work for me. It seems that the Intel HD4000 / Radeon HD8730m combo isn’t supported by the fglrx driver yet. It says it is on AMD’s site, but so far, I’ve only managed to break my system by trying. Thanks.

  8. After Step 2 I’ve got black display after reboot. :(. People. be careful.

    • Did you try xorg-edgers ppa? If so, I think it might be some bad packages. If you get a black screen. Please login using a live cd/usb and investigate your /home/username/.xsession-errors, /var/log/Xorg.0.log, /var/log/dmesg or /var/log/kern. If there are some failure messages, copy these files and report to https://launchpad.net/~xorg-edgers.

      If this error was not introduced by xorg-edgers (step 2), that is strange. Only problem I previously had was because of conflict between -lts-backport and standard packages. Since I have removed that section, all other packages are standard ubuntu packages. You could do a “sudo apt-get update && sudo apt-get dist-upgrade” (if you are not using xorg-edgers). If you are using purge the ppa. To run these commands, you can boot using recovery console. If recovery console too locks up, you can chroot using any other linux installation (unlikely) / live usb and using chroot commands as explained in http://xpressrazor.wordpress.com/2013/06/21/install-gentoo-using-ubuntu/ (just the chroot part). Before executing these commands make sure to mount your linux partition. In above example it is mounted in /media/gentoo (use what ever name you prefer. e.g /media/myubuntu). After chrooting, you will be able to execute all the ubuntu commands (e.g removing above ppa).

      Thanks for reporting this error. :)

  9. Hi.. I’m a noob when it comes to Linux I’m trying out luna os on my HP pavilion dv6 I used a command and it said my ati card was hd5000 series but after I follow your instructions I’m stuck at the tty1 screen after a reboot…. The log file says fatal server error:
    17.054 no screens found… Please help atleast revert back to normal even though the 2d acceleration is crappy I can always see something

    • Follow Step 4.

      After that, if it still says no screens found, install elementary-desktop package (sudo apt-get install elementary-desktop).

      One thing that is very important is, if you have catalyst driver installed, you need to create (/etc/X11/xorg.conf using aticonfig --initial -f) and if you have removed catalyst driver, you also need to remove the xorg.conf file.

      Also, before removing the catalyst driver, try this command (sudo aticonfig --acpi-services=off) See this page for other options.

      Hope, this helps.

  10. Hi, i’ve tried EVERY solution that i’ve found and i cant get it work. I have a HP with Intel/Ati hybrid cards. I follow step by step and always get the same error: on reboot no GUI, just tt1 and with fglrxinfo “Error: unable to open display”. I’ve tried every tutorial and always gets the same error. Do you have a clue or I should give up with the installation? Its frustrating!

    • Was “aticonfig --initial -f" able to create /etc/X11/xorg.conf file ? Check the contents of that file and make sure it looks like the one that is at the end of Step 3 in this tutorial.

      Also check what graphics related messages "dmesg" command show. If some files were missing, you could have solved the problem simply by installing the related packages. However, it is hard to pin point the error, if dmesg, /var/log/Xorg.1.log or /var/log/Xorg.0.log don't show anything.

      Graphical packages and libraries have changed significantly since the early ubuntu 12.04. In ubuntu 12.04.3 (or Elementary OS), I don't know if all the graphical packages and kernel (in addition to latest linux-firmware) have been updated to that of 13.10. If that was the case, if installing catalyst did not work, I would have suggested you to go with the open source option.

      • Hi! Thanks for your answer! I could get the open source option work, but now im stucked with the “xrandr –listproviders” command: it does nothing (executing that returns all the options for xrandr and that is not there). However, i think that now both cards are working, unless the Intel is selected. How can i do now to do the switching?? Thanks a lot!!

      • First you need to make sure /sys/kernel/debug/vgaswitcheroo/switch is enabled (this gets disabled when you have catalyst and related packages installed). This file is only accessible if you are root (use sudo su to login as root first before doing cat /sys/kernel/debug/vgaswitcheroo/switch).

        Also, for muxless to work, you need to have mesa 9.2 and above (xorg-edgers should do that) and install kernel greater than or equal to 3.11 (3.12 is much better). In addition to that, make sure you have compatible linux-firmware package installed. If there is no message (dmesg) pertaining radeon is disabled, you are good to go. In my case, since my AMD graphics card driver is CAICOS (smc I guess), before ubuntu 13.10, I used to go to http://people.freedesktop.org/~agd5f/radeon_ucode/, download necessary file, copy it to /lib/firmware/radeon and run update-initramfs -u. Of course this is no longer required, even if I go with newer kernels in ubuntu.

        And the final bit, you need to have both graphics card enabled during boot (at least in ubuntu). That means, you should not have something like (echo OFF > /sys/kernel/debug/vgaswitcheroo/switch) in /etc/rc.local and as noted in the tutorial. #cat /sys/kernel/debug/vgaswitcheroo/switch must show both cards on Pwr.

      • Thanks in advance! I’ve checked: kernel is 3.12, mesa is 9.2, switcheroo is enabled, and both cards are shown as Pwr! However, dmesg presents the following error: “[drm:evergreen_startup] *ERROR* radeon: error initializing UVD (-1)” and everytime i do glxgears -help, the renderer is the Intel card (in fact, in the cat vgaswitcheroo, despite both are Pwr the intel is marked with a plus sign). I’ve tried the switcheroo commands but it doesnt change.

        Also i’ve tried the radeon.dpm=1 on boot with no success. I feel im missing something! Despite all, the xrandr –listproviders still does nothing. I really apreciate your help! =)

      • +Pwr on Intel is the desired result in a muxless setup. The theory is, “after you setup (using setprovideroffloadsink command), the graphics processing happens in amd and the computed image is handed back to Intel graphics card for display”. That is why it is a muxless setup. You don’t switch graphics cards (as you did with catalyst). Therefore, the obvious question that might arise is, how to know, which graphics card is at work ?

        DRI_PRIME=1 glxinfo | grep render
        DRI_PRIME=1 glxgears -info

        Here, glxinfo (or -info) shows radeon, when our setup is working.

        As for your error, I suspect it has everything to do with firmware (aka radeon binary)

        Read this message and the next two messages that follow. Also, read how some people have solved this error in Phoronix.

        However, a simple solution would be to load ubuntu 13.10 in a flash driver, boot it and test the muxless setup and discern other missing pieces afterwards. The good thing about ubuntu 13.10 is, all of this works out of the box (even without having to enable xorg-edgers). All you have to do is find out the ids, setprovideroffloadsink using those ids and run any application you want to run on amd using DRI_PRIME=1 nameofyourapp.

      • I finally get it right!! I did a clean install and follow all steps and now its working =D thanks A LOT!! it really rocks!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s