Fixing AMD (ati) radeon display issues on Fedora

Note (09/01/17): also worked on a recent upgrade from 23 to 25.

I had put off system upgrades for so long that I found myself having to go from Fedora 20 to 23. It took a while but everything was going smoothly until I hit Fedora 23 on. There, after the mandatory reboot, hooking up my secondary monitor would freeze the display and screen repainting on some programs (like Eclipse) had become problematically slow and CPU demanding. This being Linux, I scoured the web on a quest to find some clues on what was not configured correctly but nothing came up. I’m running an AMD A6-3420M APU and while AMD provides driver for that chip, they are according to reports very finicky and a pile of trouble to get running.

I resorted to simply downgrading the driver. It was working correctly in the past, so I could see no obvious reason an older version would not do it this time.

First find the version of the driver currently installed:

dnf info xorg-x11-drv-ati

Which should spit out something along the lines of:

Installed Packages
Name        : xorg-x11-drv-ati
Arch        : i686
Epoch       : 0
Version     : 7.6.0
Release     : 0.4.20150729git5510cd6.fc23
Size        : 151 k
Repo        : fedora
Summary     : Xorg X11 ati video driver
URL         : http://www.x.org
License     : MIT
Description : X.Org X11 ati video driver.

So the faulty driver is version 7.6.0. Now, run:

sudo dnf --showduplicates --allowerasing --releasever=24 downgrade xorg-x11-drv-ati

Here, we’re asking dnf to go look in a previous release of Fedora for an earlier version of the driver. If the problems you are experiencing appeared with a recent update, you could avoid the –releasever argument altogether to just revert back to the previous version.

If the downgrade does not work, you rerun the command to roll back the driver even further in the past, but if after a couple times you haven’t had success, the issue probably lies with another package so run a dnf update to and take your investigation elsewhere, maybe the kernel, wayland, X, the window composer or gnome-shell.

When you update your system in the future, you’ll have to run:

sudo dnf --exclude=xorg-x11-drv-ati update

Otherwise, dnf will reinstall the broken later version of the package. This command will also give you packages with broken dependencies. That’s normal, those are packages that share dependencies with the one you have downgraded and for all I know could actually have been the ones causing you trouble. Just let them be.

Make sure you check back from time to time if another version of the offending package has been released by issuing a simple dnf update and checking the version now available.

How to download a CBC radio show episode no longer available as a podcast

Sadly, CBC (Canadian Broadcasting Corporation) has a policy to keep podcasts available for download only 3 months for daily shows and 6 months for weekly shows with some of them being available for an even shorter time. Luckily, most shows can still be streamed from the CBC radio website using a flash/web player but are still no longer available for direct download. That’s convenient if you’re in front of your computer (which is seldom the case when listening to radio), but not that practical if you want to take an old favorite on a run.

Most of what we do on our computers is just data copying and playback, always in that order. So if it’s playing in your computer speakers, its coming from a stream, and if it’s coming from a stream, it can be copied as file. There are tons of software and websites that will let you do just that, but most of them are geared towards more popular streaming sites of the likes of YouTube and such so I had to resort to another technique for the CBC’s website. The non-trivial part here is to find the URL from which the data is coming from but modern web browsers and their built-in debugging facility have made this an easy task. Once you have the URL, you’re free to download the wanted file at will. This process assumes you’re using Chrome, but it works just as well with Firefox.

So let’s say I want to download this past episode of the show Ideas. There is a player on the page, but no download link.

  1. Bring up the page in Chrome but don’t start streaming yet.
  2. Left-click anywhere on the page and click on “Inspect element“, this will bring up the Chrome debugger.
  3. Within the debugger, switch over to the “Network” tab.
  4. On the episode’s page, start steaming the episode by clicking the play button, you’ll see a bunch of things happening in the debugger window.
  5. Click on the “type” column to sort the data elements by type and find the audio/mpeg (or media) one, that’s the file you’re streaming (see screenshot below). Mine’s name is ideas_20130307_53465_uploaded.mp3.
  6. Left-click on the name and select “Copy link address” or “Open in new tab” and that’s it, from there you can download the episode as a file. The link for my episode is http://thumbnails.cbc.ca/maven_legacy/thumbnails/14/881/ideas_20130307_53465_uploaded.mp3. When opening up the link in your browser, it might bring up its own player but if you click around, you’ll find an option to download the file instead of playing it.
Chrome debugger view with the stream data row highlighted. Left-clicking on the row will bring up a link to the stream itself and allow its downloading.

Chrome debugger view with the stream data row highlighted. Left-clicking on the row will bring up a link to the stream itself and allow its downloading.

Fold-down back seat modification on a Toyota Corolla 1999 VE

Toyota Corolla 1999 VEOn several occasions lately, I’ve had to transport long objects or gain access to the rear strut mounts in my Toyota Corolla. On most cars, this would have meant to simply pull a lever in the trunk and fold the back seat down but for some reason, Toyota had made this an option on my vehicle (the North American VE model).

So in order to be able to take advantage of the full length of the car, I had to remove the rear seat, which is not that difficult and only requires a socket wrench, but still massively inconvenient. While undoing the seats, I had originally thought of a way to make removal easier and tool-less in the future, but did not decide to make the modification. Until now, with winter at my doorstep, I’m convinced fold-down seats are going to prove themselves quite practical should I want to go skiing.

The mod is quite easy and requires no specialized tools or knowledge. The end result is that you will be able to lift the backrest up and lay it flat on top of the bottom cushion, exposing the opening to the trunk .  Since the seat belts are bolted to the frame, disturbing the seating should not have any effect on their function. However, you might end-up discarding a part I call the V frame, which could possibly have some structural or security importance, I’ll get to it later. Lastly, I’m not going to post a full disclaimer, this is the internet so you’re following this guide at your own risk. If you or your passengers get hurt because of this modification, nothing can be held responsible but you and your judgement.

Removing the rear seat

Bottom cushion out

Bottom cushion out

Taking the rear seat apart is nothing really complicated. The bottom cushion is held to the frame of the car by only two plastic clips that are approximately lined with the two front seats. You can even feel them by running your hand under the cushion along the outer edge. Pry them out with a sudden pull and they should give.

Backrest out

Backrest out

Next, undo the three bolts holding the back cushion to the frame. There is a bolt in the middle and two at the extremities close to where the seat belts attach to the frame. Lift the backrest out and set it aside outside the car. At this point you can re-install the bottom cushion to make working in the car a bit more comfy. Finally, push out the black plastic cache that separates the trunk and the interior.

If you just wanted your rear seat out only as a temporary measure, stop here. The car is perfectly drivable in this state. You might notice the road vibrations becoming somewhat louder but that’s entirely normal given the amount of noise insulation you just removed.

Removing the V frame

V frame removed

V frame removed

What I refer to as the V frame is the coincidentally V shaped piece of pressed sheet metal bolted right in the middle of the opening to the trunk. It’s in the way but if it does not bother you you can certainly keep it there. I, for one, decided to remove it because I did not deem it to be critical for the safety or handling of the car. First, Corollas with factory installed fold-down back seats do not have it and I’d be really surprised if their frame was any different than the standard model to account for the added structural integrity. Second, if it’s purpose was to give the body more stiffness, the V would be upside down. It could have a part to play in case of rear collisions, but my theory is that it’s meant to add support to the rear seat. So If you agree with my logic, you can go ahead and remove the six bolts that hold the V frame in place.

Fastening the bottom cushion

Bottom cushion fastened

Bottom cushion fastened

Last major step is fastening the bottom cushion. It has three metal prongs that would normally slide under the backrest part of the seat, but since it will now become loose, the bottom cushion needs to be attached to the frame. Once you have re-installed the cushion, simply drill holes where the prongs are. Rest assured, the metal is not very thick and your fuel tank is a safe distance below. Once that is done, use properly sized sheet metal screws and washers and thread them through the holes you just did to hold the cushion down.

Cut that metal prongOf the metal prongs on the bottom of the backrest that used to be screwed to the frame, the middle one get in the way and should preferably be removed. Its not absolutely necessary, but it will make installation easier. This procedure can be accomplished with a bolt cutter or a metal saw. There is another prong right next to the one you just cut that is meant to slide under the seat cushion; leave it in place.

Finally, slide in the backrest, thread the seat belts in their correct position and set it so the metal loops below the headrests pair up with the hooks on the frame. Give it good tap so it sits correctly and you’re done. Nobody should ever notice this little trick but I’m sure its going to prove itself very useful.

Done! You can now transport dead bodies in your trunk without having to cut them up.

Done! You can now transport dead bodies in your trunk without having to cut them up.

How to fix (fsck) a root file system that you have to boot into on Linux

Two days ago I corrupted my file system during a failed resume from standby on Fedora 19. This feature has never quite worked correctly and randomly makes the kernel panic. Usually, I hard reboot my laptop and everything is fine but that time, something went wrong and when it came back up:

systemd-fsck[605]: /dev/sda2: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
systemd-fsck[605]: (i.e., without -a or -p options)
[ 13.652068] systemd-fsck[605]: fsck failed with error code 4.
Welcome to emergency mode. Use "systemctl default" or ^D to activate default
mode.
Give root password for maintenance
(or type Control-D to continue):

In this case /dev/sda2 is my root partition and since it was mounted even in maintenance mode, attempting to run fsck on it would output:

fsck.ext4 /dev/sda2
e2fsck 1.42.7 (21-Jan-2013)
/dev/sda2 is mounted.
e2fsck: Cannot continue, aborting.

Which makes sense as common knowledge tells us that running fsck on a mounted file system will most likely do more damage to it.

The best option

Your best option is simply to boot into another Linux, be it on a different partition, a USB drive or a CD and run fsck manually on the faulty partition, which can easily be unmounted if necessary because no OS is using it. Easy. Normally yes, but my stupid Macbook Pro 2008 cannot boot though USB into anything else other than Mac OS X, my cd drive has been dead for years and recently, I got rid of my OS X partition. To make things more complicated, I’m in Thailand at the moment and obviously not able to take apart my computer to grab the hard drive and stick into a working system.

The other option (if you cannot boot into another Linux)

In order to assess the damage, I ran fsck in dry-run mode and piped the output to more to make reading more practical:

fsck.ext4 -n /dev/sda2 | more

From there, I could ensure that no critical files had been damaged and while keeping in mind that it’s always a gamble to use a corrupted file system, I proceeded to boot into the system to make some backups. That out of the way, I did some research on the web on how to fix a root file system that I had to boot into and sadly, not many things turned up for its not an ideal solution. Forcing the system to do it a boot time by creating a file named forcefsck and writing y in it (echo y > /forcefsck) at root no longer works and adding fsck.mode=force on the kernel command line did not fix the problem as fsck will not fix errors on its own without authorization, ie: someone to enter yes on the keyboard. Tried a few other tricks but none worked. I had no choice but keep my fingers crossed and use the system as is.

A few days later, I decided to get back to the issue and while researching alternative solutions, I read that it was possible to fix errors on a read-only file system, which it turns out can also be used to boot into. And it worked, so for posterity here is the technique:

  1. Put your root partition into read-only mode by modifying the faulty partition’s line on /etc/fstab (but remember your old settings):
    UUID=fd1d0fad-3a4c-457f-9b5e-eed021cce3d1 /                       ext4    remount,ro        1 1

    Note: If you’re already in maintenance mode at this point, you may be able to remount your file system in read only mode by running “mount -o remount,ro /” and skipping the reboot (thanks Jay).

  2. Reboot
  3. Switch to runlevel 1 just to minimize the amount of interfering processes (skip this step if you are running the session over SSH [thanks Josh]):
    init 1
  4. Fix your file system (replace /dev/sda2 with your partition’s device), which should now work because the root partition is in read only:
    fsck /dev/sda2
  5. Reboot
  6. Make your root file system readable/writable:
    mount -o remount,rw /dev/sda2
  7. Restore your /etc/fstab to its original state.
  8. Reboot

Voilà, your system is safe to use again. Hopefully this will have gotten you out of a sticky situation like it did for me. If errors keep coming up, it’s probably a sign that your hard-drive is failing and before you loose it completely, you should mirror your data to a new one.

Nuts for coconuts, the amazing ways of consuming this exotic fruit

The coconut at the stage we are most familiar with

We know coconuts as the principal ingredient of a piña colada, we know coconuts as the tasty filling of a bounty chocolate bar, we know coconuts as the crucial part of a good curry, we know coconuts for their awesome taste but otherwise, we remain pretty ignorant about its many uses and life cycle.

Allow me to enlighten you with my recent experience with this incredible fruit and the knowledge I gathered from the locals in the Carribean. While not scientifical, I sincerely hope you will remember this little piece should you ever become stranded on a lonely tropical island. Otherwise, just take it as a little how-to guide for the next time you find yourself around a lot of coconuts.

An opened coconut

Coconuts as their name implies, are the nuts (or fruit (technically a drupe)) of the coconut palm tree. They grow everywhere around the carribean coast of Costa Rica and as far as I know, their extend is very large and in some cases, their productivity can turn them into a nuisance. There is no season for these trees, they just constantly produce all throughout the year, with every batch taking a couple months to mature. Coconuts are large fruits and do not biodegrade very easily. So much so that locals have to get rid of them (and their leaves) using bonfires.

A yellow coconut palm

Coco palms come into a few varieties which are mainly differentiated by the colours of their nuts: yellow, green, or something in between. If you are after pipa, you will prefer the green variety for its sweetness but when they age, the differences in flavor dissapear and the nuts all turn the same brown.

The pipa

A green coconut palm, preferred for pipa

There is a couple of vendors yelling “pipa fria” around you but cannot quite figure out what they are selling? Its coconut water, or “pipa”. A young coconut before it becomes ripe has a lot of water in it, easily 150 ml I would say. This water is sweet, very rich in minerals and feels very healthy to drink, if you can get past the weird taste (it’s somewhat of an acquired thing). Mike, another volunteer at the association has aptly called pipa “the gatorade of the jungle”: some local guides will not bring any water bottles on patrols, they will just reach up for a pipa or two.

A yellow “coco tierno” alongside a green pipa

The pipa is probably the stage of the coconut that is easiest to consume. Vendors in the street will slice the top off, put in a straw an refrigerate pipas but in nature, you just grab, smash and drink. Grab a pipa from the palm, smash it one or two times against the trunk until the nut cracks and drink the dripping water. It’s a bit messy but even though it is sweet, pipa will not get your hands all sticky.

The older pipa (or half-coconut)

Size comparison of a more mature coconut to a young pipa (which I am holding)

As they age and ripe, pipas grow bigger, thicker, and get harder to crack open. Should you succeed tough, you get rewarded with sweeter coconut water and a gelatinous substance called “coco tierno” (tender coco) that covers the inside surface. Coco water serves as a suspension for the endosperm of the nut and as it matures, will form this deposit. This substance is what is later going to become the white hard flesh of a ripe coconut and while the taste is somewhat different, it definitely hints towards that flavor.

The white gelatinous flesh can be scooped using a slice from the skin, notice the presence of shell

This tasty flesh can be scooped using a broken piece from the shell or a slice from the skin of the husk but in order to access it the nut has to be split in half. Without the proper tools (a machete), this is quite a challenge and requires a lot of smashing around and prying. At this stage, the very hard shell which we are used to crack with a hammer has started forming.

The nut (as we know it)

The tool of choice when working with coconuts: the machete

Now we come back into known territory, the ripe and mature nut is what we are used to finding in northern hemisphere supermarkets. What we are not familiar with however is how incredibly hard it is to get to the nut itself. Covered by a dry husk made of a thick skin and very fibrous material, this one it truly a “tough nut to crack”. Once open, little coconut water remains, most of it has coalesced into the very flavorful flesh we are all so fond of.

A ripe coconut with the husk removed

When on the ground and in the presence of humidity, the nut will obviously start to germinate. From one end of the nut, leaves will burgeon and from that same end a root system will emerge, all feeding on what is inside the nut and turning the flesh and water into a coconut sponge. Very rich, this sponge when be pressed will ooze oil (good for cooking) or can simply be eaten. Be careful, common wisdom has that eating too much of this will give you diarrhea.

A germinating coconut

These nuts are nature’s own small ships, known to have traveled by sea for thousand kilometers to land on a small remote island and populate it with this awesome tree. I did not get into the great many uses of the husk (textile), shell (jewelry, combustible) and the tree (lumber) itself, I did not cover the great many culinary, medicinal and industrial applications of this plant as well. I admit to be

Coconut sponge

wholly ignorant in this matter: the list of use cases for the coconut palm and its fruits seems virtually endless, I just know how to eat them raw.

Now we need to figure out how to grow these in Canada.