Install AMD driver in Linux

1. Introduction

I found lots of people struggling to get catalyst driver work in Ubuntu 13.04. This issue has been persistent for some laptops, ever since Ubuntu 13.04 came out, specially for Intel, AMD dual graphics setup. For people, who have been looking at catalyst drivers ever since http://ubuntuforums.org/showthread.php?t=1930450 post was published, should not be that hard to find the solution, but for those who are new to Linux, or don’t have time for these kinds of issues, this might be a show stopper bug.

2. Installation

I removed the downgrading libudev and xserver-xorg-video section. Therefore, if you want to install 13.4 stable follow this link. For this tutorial, I will be using 13.11 beta 1 driver. I recommend you download the beta driver from here. I don’t always test the newer versions (let me know if there is some problem installing the newer versions). Unless AMD changes compatibility with xorg, kernel and xserver-xorg-video-intel it should be fine.

If possible, always use latest drivers. Before downloading the driver, make sure to read the release note (found in the download page) to find out the supported kernel and xorg versions and bug fixes. Download catalyst driver from here and unzip it in a directory. Using command line and building packages is the preferred method of installing the driver.

I. USING A GUI METHOD

Using a terminal go to the directory, where you have unzipped the file and run following command.

sudo sh ./amd*.run

Screenshot from 2013-07-25 19:32:32

It should open up a GUI, which you can use to easily install the driver. After reboot, you can follow from Step 4 of this tutorial. However, If you want to play 32-bit games as well, install necessary library using following command and then follow Step 4. If you are on ubuntu 13.10, ia32-libs is not available (see 32-bit library installation problem).

sudo apt-get install ia32-libs lib32gcc1 libc6-i386

Note: Many people have reported lots of problems (graphics and library) using above method. If you have graphics related errors, make sure you follow following option. However, make sure you properly remove this package (5. Reset Everything), before going with following option.

32-bit library installation problem: In ubuntu 13.10ia32-libs meta package is not present. If you get error while playing some 32-bit games, you need to install the 32-bit counter part of the package that provides the library with :i386 suffix. E.g If the error mentions libGLU.so.1, you need to installlibglu1-mesa:i386 and so on. You can inspect necessary packages from this link or if you want to install the packages I installed (after inspecting ia32-libs dependency in ubuntu 13.04), install them from this link.

II. USING COMMAND LINE AND BUILDING THE PACKAGES

a. Install the packages you need to compile the driver

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

b. Fix 64-bit dependency issue (ia32-libs is not available for ubuntu 13.10, see above)

sudo apt-get install ia32-libs lib32gcc1 libc6-i386

c. Remove old fglrx driver ( if installed already), and reboot. If you have used GUI method to install, see 5. Reset Everything below instead.

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

d. Build and install the downloaded driver. Using a terminal go to the directory, where you have unzipped the file and run following commands.

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

For ubuntu 13.10, use Ubuntu/saucy. You can find out the string using following command.

sh ./amd-*.run --listpkg

e. If second last command does not execute (say it complains about not having any graphics card installed), you might have turned off AMD graphics card using vgaswitcheroo switch, which you can enable using following command and then will be able to execute above command (before reboot). If you have already rebooted, go to a virtual terminal (Ctrl + Alt + F1), before login, and run above command (second last) to create xorg.conf file.

sudo su
echo ON > /sys/kernel/debug/vgaswitcheroo/switch

Also, if you later plan to remove catalyst and go with open source only option, you can copy following line into /etc/rc.local file (before exit 0) and this will turn off your AMD graphics card at boot and fix the heating caused by AMD graphics card.

echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

3. Other Errors

a. Fix unity, if it broke during installation (this will reset your Desktop)
cd ~/.config
rm -rf compiz-1 dconf gnome-session

You can also install compizconfig-settings-manager (cccsm) and enableOpenGL and Ubuntu Unity Plugin to get back the dash and other visual components.

b. TF2, Dota 2, Steam OpenGL or networking error

i. If other applications runs, but steam fails to start  with proper OpenGL support while using AMD drivers, you may choose to follow the command line and building the packages option, and if that does not fix the problem, you might have to clean up and re-install Steam.

Screenshot from 2013-07-25 21:56:19

Move SteamApps directory to some other place (it will be very fast, if you don’t change the drive), and re-install steam. You can move back that directory, after first login.

ii. If you get following error while playing TF2 or Dota 2

Required OpenGL extension “GL_EXT_texture_sRGB_decode” is not supported. Please update your OpenGL driver

It is probably because of a file in your home directory called .drirc. To fix this error, delete this hidden file logout login back and start the game in Steam. If it still does not work, make sure libtxc-dxtn-s2tc0 is installed. Also, you can create another user, copy or link steam related files and directories (~/.steam, ~/.local/share/Steam, ~/.steampid~/.steampath) and start Steam using this new account, to see if the error exists.

iii. While using AMD card, if it fails to login, it might be because of this error.

Adding following text to /etc/hosts might solve the network related error. However, use this text only if it fails due to networking issue.

87.248.210.253    media.steampowered.com
c. GPU Hang

With Intel drivers you might get sudden desktop freeze, or programs may slow down. Let us find out if it is actually a GPU hang issue, that I am talking about.

While the desktop or some application freezes, go to a virtual terminal (Ctrl + Alt + F1), login and run following command

tail /var/log/Xorg.0.log
i915_hangcheck_hung *ERROR* Hangcheck timer elapsed... GPU hung
capturing error event; look for more information in /debug/dri/0/i915_error_state

If you get error like this, you could fix this issue temporarily by killing gnome-session using

sudo killall gnome-session

Capture values of log files under /var/log directory (at runtime) using following command and report the bug to appropriate project or search online for that error.

tail -f /var/log/logfile > ~/logfile

Note: Here logfile could be any file under /var/log directory, speciallydmesgXorg.0.logsyslog etc.

Also make sure, you set game settings to lower, if you want to play it using Intel graphics card.

If you get slow frames per second in wine while using AMD graphics card, it might be because of the input lag that has not been fixed for a long time. For Intel graphics card in wine there is this sudden drop in FPS. I suggest you install software packages called htop (sudo apt-get install htop) and xosd-bin (sudo apt-get install xosd-bin). Run htop in a virtual terminal (Ctrl + Alt + F1) and run game with following command (to show frame per seconds on the screen).

WINEDEBUG=fps wine yourgame.exe 2>&1 | tee /dev/stderr | grep --line-buffered "^trace:fps:" | osd_cat

When game starts to lag and frame per seconds drops, switch to the virtual terminal, wait till the cpu percentage for the game process drops to normal (below 100) and switch back to X (Ctrl + Alt + F7) and continue playing. I was experimenting with xf86-video-intel-2.99.903 and the installation process was not seamless. I found this package to be quite good (only  two or three instances of severe lag). Therefore, upgrade to this version (when it releases) and use above method to see how it performs. In my test, I found in one of the games under wine (1.7.1), Intel graphics card to have better frame per seconds than the catalyst driver.

4. Test

a. Run fgl_glxgears and check the speed.

$ fgl_glxgears
fgl_glxgears

b. If you have dual graphics cards (Intel and AMD), switch between both and see if they work

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

5. Reset Everything

If this solution did not work for you, it is time to reset everything and go back to where you were before the installation.

If you had used GUI method to install the catalyst driver, you can remove catalyst driver using following command.

sudo sh /usr/share/ati/fglrx-uninstall.sh

After reboot, it should work as it used to work before the installation.

If you had used command line and building the packages method, you don’t have to do anything other than repeat commands at 2.c above. I will list them once again anyway.

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

6. Graphical Card Switcher (Optional)

As you saw in 4 (above), you can switch between two graphics cards using the command line. Firing up command line each time you want to switch graphics cards is not very intuitive. In that case, you could open Catalyst Control Center using sudo amdcccle and press the appropriate radio button and logout and login back. Since, even that step is not that good, I thought I would share a script that does it for me. Create a file in the bindirectory of your home folder called switchamdintel.pl (you can name it anything you like) with following content.

#!/usr/bin/perl
$checkGraphicsCommand = ` aticonfig --pxl`;
chomp $checkGraphicsCommand;
if ($checkGraphicsCommand eq "PowerXpress: Integrated GPU is active (Power-Saving mode).") {
 # Activate the discrete GPU driver 
 system "pkexec aticonfig --px-dgpu && pkill gnome-session"
} else {
 # Activate the integrated intel HD driver
 system "pkexec aticonfig --px-igpu && pkill gnome-session"
}

Next, create a desktop file called switchamdintel.desktop inside~/.local/share/applications directory (i.e the hidden folder inside your home directory, press Ctrl + H to show it) with following content.

[Desktop Entry]
Name=Switch AMD Intel 
Comment=Switch to AMD Graphics card
Exec=/home/username/bin/switchamdintel.pl
Icon=/home/username/Icons/amd-intel.png
Terminal=false
Type=Application
Categories=System

As you might have guessed, in above script you should change username to your actual username and place a 256×256 png image of something that says amd and intel inside Icons directory called amd-intel.png. Also, adjust path of Exec and Icon path to locations where these files are located. If string comparison line in above perl script is different, change it to the actual output thrown by aticonfig –pxl command.

amd-intel

Make both files executable using chmod +x filename. If you logout and login, from now on you can search switch keyword in unity dash or go toSystem category in application menu and launch the switcher. It will change the graphics cards and logout.

Hope it helps. Cheers !!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值