Recently in Linux Category

xorg.jpg Today I've updated my ArchLinux distro and, magically, xserver stops working.

In the log file /var/log/Xorg.0.log I found the message:

================ WARNING WARNING WARNING WARNING ================
This server has a video driver ABI version of 11.0 that this
driver does not officially support.  Please check
http://www.nvidia.com/ for driver updates or downgrade to an X
server with a supported driver ABI.

It could means the drivers are build for a different version of Xorg (older than the current one in ArchLinux). To solve the problem you can disable the check until the new drivers will be availables.

Just create a file in /etc/X11/xorg.conf.d/ called 20-nvidia.conf with the following code:

Section "ServerFlags"
    Option  "ignoreABI"     "True"
EndSection

If you aready have this file, just add those lines at the end of it. After the reboot you'll be able to use the xserver.

Anyway the nvidia drivers warn you in the log file:

(WW) NVIDIA: The driver will continue to load, but may behave stran
gely.
(WW) NVIDIA: This driver was compiled against the X.Org server SDK
from git commit b6c7b9b2f39e970cedb6bc1e073f901e28cb0fa3 and may 
not be compatible with the final version of this SDK.
(WW) NVIDIA: This server has an unsupported input driver ABI versio
n (have 13.0, need < 13.0).  The driver will continue to load, but
may behave strangely.

and, actually, it behave strangely on my pc :-)

Another script to rename files

programmer_mug-p1682924711369532772ln8f_400.jpg I'm posting another small script to rename files.

I'm working on files with spaces in their name (Oh! The Evil!) and I need to rename them to remove spaces and conver in camel-case.

At this time, I chose Python (version 3) to guarantee the script works also on Windows.

Just create a file called (for example) ToCameCase.py and past into it:

#!/usr/bin/env python3

import sys
import os

if len(sys.argv)<2:
    print("Indicate the file pattern, please")
    exit()

for filename in sys.argv:
    name_tokens = filename.split(" ")
    new_name=""
    for token in name_tokens:
        new_name+=token[0].upper()+token[1:]

    os.rename(filename,new_name)

From the console call the script passing to it the file name o pattern to rename. For example

 ToCameCase.py *.obj

it will convert the name of all the OBJ files in the directory.

Just a warn: it is very simple and only-for-my-usage oriented, so be careful if you use it: read the code and test it before use on your files!

Upgrading to kernel 3 and the sed story of Grub error 15

P1000074-(Small)-754189.JPG Calm down: this is an happy-ending story.

I've recently upgraded my Archlinux machine to linux kernel 3.0.

After that, obviously, I haven't be able to boot my machine because Grub claim the error 15 (file not found). Anyway the workaround is easy. The problem is in the naming convention for the kernel images. It is different in the new release respect of the old one: the vmlinuz2XX is now vmlinuz-linux and the initrd-2.XX.img is now initramfs-linux.img.

This post could be useful.

So when the Grub menu shows up you can press the 'e' key and edit the item to change the name of files. After, boot the system by hitting the 'b' key.

...and remember to properly reconfigure Grub (or (Grub2)[https://wiki.archlinux.org/index.php/GRUB2]) before restart linux again... this is a reminder for myself, obviously.

Writers use Emacs...

hemingway.jpeg ...maybe.

I'm collecting some interesting reference about Emacs for writers. I want highlight two post here.

The first is Let's just use Emacs By Urpo Lankinen. He describes exactly my feeling about writers' tools and it faces the Scriveners dilemma (buy it, don't buy it). The post convinced me (I was already convinced actually) that Emacs could be a good tools to write novels.

Anyway a big doubt still stays into the deepest part of my soul: Emacs could be a distracting tool. Yes, I know, Emacs is (could be) a minimalist tool and it boosts your writing speed and it helps you to focus on your work and... and... and... but you have to learn it before to gain any sort of advantage form it. If you aren't a Emacs pro, you'll loose a lot of time in trying to be a pro. The main advantage of Scrivener is that you already know all you need to write and you can optimize your performances by learning tips and tricks day by day. To be clear, my suggestion is take your time to learn Emacs, anyway. This because some day in the future you'll wake up and latest Scrivener release will be full of feature that you'll never use (please Keith don't!) and the research of the perfect novelist tools will start back again...

The second post that I want link here is Writing in the Age of Distraction by Cory Doctorow. I quote, in toto, this post.

I'd linke to mention also The Woodnotes Guide to Emacs for Writers by Randall Wood. I suspect that the document is not fully update but it suggests good hints.

Be an Emacs pro

I saw a interesting page that explain how to be more productive by Emacs.

Read it, it is awesome: http://sites.google.com/site/steveyegge2/effective-emacs

I compiled VTK and ITK libraries on both Debian and Archlinux machines.

On these machines I love to be clean and neat so: - all the software and libs installed by apt-get/pacman are in the dir /usr - all the libs and software manually compiled are installed in the dir /usr/local Sometime this introduces some path problems.

For example, installing manually Python packages, I found a "bad install directory or PYTHONPATH" error and a message like this:

"You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. "

It means that I'm going to install the Python package in a directory that is not in the search PATH of your Python system. The system looks for packages in /usr/lib/pythonX.X/site-packages but I'm going to install in /usr/local/lib/pythonX.X/site-packages.

In this case, I love the Python solution and so: - Create a file named altinstall.pth (or use the preferred file name just with the .pth extension) containing the code: import os, site; site.addsitedir(os.path.expanduser('/usr/local/lib/pythonX.X/site-packages')) - Put this site in your system python site-packages dir: /usr/lib/pythonX.X/site-packages

Now your Python know where are you new python modules! Clean and easy-to-maintain solution!

P.S

If you need add the /usr/local/bin to your system path follow the same idea and create a file in /etc/profile.d/ with the code: export PATH=$PATH:/usr/local/bin

Error importing vtk python module: a clean solution

Well, after compiling your VTK (with Python support) on a Debian (or Archlinux), you could receive an error similar to this form python interpeter if you import vtk module:

ImportError: libvtkCommonPythonD.so.5.7: cannot open shared object file: No such file or directory

This occurs because VTK installer puts all shared libraries in a subdirectory of /usr/local/lib Solve it by creating a file called vtk.conf in /etc/ld.so.conf.d/ directory. In this file, put the path to VTK libs, for example: /usr/local/lib/vtk-5.7/

And so, launch (as root) the command ldconfig to update the shared library path cache.

This is a clean way to solve the problem: avoid symbolic links, copy/paste files or setting mess-oriented enviroment variable as PYTHONPATH and LD_LIBRARY_PATH, please!

Emacs for Python guys

ropemacs_example.png

The necessity to face Python programming in a "extremely serious way" leads me to try to define a portable and powerful development environment. For long time I used IDLE for Python programming but there isn't enough feeling between us.

I need a consistent multiplatform python programming environment because I work on 3 different operating systems (Win, Mac, Linux) and 2/3 different distro for each of it (XP, Vista, 7, archlinux, debian, ubuntu, slackware...).

Mainly I love texmate but it works only on Mac machines. My first choiche is EMACS on Linux systems (ok, ok, it's not true: for sysadmin tasks I prefer Vim...) On Windows... damn! After years, I'm still looking for something making me effectively comfortable.

Today, Googling for a while, I found an interesting post on http://www.enigmacurry.com

It describe a solution based on:

On Archlinux, installing the tools is trivial by Yaourt:

> yaourt -S ropemacs

> yaourt -S emacs-yasnippet

I'm going to test these for a while: if I'm happy with it, I'll post my configurations files to make this setup portable

Debian - Skype on 64bit platform

Well, waiting for the 64bit package (Skype, why you are waiting so long?) this is the fastest way to install Skype on a 64 bit system (now I'm using Debian testing distro).

  1. Download the Debian pkg from Skype website

  2. Install 32bit compatibility libs. You need: ia32-libs and ia32-libs-gtk:

    apt-get install ia32libs ia32-libs-gtk

  3. Install the skype package forcing the architecture. In my case the package name is skype-debian2.1.0.81-1i386.deb, if it is differente in your case, change it in the following lines:

    dpkg -i --force-architecture skype-debian2.1.0.81-1i386.deb

Well, try to launch skype. If you have a similar error message:

 Inconsistency detected by ld.so: dl-open.c: 611: _dl_open: 
 Assertion `_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT' failed!

you can fix it deactivating the Pulse audio libs. Use the following command to do that:

 chmod a-r /usr/lib32/libpulse*

That's all falks!

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.