June 2010 Archives

Debian - FATAL: Error inserting fglrx

Upgrading the kernel is always a dangerous step. Anyway, under Debian, it is pretty simple. My main problem are ATI drivers. After each kernel upgrade this error appears: FATAL: Error inserting fglrx (/lib/modules/2.6.32-5-amd64/updates/dkms/fglrx.ko):Invalid module format

I think the problem is that the package fglrx-modules-dkms is upgraded after the kernel but before the reboot, so it is compiled under the old kernel version. So rebooting, the error rise because wrong kernel version.

If you have the same problem after the reboot you can try my way:

  1. Remove the module: rmmod fglrx
  2. Remove the fglrx-modules-dkms package: apt-get remove fglrx-modules-dkms
  3. Reboot
  4. I'm using GDM so, when the system is up, I switch to a textual console (ALT+CTRL+F1) and log in as root.
  5. Stop GDM: /etc/init.d/gdm stop
  6. Reinstall the fglrx-modules-dkms package: apt-get install fglrx-modules-dkms
  7. Load the fglrx module: modprobe flgrx
  8. Restart GDM: /etc/init.d/gdm start

That's all. These easy steps fix the problem on my PC always.

Image formats: mass conversion on Linux

To convert a file from a image format to another, you can user the 'convert' command on Linux.

One of the common situation is to convert a large number of images. The firts attempt could be to combine convert and findcommands.

This code converts all the Jpeg images in the current directory into PNG.

 find *.jpg -exec convert \\{\\} \\{\\}.png \;

This fast-and-dirty solution has side effects because convert uses the extention to define the target image format. Indeed the converted files end with a double extention: the original one and the new one. So image01.jpg became image01.jpg.png.

To solve this, I wrote a simple script. You can copy and past the code in a file called mass_conv.sh:

 #!/bin/bash
 function usage () {
              echo "mass_conv -  mass image conversion"
              echo "Usage:"
              echo "       mass_conv.sh source_extension target_extension";
 }

 if [ "$#" == "2" ]; then
       for old_name in *.$1
       do
       new_name=`echo $old_name | sed s/.$1/.$2/`;
           convert $old_name $new_name
      done;
 else
      usage
 fi

The script uses the sed command to correctly rename the target file. Just an example: to convert all the Jpeg images into PNG format without double extention you can write: ./mass_conv.sh jpg png

Blender stereoscopy plug-in

I'd like to announce the new version of the Blender script to set stereocameras developed by Sbastian Schneider. Sebastian has integrated my hack in this version so it is possible to save and load settings: thanks Sebastian!

You can download the script from the Sebastian's website.

I'm using this script to teach Stereo basis in the Virtual Reality course.