Tag Archives: Debian

Giving up fglrx in Debian Wheezy

The title says it all. A recent update has once again killed fglrx direct rendering from working with Xorg, so I’ve decided to just switch over to the free software Gallium driver entirely. This means no Amnesia, but I’ve since finished that game. It probably goes without saying that CrossFire won’t work now too, so… I would like to say that three of my GPUs are just doing nothing, but there are still power management issues with the radeon driver so the fans are sending my wife and I deaf while my cards cook at around 80-90 degrees, and it heats up my apartment noticeably – an annoyance since we’re heading towards the middle of summer here. It also means no OpenCL support since the AMD APP SDK depends on fglrx, although fortunately I haven’t been using that lately either.

The uninstallation of fglrx did not go smoothly. There have been times since I first performed my current desktop OS install where I manually ran the installer downloaded from AMD’s website, which spread files all over the place. These had to be cleaned up. The following two links were the most useful I came across which deal with this problem:

However, the final issue I had was documented on neither of those. The AMD installer created a file on my system in /etc/profile.d/ati-fglrx.sh which set an environment variable which caused direct rendering fail ($LIBGL_DRIVERS_PATH IIRC). Removing that file, logging out and in again got everything back to normal… well, “normal” as described above. :/

I’m still keeping fglrx on my laptop though (which I haven’t updated in a while)… for now. I don’t want my laptop run into the same power management issues leading up to Linux.conf.au 2012.

Here’s something I’ll be taking away from this experience. Proprietary software might sometimes be better than free software, but generally there can be no expectation of it becoming any better in the future than it is today. In the future it may become incompatible, may add new restrictions upon you, may not support new formats, may force you to upgrade (sometimes at cost) to continue functioning properly, etc. The issue I have experienced in this post was the former. With free software however, I can generally expect that the software I have today will never become worse over time – that is, it only gets better. Even in cases where ‘better’ is debatable (eg. GNOME 3), it can be (and often is) forked by anyone. That’s one of the reasons I love it.

To show my support of free software and software freedom, I have finally done something I feel guilty for not doing a long time ago – and became an associate member of the Free Software Foundation.
[FSF Associate Member]

Tough time for Debian Wheezy users running fglrx (and farewell GNOME)

Do you run the fglrx driver on Debian Wheezy? I sure do, and if you’re like me I feel your pain.

About a month ago, the fglrx packages were added back into Debian Testing so the previous workaround is no longer required. Unfortunately not long after things appeared working, the Debian guys decided it would be a good time to upgrade to GNOME 3, which caused all kinds of graphical corruption and made Debian all but unusable for me. I actually found myself booting into my Windows install for a while.

A newer fglrx driver was then released which fixed most graphical glitches, however things were still far from perfect. As an example the alt tag pop-up text in Firefox was rendered incorrectly and barely readable, but for the most part things were okay… until I tried to play a video. Hello bug #649346 – “fglrx-driver: using xv extension crashes Xorg”. At the time of writing, this still isn’t fixed. Naturally this is all terribly frustrating.

I generally use mplayer whenever I need to watch a video, so the work-around for me was adding “vo=gl” under the [default] section in my ~/.mplayer/config file, and being extra careful mplayer is the default video player for everything!

There’s one other interesting thing that happened to me over the weekend – I ditched GNOME. I’ve been a GNOME fan-boy since the pre-1.0 releases back around 1998, so you might imagine the significance of this. Certainly some of the lead GNOME guys have previously upset me by encouraging some further development to be in Mono, but my real reason for doing this is simply because modern GNOME 3.x versions just don’t seem to cater to me any more. After using it for a few weeks, I just feel too constrained.

For example, I wanted to find a way to select an appropriate font size. I couldn’t – I could choose “Small”, “Medium” “Large” etc. I know I like font size 8, but there was no way to select it – all the options gave something too big or small for my liking.

Another thing I use all the time is virtual desktops. Right now, I’m using 3, but sometimes I find myself using 10 or more depending on my workload. Because GNOME has always defaulted to two horizontal panels along the top and bottom of the screen, my virtual desktops have also always been aligned horizontally. GNOME 3 changes this – you have to get used to managing them vertically. Further, I can’t assign e-mail to virtual desktop 7 – GNOME only creates them as you need them. This may seem like nit-picking, but it’s too difficult to get used to, and it just feels inefficient.

Then there’s the Alt+Tab functionality. How could they screw that up? Well, if you have 10 Terminator (xterm) windows open for example, GNOME considers them all to be a single application. So when you Alt+Tab to switch through them, they all appear as a single item. Instead, you must Alt+tab to Terminator, and then Alt+` to switch between the individual terminals. I’m sure they were aiming for efficiency here (for a change), but it all feels very tedious and breaks conventions everyone is already used to.

Opening a new program is also annoying in GNOME 3. You need to move the mouse over to the top-left corner of the screen, then click an Applications icon that appears a few centimetres away (probably further away on larger screens). An large (huge?) icon for every application will appear after a few seconds of loading time – which is impractical for most people since the list is so big, so you need to narrow down the results by category. So now move the mouse way over to the right side of the screen to what looks a bit like the traditional GNOME 2.x menu options. These limit the giant application icons to only those that fit within that category.

What happens if the application you have has been installed manually and does not have a GNOME launch icon? Well, you need to create one manually, of course! Fire up your favourite text editor and create one under ~/.local/share/applications/ or some such. What a pain in the ass! Unlike the good old days of creating a custom application launcher through the GUI, in GNOME 3 you need to do it all through text editors.

You can add commonly used application launch icons to a dock on the left-hand side of the screen, but if you’re like me and use a bunch of different applications depending on the task at hand, that’s not particularly helpful. In fact, quite frequently I find myself hitting ALT+F2 to just type the name of the application I want to launch. This functionality is still there in GNOME 3, however it’s far less useful than it used to be. Auto-complete functionality seemed to be missing, however it’s still the best option for launching applications when you don’t want to bother with creating launch icons.

Some of the GNOME 3 options simply aren’t even implemented. For example, telling GNOME you want your user to automatically log in doesn’t work – you need to edit configuration files. How a major release ever made it out in such a state I’ll never know.

Another thing I wanted to do was tell GNOME that my default terminal should be Terminator, since it was clearly ignoring my /etc/alternatives/x-terminal-emulator setting. Unfortunately, that’s a matter of firing up gconf-editor and hunting down the option. What used to be a simple drop-down menu in GNOME 2.x no longer exists!

Some of the above issues are able to be worked around via Shell Extensions, and GnomeTweakTool, but it seems stupid to be forced to waste time with hacks just to get basic functionality going. Firefox provides everything needed for efficient web browsing out of the box, and if you want extra uncommon functionality the extensions are there to help you out – but it’s still a perfectly good web browser without them. GNOME 3 on the other hand just feels useless as a desktop without them. It’s a disaster.

So what have I switched to? I wanted something Debian was likely to have good support for, so I started poking around the available packages:

$ for i in $(apt-cache show task-desktop | grep ^Recommends: | cut -d ' ' -f 2- | tr -d ',|') ; do [[ ${i} = *desktop ]] && echo ${i} ; done
task-gnome-desktop
task-kde-desktop
task-lxde-desktop
task-xfce-desktop
$

I’ve given KDE a number of chances over the years, but have always switched back to GNOME due to its complexity. When you get frustrated trying to hunt down an option you know should exist, something has to be wrong. However, my N900 does run LXDE in a chroot and it seemes okay, so I gave it a spin. Ouch was it buggy! Trying to configure options would spit out random errors which had been fixed in newer releases which made it into Ubuntu over a month ago, but were still an issue in Debian Testing? Seemed to me like the Debian guys haven’t given LXDE much love, so that leaves me with Xfce. Linus Torvalds switched to it a while ago… how bad can it be? Well, I did try it years ago, and my memories of it were not good… but given the lack of options I thought I’d give it a try anyway. And boy was I impressed!

GNOME 2.x users will feel right at home. Imagine GNOME 2.x… except with more options for configuration out-of-the-box! I was able to make my Xfce desktop look and behave almost identically to GNOME 2.x, and it feels quicker to boot! I don’t know why the Mate project (aiming to fork GNOME 2) is bothering – Xfce just feels so right. :)

I did have one issue with Xfce sound however. I have basically two sound cards – an Intel HD Audio Controller located on my motherboard, and my Logitech G35 USB headset. Stock Xfce did not seem to provide any option for switching between these on the fly, however audio was one thing that GNOME (both 2 and 3) got right.. which gave me an idea. Under Settings -> ‘Session and Startup’ -> ‘Application Autostart’, I added /usr/bin/gnome-sound-applet (which comes from the gnome-control-center package). Now, audio works just as well under Xfce via this applet as it does under GNOME. Beautiful!

There’s a few other little things I’ve found in Xfce where I’ve thought “wow that’s a nice touch”. Eg. I regularly Alt+drag windows around, but with Xfce you can actually drag them to neighbouring virtual desktops! It might not sound that amazing, but it feels nice. Also, when you want to move an applet around on the panels, you get a square appear that makes it very clear what the panel will look like if you left-click to confirm – as opposed to the GNOME way where you see the results as you have already made the change by dragging. Lastly, say I click on a launcher for a program that is already open in another virtual desktop which I forgot about, instead of getting a flashing icon in the task panel and having to click it to jump to a different virtual desktop (as would be the case in GNOME 2.x), you just have the application instantly move from whichever virtual desktop it was on to the current one. These are all minor details, but have made me pleasantly surprised.

As for the Xfce panel applets, some are better than those in GNOME 2.x, and some aren’t quite as good. Overall, I didn’t feel any worse off. I did think the Directory Menu applet will be really useful, but I haven’t relied on it much yet (perhaps out of habit of not having it). If you like GNOME 2 and hate GNOME 3, definitely do yourself a favour and give Xfce 4.8 a try for a few days and see what you think.

fglrx on Debian Wheezy (testing)

Packages fglrx-driver and fglrx-glx have been removed from Debian for the last few weeks due to #639875, so I’ve been using the free software Radeon drivers in the meantime. While I appreciate having my virtual terminals display the console at my native screen resolution automatically, I don’t like that I’ve had to put playing Amnesia on hold for a while – these drivers cause the game to segfault.

Today I decided to roll back my xorg version to get the fglrx drivers working again, and as it turns out, it really wasn’t that hard. Here’s how I did it.

  1. Set up a preference control file (eg. /etc/apt/preferences.d/60xorg_rollback_for_fglrx.pref) as follows:
    
    Package: xserver-xorg
    Pin: version 1:7.6+8
    Pin-Priority: 1001
    
    Package: xserver-xorg-core xserver-xorg-dev
    Pin: version 2:1.10.4-1
    Pin-Priority: 1001
    
    Package: xserver-xorg-input-evdev
    Pin: version 1:2.6.0-2+b1
    Pin-Priority: 1001
    
    Package: xserver-xorg-input-kbd
    Pin: version 1:1.6.0-3
    Pin-Priority: 1001
    
    Package: xserver-xorg-input-mouse
    Pin: version 1:1.7.1-1
    Pin-Priority: 1001
    
  2. Now add the following repositories to your apt sources configuration (eg. /etc/apt/sources.list.d/60snapshot-20110911T211512Z.list):
    deb http://snapshot.debian.org/archive/debian/20110911T211512Z/ wheezy main contrib non-free
    deb-src http://snapshot.debian.org/archive/debian/20110911T211512Z/ wheezy main contrib non-free

    These include Xorg package versions that don’t have the ABI change which is incompatible with fglrx.

  3. Normally, Debian will spit out the following error:
    E: Release file for http://snapshot.debian.org/archive/debian/20110911T211512Z/dists/wheezy/InRelease is expired (invalid since 33d 17h 12min 59s). Updates for this repository will not be applied. We fix this by adding an apt configuration file (eg. /etc/apt/apt.conf.d/60ignore_repo_date_check) like so:

    Acquire
    {
    	Check-Valid-Until "false";
    }
  4. We should now be able to resynchronize the package index successfully.
    apt-get update
  5. Log out of your X session (if you haven’t already), and (from a virtual terminal) stop gdm/gdm3/lightdm or anything else that might be responsible for an Xorg server process running. eg,
    /etc/init.d/gdm3 stop
  6. Revert xorg packages to older versions, as defined in our preferences policy.
    apt-get dist-upgrade
  7. Install the fglrx drivers from the snapshot repository.
    apt-get install fglrx-driver fglrx-glx fglrx-control
  8. Make sure Kernel Mode Setting is not enabled. This should (in theory) be handled automatically due to the /etc/modprobe.d/fglrx-driver.conf file created during the fglrx-driver package installation – or at least it seemed to be for me.
  9. Create a new xorg.conf file. Assuming Bash:
    mv /etc/X11/xorg.conf{,.$(date +'%Y%m%d%H%m')}
    aticonfig --initial
  10. Reboot, and you should be presented with some kind of X display manager login screen. If everything went well, you should be able to see the following:
    $ glxinfo | grep -E '(^direct\ |\ glx\ |^GLX\ |^OpenGL)' | grep -v '\ extensions:$'
    direct rendering: Yes
    server glx vendor string: ATI
    server glx version string: 1.4
    client glx vendor string: ATI
    client glx version string: 1.4
    GLX version: 1.4
    OpenGL vendor string: ATI Technologies Inc.
    OpenGL renderer string: AMD Radeon HD 6900 Series  
    OpenGL version string: 4.1.11005 Compatibility Profile Context
    OpenGL shading language version string: 4.10
    $ 
    

Update (2011-10-23, 10:14pm): In case it wasn’t clear, these changes are temporary. However that brings up new questions like how will I know when I need to revert these changes? and how do I revert?. Well, the first question is easy to answer – simply run the following command:
$ [ "$(apt-cache policy fglrx-driver | grep -E '^(\ |\*){5}[0-9]+' | wc -l)" -ge 2 ] && echo "fglrx-driver is back - time to upgrade xorg" You can optionally put that in a daily cron job to have it e-mail you when it is time.

Reverting the above changes is also very easy:
$ rm -f /etc/apt/preferences.d/60xorg_rollback_for_fglrx.pref /etc/apt/sources.list.d/60snapshot-20110911T211512Z.list /etc/apt/apt.conf.d/60ignore_repo_date_check
$ apt-get update && apt-get dist-upgrade
followed by a reboot.

AMD Fusion E-350 – Debian Wheezy (testing) with Catalyst 11.5 drivers and VA-API support via XvBA

My new Sony Vaio 11.6″ laptop runs an E-350 processor. I’ve upgraded the RAM to 8Gb and threw in a OCZ Vertex 2 SSD. Even using LUKS under LVM2, it feels insanely fast.

Everything I’ve tried works perfectly on it out of the box, including the card reader, HDMI port, Gigabit NIC, USB ports, sound card, wireless, Bluetooth, volume/brightness/video output function keys, etc. Well, almost everything… the graphics is one glaring exception.

For instance, when I go to log out or drop to a virtual terminal, I get all kinds of screen corruption and can’t see a thing. I always need to hit CTRL+ALT+F2 to switch to a virtual terminal, and CTRL+ALT+DEL to restart it to get picture back. Fortunately the SSD means that’s under a 30 second wait to shutdown and boot up again into the login screen, but after owning this machine for just over two weeks now it was starting to get old.

Further, 3D acceleration via Mesa3D was painful. Games like the Penumbra Collection ran at about 1 FPS. It looks like the Phoronix guys have tested newer versions with Gallium3D which look slightly more pleasing, however none of that’s in Debian and I don’t want to waste lots of time recompiling everything and potentially causing new updates to break. Further, while I could watch 720p video reasonably well, 1080p video would occasionally cause slowdowns and prevent the viewing experience from being completely enjoyable.

Time to do something I’d rather not… and install the proprietary driver. 11.3 is currently in the testing repos, however it still isn’t efficient enough to allow 1080p video to play properly. Downloading the new 11.5 Catalyst driver also fails to properly install due to a DKMS compilation error.

Fortunately, Mindwerks has instructions on how to fix this issue under Ubuntu 11.04. With a few little tweaks they can be made to work with Debian too.

Instructions:

Debian Wheezy (7.0) users can finally get fglrx playing nicely together with X.Org X Server 1.9.5. We can also make the latest driver work well with the 2.6.39 kernel.

The Minderks custom build procedure follows, adapted for Debian Wheezy (7.0) users. Note that the commands are for 64-bit, but the only change 32-bit users likely need to make is to download an i386 package instead for step 8. Also, the following commands assume you use the sudo package to gain root.

  1. Install the latest 2.6.39 kernel revision from kernel.org. eg.
    $ wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.39-rc7.tar.bz2
    $ wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.39-rc7.tar.bz2.sign
    $ gpg --verify linux-2.6.39-rc7.tar.bz2.sign linux-2.6.39-rc7.tar.bz2
    $ tar jxf linux-2.6.39-rc7.tar.bz2
    $ cd linux-2.6.39-rc7
    $ make-kpkg -j2 --rootcmd fakeroot --initrd --bzimage kernel_headers kernel_image
    $ sudo dpkg -i ../*.deb

    and boot it.

  2. Download the AMD Catalyst 11.5 64-bit driver installer.
  3. Install the Debian VA-API packages. Note that some say to get them from the Splitted Desktop website, however I tried them and didn’t notice any benefit in doing so so reverted to the following:
    $ sudo apt-get install libva1 libva-x11-1 libva-tpi1 libva-glx1 libva-dev
  4. Extract the files from the package:
    $ sh ./ati-driver-installer-11-5-x86.x86_64.run --extract ati
  5. For 2.6.39 support, download this additional patch: 2.6.39_bkl.patch
    $ wget http://www.mindwerks.net/wp-content/uploads/2011/03/2.6.39_bkl.patch
  6. Check for Big Kernel Lock usage:
    $ cat /lib/modules/$(uname -r)/build/.config | grep -c CONFIG_BKL=y

    If the result of this command is 0, then download no_bkl.patch as well. For stock kernels you should get 0 and will need the patch – which is probably the main reason you are here. :)

    $ wget http://www.mindwerks.net/wp-content/uploads/2011/03/no_bkl.patch
  7. then apply them:
    $ cd ati; for i in ../*.patch; do patch -p1 < $i; done
  8. Build your new ati/fglrx driver:
    $ sudo ./ati-installer.sh 8.85.6 --install
  9. Since we’re using the proprietary drivers, we might as well make the most of them. Grab the latest XvBA backend library for VA-API:
    $ wget http://www.splitted-desktop.com/~gbeauchesne/xvba-video/xvba-video_0.7.8-1_amd64.deb
    $ dpkg -i xvba-video_0.7.8-1_amd64.deb
    $ cd /usr/lib/dri && sudo ln -s ../va/drivers/xvba_drv_video.so fglrx_drv_video.so
  10. If your /etc/X11/xorg.conf is missing you will need to run:
    $ sudo aticonfig --initial

    and then reboot.

That newly created package should work for the entire 2.6.39 series.

These steps are really useful for AMD Fusion users at the moment. Without VA-API, multi-threaded mplayer will occupy 100% of available CPU (both cores) and drop frames when playing a test 1080p MKV file I have (containing H.264+AAC+AAS). It’s not unwatchable, but it’s annoying. With VA-API-patched mplayer, CPU usage never hits 15% when playing the same test video!

It’s a pity that the Catalyst driver doesn’t currently correctly generate deb packages for Debian, but the fglrx packages are not listed as a depenency for xvba-video so it’s not a major problem.

Update (2011-05-17, 12:41am): Using the new kernel is not necessary. Although there appear to be a few AMD Fusion fixes in there, I haven’t noticed any benefit in using 2.6.39-rc7 – possibly because I’m using the proprietary drivers. In fact, I’m not completely convinced the Catalyst 11.5 drivers are required either as I was having problems getting mplayer to use VA-API when I was testing 11.3. I’d be interested to know if just steps 3, 9 and 10 would be sufficient for hardware decoding using the patched mplayer and the default fglrx-atieventsd fglrx-control fglrx-driver fglrx-glx fglrx-glx-ia32 fglrx-modules-dkms package versions. I might very well have done much more than required.

Update (2011-05-22, 9:04pm): You do not need Catalyst version 11.5 – you can use the version in the repositories. In fact, I recommend it. The reason being (aside from having the drivers managed via apt) is that the compiling and installing 11.5 via the instructions above won’t enable 32-bit compatibility. I tried running a few games under WINE yesterday, but WINE always complained that OpenGL (and hence DirectX) was not available to it. Presumably I needed whatever the fglrx-glx-ia32 package included. Possibly I was just missing something as simple as a system link before, but I didn’t investigate – I’d rather use the standard Debian packages wherever possible if they do the job. Also, you don’t need to manually fetch the Splitted Desktop xvba-video package – xvba-va-driver is basically the same thing, only A) xvba-va-driver is in the official Debian repositories and B) it specifies the fglrx packages as a required dependency.

So in summary:

  1. Don’t touch your kernel.
  2. $ sudo apt-get install libva1 libva-x11-1 libva-tpi1 libva-glx1 libva-dev xvba-va-driver fglrx-atieventsd fglrx-control fglrx-driver fglrx-glx fglrx-glx-ia32 fglrx-modules-dkms
  3. $ sudo aticonfig --initial
  4. Reboot
  5. Use the VA-API-patched mplayer for watching movies.

It’s easy when you know how. :)

Update (2011-07-03, 12:11am): If you run gnome-mplayer (perhaps so you can make use of gecko-mediaplayer for libva-accelerated video in Firefox), be aware that Debian currently ships no later than 0.9.9.2 – even in sid. Thus, you will encounter a problem with a filter gnome-mplayer automatically uses which is incompatible with vaapi – and will automatically disable it. I can verify that 1.0.4 avoids this issue, and allows gecko-mediaplayer to work wonders when combined with the ViewTube and YouTube HTML5 forever Greasemonkey scripts.