Posts Tagged ‘Fedora’

Fedora upgrade broke Xorg… SOLVED!

Posted in Computers, IT, Linux on May 11th, 2010 by matt – 2 Comments

A few of us here at work are using Fedora 12, two of the guys upgraded Fedora to find X not starting, seemingly a broken nvidia driver. Because they had issues I was careful about updates. But the inevitable happened.. I updated killing my Xorg.

I decided I’d do a bit of research into what was actually happening.. the fix the others used at work was to install the free nvidia driver or use a driver without proper 3D support, I didn’t like this so I started by checking my logs and then some google-fu.

The Xorg log file showed (/var/log/Xorg.0.log):

(II) May 11 11:18:49 NVIDIA: Using 768.00 MB of virtual memory for indirect framebuffer
(II) May 11 11:18:49 NVIDIA: access.
(II) May 11 11:18:49 NVIDIA(0): Initialized GPU GART.
(II) May 11 11:18:52 NVIDIA(0): Setting mode
(II) May 11 11:18:52 NVIDIA(0): "DFP-0:nvidia-auto-select+0+0,DFP-1:nvidia-auto-select+1680+0"
(EE) May 11 11:18:56 NVIDIA(0): WAIT: (E, 0, 0x827d, 0)

Notice it seemed to hang on a wait.

So I checked the kernel log (/var/log/messages) and found a lot of repeating entries:

May 11 11:19:55 localhost kernel: DMAR:[DMA Read] Request device [01:00.0] fault addr 22d226000
May 11 11:19:55 localhost kernel: DMAR:[fault reason 01] Present bit in root entry is clear
May 11 11:19:55 localhost kernel: DRHD: handling fault status reg 2

These repeated hundreds of times.
OK so time to start googling, it turns out these errors seem to point to the PCI bridge or something related to that, the device [01:00.0] turns out to be the address of my video card.

Some google hits talked about a bios issue and recommend adding “intel_iommut=off” to the kernel line, I also found mention in a kernel mailing list post about “intel_iommu=off”, as my PCI bus was made by Intel I thought I’d give it a go.
NOTE:
To check your PCI Bus you can use the “lspci” command.

For the keen observers you’ll notice intel_iommut and intel_iommu, I didn’t know if one had a typo so I added them both to my kernel line and booted.. and SUCCESS, Xorg started!

Updated Note: Thanks to Chris the only option you need is “intel_iommu=off”.

For those who don’t know how to add the extra stuff to your kernel command line permanently, then edit /boot/grub/menu.lst.

In this file there should be an entry for each kernel and operating system you have installed, each new entry starts with a “title” line, under which is a root, kernel and initrd line, just append the new option(s) to the end of the kernel line for the entry/kernel you want. e.g:

title Fedora (2.6.32.11-99.fc12.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32.11-99.fc12.x86_64 ro root=/dev/mapper/system-fedora noiswmd LANG=en_AU.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet nouveau.modeset=0 vga=0×318 intel_iommu=off
initrd /initramfs-2.6.32.11-99.fc12.x86_64.img

NOTE: The kernel line above is actually wrapping to a new line in, but should actually be all on the same line.
So there you go.

Backup your iphone SMS’s as a conversation transcript.

Posted in Computers, IT, Programming on February 4th, 2010 by matt – 1 Comment

At the point in writing there aren’t many ways of backing up your SMS’s from your iPhone, but you do a system backup when you sync with itunes but what if you want your SMS conversions backed up as a simple non proprietary format? Well the answer is here!

Shea recently upgraded to an iPhone, and was having trouble with bluetoothing the data across from her old phone. She told me she had saved the most important SMS’s but was a shame to loose the record of our entire SMS communication history.
And she’s right, in today’s world where everything is digital a lot of important relationship related stuff was discussed and it would be a shame to loose it all. So I started googling, at first I thought it would be a feature of itunes.. i was wrong.. which is a shame. But it turns out people have done it before, and some applications where written to do just that, unfortunately though all report that they only work for the iphone OS version 2.0. Sure it would be alot easier if the phone was jail broken, but there must be an easier way.. and there is!

Step 1 – Extract the SMS database from one of your iPhone backups:

I came across this OSX app, I’m not sure if there is a windows equivalent but seeing as I sync my iPhone under OSX I don’t really care.
Anyway this app allows you to access one of your iPhone backups and extract parts of it. For this post we are only interested in the SMS’s so once you have chosen a backup from the list scroll to the bottom and extract “System Files” or “Other Files” (can’t remember the name will check when I get home).

You’ll be prompted for a location to extract to, I suggest you extract the contents to an empty folder.
Once the files have been extracted you should find a sms.db file under:

<extracted folder>/System Files/Library/SMS/sms.db

This sms.db turns out to be a sqlite file.. and for those in the know, know that this is good news! With a few lines of python we can access and extract what we need from the file, but first we need to find the structure, which leads us to step 2.

Step 2 – Determine the sms.db table internal table structure.

There are many sqlite applications, but I’ll point you to 2 of them. A OSX app and a Linux app.
For OSX there is  sqlitebrowser and for Linux I simply used sqliteman which to install is as simple as:
For Debian/Ubuntu:

apt-get install sqliteman

For Fedora:

yum install sqliteman

Now inside the sms.db file there turns out to be 5 tables:

_sqlitedatabaseproperties
group_member
message
msg_group
msg_peices

All actual SMS text are stored in the ‘message’ table, and as the conversion I needed to backup was a simple 1 on 1 conversation all I needed was to query this one table.
While we are here what’s the structure of the ‘message’ table, well there are 17 columns but the only ones that I required where address, date, text and flags.

  • address – Is the number of the person you were having the SMS communication with.
  • date – Date of the text in epoch format.
  • text – The text itself.
  • flags – numerical flags attached to the message, but just looking at the table I realised that if the flag field contained a 2 then the text was from the recipient, a 3 indicated it was send from you.

With all that information I was ready to write my simple script, which leads to step 3.

Step 3 – The basic script

This python script does need some work, I only wrote it as a once off, so adding more exception handling and passing in the main parameters into the script rather then using variables would be useful, but outside the scope.

It is also worth a mention that I am using python 2.6 and it does also require the sqlite module, under fedora it is as simple as:

yum install python-sqlite2

Note: Yes its the 2nd version of the python sqlite module, but is actually supports sqlite version 3, so inside python you ‘import sqlite3′ so it actually is the sqlite3 module.

Now for the script, don’t forget to change the <data place holders> with the data you require:

#!/usr/bin/env python                                                                                                                                        

import sqlite3
import time
import sys
import os
import codecs 

DEBUG = True
names = {'2' : "<Recipient>", '3': "<your self>"}
key = "<number>"               

SQL = "select flags, address, date, text from message where address = '%s'"

output = """%s - %s
        %s         

"""

def getDate(epoch):
        return time.strftime("%a, %d %b %Y %H:%M:%S",time.localtime(epoch))

def main(dbfile, outputfile):
        outFile = codecs.open(outputfile, encoding='utf-8', mode='w')

        conn = sqlite3.connect(dbfile)
        c = conn.cursor()
        c.execute(SQL % (key))

        count = 0
        firstDate = ""
        lastDate = ""

        for row in c:
                flags = str(row[0])
                for name in names.keys():
                        if name in flags:
                                user = names[name]
                date = getDate(row[2])
                text = unicode(row[3])

                outStr = output % (user, date, text)

                if DEBUG:
                        print outStr

                outFile.write(outStr)

                # Store the first Date
                if count == 0:
                        firstDate = date
                lastDate = date
                count += 1
        outStr = "Date Range: %s - %s" % (firstDate, lastDate)
        if DEBUG:
                print outStr

        outFile.write(outStr)
        outFile.close()

if __name__ == "__main__":
        if len(sys.argv) < 3:
                print "%s  " % (sys.argv[0])
                sys.exit(1)

        dbfile = sys.argv[1]
        outFile = sys.argv[2]

        if not os.path.exists(dbfile):
                print "%s doesn't exist" % (dbfile)
                sys.exit(1)

        main(dbfile, outFile)

This creates a transcript like:

Matt - Mon, 04 Feb 2010 08:01:38
This is a text message

Other Person - Mon, 04 Feb 2010 08:02:38
This is the response.

Anyway happy backing up!
Needless to say I believe Shea was happy :)

Temporarily disable SELinux in Fedora.

Posted in Computers, IT, Linux on January 4th, 2010 by matt – 2 Comments

I know, I know, most Fedora users probably are giving me the evil eye as they read this, but I find this tip useful when something on my desktop machine isn’t behaving properly and I want to see if it’s SELinux causing the behaviour, or if I want to stop the security for I one time only test.

For example, when migrating some of our unit tests, some virus scanning unit tests were failing, as this was a test I don’t run on my Desktop except on this occasion, it was simply easier to disable SELinux while I run the test.. it ran fine, so I could turn it back on, and tick it off my list.

By disable I actually mean put SELinux into passive mode, which allows everything, but still logs problems.

Anyway, to temporarily disable SELinux as root run one of these:
echo 0 > /selinux/enforce
setenforce 0

To re-enable it simply echo 1:
echo 1 > /selinux/enforce
setenforce 1

Australian FTP RPMFusion Repository

Posted in Computers, IT, Linux on December 10th, 2009 by matt – Be the first to comment

There is an Australian FTP RPMFusion mirror:
baseurl=ftp://mirror.transact.net.au/rpmfusion/free/fedora/releases/$releasever/Everything/$basearch/os/
baseurl=ftp://mirror.transact.net.au/rpmfusion/nonfree/fedora/releases/$releasever/Everything/$basearch/os/

For updates:
baseurl=ftp://mirror.transact.net.au/rpmfusion/free/fedora/updates/$releasever/$basearch/
baseurl=ftp://mirror.transact.net.au/rpmfusion/nonfree/fedora/updates/$releasever/$basearch/

NOTE: This purpose of this post is simply for future reference.

Installing Sun Java on Fedora 12

Posted in Computers, IT, Linux, Programming on December 8th, 2009 by matt – 3 Comments

By default Fedora 12 doesn’t install Sun’s Java, and it isn’t in the repository. This isn’t a mistake, in fact I think this is a good decision! Fedora is only dealing with free open source software. You can add other repositories to give you the extra non OSS software you want, for those who cannot live without certain software.

Fedora uses the OpenJDK, which I think is awesome.. but unfortunately as I am a Java developer at the moment, and it seems some of the software I work requires the Sun version of Java, at least to compile.

So I needed to install Sun JDK on my 64bit machine.. this is how I did it:

  1. Download the Sun Java JDK 64bit Linux bin installer.
  2. Run it to install.
  3. Even though I ran it as root it installed in the current folder. So move the folder to we it should be installed:
    sudo cp -a jdk1.6.0_16 /usr/lib/jvm/
  4. Use the alternatives command to tell Fedora to use the new Java binary, to do so we need to “install” the new binary as an option in alternatives:
    sudo /usr/sbin/alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_16/bin/java 20000
    Then use alternatives and make sure our new binary is selected:
    sudo /usr/sbin/alternatives --config java
  5. Use the following command to verify that Fedora is pointing to the right binary:
    java -version

That’s it, Sun’s Java should now be installed!

Fedora 12 + Nvidia

Posted in Computers, IT, Linux on December 4th, 2009 by matt – 7 Comments

By default Fedora 12 comes with the nouveau driver.. which is awesome, but my machine at work needed a bit more video card grunt so I needed to install the Nvidia driver.

Now I’m new to Fedora.. as in installed it an hour before I wrote this post, so thought I’d document here how to do it.
It wasn’t as straight forward as it _should_ have been, as apparently there is a bug in the current (at time of writing) version of Xorg, which causes X to run really slow. Anyway this is what you do:

  1. Add the rpmfusion repositories (to gain access to proprietary and other packages not supported by Fedora).
    su -c 'rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm'
  2. Update yum:
    sudo yum update
  3. Now install the Nvidia drivers:
    sudo yum install kmod-nvidia xorg-x11-drv-nvidia-libs.i686 xorg-x11-drv-nvidia-libs.x86_64
  4. This should blacklist the nouveau, but doesn’t remove it from the initrd, so we run:
    sudo dracut -f /boot/initramfs-$(uname -r).img $(uname -r)
  5. Then we can restart, or just restart X (sudo pkill kdm) to see the new Nvidia card in action.

You should now been using the new nvidia module, however on my Fedora 12 KDE installation the X response time was really slow. However on a friends Fedora 12 Gnome installation there wasn’t an issue.
Apparently it is a bug in Xorg, but seeing as it doesn’t effect a friend it makes me wonder if it is a KDE/Xorg/Nvidia bug.

Anyway to fix it up we need to install a patched Xorg:

  1. First we need to add a repository:
    sudo vim /etc/yum.repos.d/xorgFix.repo
    And paste the contents:
    [rdieter]
    name=xorg-x11-server rebuilds for nvidia users
    baseurl=http://rdieter.fedorapeople.org/repo/fedora/$releasever/$basearch/
    enabled=1
    gpgcheck=0
  2. Run ‘yum update’  again, and it should need to update Xorg. Update it then restart X.

X should now run correctly. Phew.. not too hard right.