Powered by
Movable Type 5.2.9

 Linux Archives

2006, October 04 (Wed)

Linux soft-raid & lilo

Sometimes I’m not quite fond of my Debian Linux. Recently I could barely help myself from putting my head in the cement mixer.

What you want:
Two harddisks, software mirroring for /boot and /, crypt for everything but /boot

Lilo can boot from raid (it latter turns out that this is not quite the case.. it depends).

How does this look practically?

   Device Boot      Start         End      Blocks   Id  Target
/dev/sda1               1         249     2000061   fd  [ /dev/md0 [ /dev/mapper/swap    [ swap  ] ] ]
/dev/sda2   *         250         257       64260   fd  [ /dev/md1                       [ /boot ]   ]
/dev/sda3             258       10217    80003700   fd  [ /dev/md2 [ /dev/mapper/dm-root [ /     ] ] ]
/dev/sda4           10218       30515   163043685   fd  [ /dev/md3 [ /dev/mapper/data    [ /data ] ] ]

(Analog for /dev/sdb)

The problem?

:/# lilo -v -v
LILO version 22.6.1, Copyright (C) 1992-1998 Werner Almesberger
Development beyond version 21 Copyright (C) 1999-2004 John Coffman
Released 17-Nov-2004, and compiled at 03:22:31 on Aug  1 2006
Debian GNU/Linux

pf_hard_disk_scan: ndevs=2
  0800  B1DB62EC  /dev/sda
  0810  BAC32241  /dev/sdb
device codes (user assigned pf) = 0
device codes (user assigned) = 0
device codes (BIOS assigned) = 3
device codes (canonical) = 3
Fatal: Inconsistent Raid version information on /dev/md1

Hit the jump for some more config file excerpts & the solution.

Continue reading “soft-raid & lilo” »

Linux cryptroot & debian initrd surprises

Ach ja, falls ihr fuer eure root Partition einen Schluessel mit mehreren Zeilen (Zeilenumbruch) ausgewaehlt habt, das kann das Debian init Script nicht -- also nicht verzweifeln beim Versuch den Schluessel einzutippen, es geht einfach nicht (auch nicht von externen Medien!).

2006, October 08 (Sun)

Linux Firefox punctuation boundaries in text input editing

There is one behaviour on Windows’ which I much prefer over Linux:

You can use the key Ctrl+<Action> to navigate between word boundaries, for example Ctrl+Backspace to delete the last word. This/is/especially/useful/when/editing/the/URL.html because it provides an easy means to delete back to the last /.

Unfortunately, on Linux, the only accepted boundary seems to be whitespace characters, so this is not very practical.

For my command line shell (zsh), I have changed this default behaviour with the command


This means that the characters &=/;!#%{ will also be recognised as valid word boundaries.

Unfortunately, Firefox does not allow such a fine grained control. Fortunately, you can at least bring the Windows Firefox behaviour to Linux. Here’s how:

  1. Go to about:config
  2. Search for layout.word_select.stop_at_punctuation
  3. If it doesn’t exist, right-click and choose New > Boolean
  4. Set layout.word_select.stop_at_punctuation to true


Linux Unicode, Console & Missing Glyphs

As someone who likes the linux virtual console and only delves into X when there are no more framebuffer programs available for doing what I want, ever since everything switched to unicode/utf8 something had been bugging me:

My font was lacking glyphs, such as «, etc.

And my programs would only show in their place or nothing at all.

So I went through every single console font I had on my system, only to find out that other fonts were then missing such crucial glyphs like the ` and which are pretty commonly used in the man-pages.

Hit the jump to learn about a workaround.

Continue reading “Unicode, Console & Missing Glyphs” »

2006, October 12 (Thu)

Linux, Programmierung Deutsche Umlaute auf Tastatur mit US-Layout

Wer viel programmiert hat wahrscheinlich bemerkt, dass das englische Tastaturlayout dafür besser geeignet ist, als das deutsche, da dort viele Sonderzeichen leichter zu erreichen ist. Allerdings stehen dort keine Umlaute zur Verfügung. Oft kann man diese zwar nur ae, oe, ue ersetzen, in formellen Schreiben ist dies jedoch eher unerwünscht.
Um dieses Problem zu umgehen, habe ich mir eine Keymap für xmodmap angelegt.
Diese ermöglicht es mir, die zweite Windows-Taste (Menü-Taste) als eine Art zweites Shift zu benutzen. D.h. mit Win2+a mache ich ein ä, mit Shift+Win2+a ein ä. Selbiges natürlich auch bei ÖöÜüß.

Um dies zu erreichen legt man eine ~/.Xmodmap mit folgendem Inhalt an:
keycode 117 = Mode_switch
keycode  38 = a A adiaeresis Adiaeresis
keycode  30 = u U udiaeresis Udiaeresis
keycode  32 = o O odiaeresis Odiaeresis
keycode  39 = s S ssharp
Um das Layout sofort zu aktivieren, einfach xmodmap ~/.Xmodmap ausführen.

Der Keycode 117 steht dabei für die Windows-Menü-Taste. Die Keycodes von anderen Tasten kann man über das Programm xev herausfinden. Die Namen von weiteren Sonderzeichen aus anderen Sprachen kann man sich aus den jeweiligen Layouts in /usr/share/xmodmap heraussuchen.

2006, October 16 (Mon)

Linux Debian & grub-install freeze on xfs

Now we have this typical scenario here where you need to install your boot loader. Into the MBR. And you’re running Debian. Plus, you decided to format your / as xfs.

The whole procedure is kind of like magic. Let me start of by telling you about the problems:

  1. Debian has patched grub-install in such a way to call xfs_freeze to freeze your file system. Unfortunately, that means your file system will be frozen and all programs will block until you unfreeze it.
  2. Well I’m actually clueless about the exact reason, but the Debian grub-install will still hang even if we fix #1.

Hit the jump for the ultimate “this works for me and I don’t know if it works for you” guide to installing grub with an xfs /

Continue reading “Debian & grub-install freeze on xfs” »

2006, October 28 (Sat)

Linux cheap "Now playing" with /exec and xmms2


/alias xmms2 /exec -out echo \$(xmms2 info|grep title\\\|artist|sed -e "s/.* = //"|tr "\n" ";"|sed -e "s/\(.*\);\(.*\);/spielt \2 von \1 mit xmms2/")


/alias xmms2 /exec - -out xmms2 info|grep -E artist\\|title|sed -e 's/^.* artist = / von /' -e 's/^.* title = /spielt /'|tr '\n' '|'|sed -e 's/\\(.*\\)|\\(.*\\)|/\\2\\1 mit xmms2/'

Different escaping rules, joy :)

2006, October 30 (Mon)

Linux Anti the "let's simplify" Linux movement

Target of flame: Gaim 2.0 http://gaim.sourceforge.net/

A quick look at the the facts: Gaim doesn't allow you to send your messages with <Ctrl>+<Enter> anymore. The reason?

to reduce the clutter in the User Interface

Hatred! Oh how this crap annoys me. In Firefox, Gnome, everywhere on Linux it seems the user needs to be freed from this "superfluous choice" and the interface needs to be "free of clutter".

Has anyone of you ever looked at the Firefox Preferences dialogue? The Gaim one? (It's better than the Firefox one by the way.)

Instead, the Gnome crowd goes on to replace crucial usuability settings with cryptic configuration-file only settings that are impossible to use for the novice user. I seem to remember having even read a post by Linus Torvalds rejecting Gnome for this oversimplification crazyness which is cutting away features from the user.

Compare also my post about navigating between words in the Firefox address bar which is only reachable via a hidden setting in about:config.

Here's how to fix this deficiency, the ugly way (hacking dirty config files):

Continue reading “Anti the "let's simplify" Linux movement” »

Linux mplayer, xvidix and the green greens

… and red, black and white interference. unichrome via cle266 graphics.

Today with the help of Reimar Döffinger I finally got around to be able to use mplayer http://www.mplayerhq.hu/ in X11.

I think I’ve been using this box for several years and always switched to the console in order to be able to watch a video — cvidix (console vidix) had been working fine all along. The next thing I’ll attempt is to compile this mplayer for firefox plugin, I guess.

(The next thing that happened wasn’t me compiling mozilla plugins, but that I typed out my entry and then tried to run mplayer -vo gl mf://*.jpg which resulted in a total system freeze and loss of entry. Thanks mplayer! Bah.)

To get mplayer working on X11, the first thing I needed to do was to install the svgalib http://www.svgalib.org/ kernel helper module as is briefly mentioned in the mplayer docs at http://www.mplayerhq.hu/DOCS/HTML/en/output-trad.html#vidix

After downloading and compiling the svgalib_helper, after a modprobe svgalib_helper and make device in the svgalib-1.9.*/kernel/svgalib_helper directory as well as moving the svgalib_helper dir into the mplayer source and recompiling the vidix drivers I was set up.

Now I could run mplayer with xvidix, but all I’d get would be a green window without video!

Continue reading “mplayer, xvidix and the green greens” »

Linux lirc and linux kernel >= 2.6.17

If you are using lirc, you might have noticed, that you can not compile the modules of the latest stable version (0.8.0) with a kernel 2.6.17 or higher. The reason for this is, that devfs was removed from the kernel from that version on.
This problem seems to be fixed in lirc-0.8.1pre2. This release compiled cleanly and works for me.
I guess there will be a new stable version soon as well.
An alternative solution would be to patch devfs back into your kernel, but I would only recommend that, if you have more problems with that kernel. For lirc it is not necessary.

2006, November 03 (Fri)

Linux bequemes Netzwerking

Ich hab mal wieder mit ein wenig mit ifplugd und guessnet gespielt. ifplugd ist ein kleiner Daemon, der ein Interface überwacht und falls dieses Interface einen Link hat (sprich: Kabel eingestöpselt oder im Falle Wlan in einen AP eingebucht) ein ifup auf das Interface ausführt. Sehr praktisch; heimkommen, Kabel rein, Netz tut, ab in die Uni, Wlankarte rein, Netz tut.

Ein Auszug aus meiner /etc/network/interfaces
mapping eth0
script /usr/sbin/guessnet-ifupdown
map default: dhcp

mapping eth1
script /usr/sbin/guessnet-ifupdown
map default: dhcp
map verbose: true

iface home inet static
up /usr/local/sbin/neednet
test peer address mac 00:40:33:A6:43:88

iface brenzstrasse-wlan inet dhcp
up /etc/init.d/openvpn start brenzstrasse-wlan
down /etc/init.d/openvpn stop brenzstrasse-wlan
test peer address mac 00:17:31:B4:21:28

iface uni-wlan inet dhcp
wireless-essid welcome
wireless-mode managed
up /usr/local/sbin/uni-ulm-kiz-gast.pl
test peer address mac 00:50:8B:EB:6A:A0

iface dhcp inet dhcp

Über das mapping eines Device wird ein default Ergebnis festgelegt, zum Beispiel ein auf DHCP konfiguriertes iface.

guessnet im ifupdown-Modus wird elegant über /etc/network/interfaces konfiguriert. Dazu müssen die Zeilen innerhalb eines iface mit test anfagen und zum Beispiel mit peer, wireless oder command weitergehen.

Die test peer address Zeile testet auf die MAC-Adressen bestimmter Rechner

Das ganze lässt sich noch mit wpa_supplicant kombinieren, das wenn es ein Wlan findet nach bestimmten Regeln die Wlankarte konfiguriert, so das ifplugd dann einen Link feststellen kann (sollten mehrere Netze verfuegbar sein).

2006, November 06 (Mon)

Linux BitchX on Debian amd64 Or vserver debootstrap chroot

Let me put it straight right away; I didn’t get bx to work reliably on amd64 and I don’t have the necessary C knowledge nor enthusiasm to endulge myself in finding the problems. What I’ll outline here is just the same style instruction on how to set up an ia32 chroot that can be found in many places on the net.

Update: It seems that some other linux distributions invest a bit more into amd64 compatibility than debian. I haven’t tested these patches yet, though. (But I could spot the /window crash bux fix.)

This post will give me enough information to recreate this setup at a later time — if you need any more details feel free to contact me.

Some sample instructions on how to set up such a 32bit chroot inside an amd64 environment can be found on https://alioth.debian.org/docman/view.php/30192/21/debian-amd64-howto.html#id292281

I just did debootstrap --arch i386 etch /var/ia32; of course you need to install debootstrap first. However, my 64bit are on a virtual server which does not allow me to execute mount commands even as root. That gave me a little headache, as debootstrap would crash in the middle; the reason apparently being that it tried to mount /proc, which it couldn’t (but it didn’t tell me that!):

I: Extracting zlib1g...
zsh: exit 2     debootstrap --arch i386 etch /var/ia32

The result was a broken debian installation without any much needed programs like apt, that with the help of Myon from #debian I could fix - however, I have no clean path. First, I entered the chroot: SHELL=sh chroot /var/ia32,
then I needed to create a few files: touch /var/lib/dpkg/{diversions,statoverride},
next, I tried to install all the packages debootstrap had downloaded: dpkg -i /var/cache/apt/archives/*.deb,
however, that wouldn’t quite work and I got a shitload of errors.

So the next thing I did was to run dpkg --configure -a, a typical command to execute whenever something with dpkg isn’t working quite right. Then I reran the dpkg -i command, which still bailed out, but with a few less packages on the list. Now started the fun part, I resolved all the dependencies by hand, installing each package manually with dpkg -i /var/cache/apt/archives/PACKAGENAME.deb. Oh the joy. After each install I reran dpkg --configure -a and looked at the top line to see what it was complaining about, for example

dpkg: dependency problems prevent configuration of lsb-base:
 lsb-base depends on sed; however:
  Package sed is not installed.

which I then follewed with a dpkg -i /var/cache/apt/archives/sed*.

For the last error:

Setting up base-files (3.1.16) ...
mkdir: cannot create directory `/var/mail': File exists
dpkg: error processing base-files (--configure):
 subprocess post-installation script returned error exit status 1

I simply had to rm /var/mail. Phew. Set up.

(Note: I did not follow the “fstab / mount” steps outlined in the AMD64 HOWTO nor did I set up schroot.)

Hit the jump if you want to learn about BitchX.

Continue reading “BitchX on Debian amd64 Or vserver debootstrap chroot” »

2006, November 14 (Tue)

Linux mplayer & via mpeg2 hardware decoder

My VIA Epia board is a bit weak to decode DVDs with the processor, so it has a hardware mpeg2 decoder on board. On Windows, this can be accessed with either PowerDVD http://www.cyberlink.com/ or WinDVD http://www.intervideo.com/

Googling reveals that there is a “VIA enhanced Xine Player” called VeXP for Linux that is supposed to do the job. However, I like mplayer and I had read that it would support XvMC — the XVideo-MotionCompensation extension — which is supposed to be a general layer to access hardware accelerated mpeg2 decoders.

(II) VIA(0): [XvMC] Registering viaXvMC.
(II) VIA(0): [XvMC] Initialized XvMC extension.

Of course, compiling mplayer with ./configure --enable-xvmc did not work.

MPlayer dev-SVN-r20923-4.1.2 (C) 2000-2006 MPlayer Team
CPU: VIA Nehemiah (Family: 6, Model: 9, Stepping: 8)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE
vo_xvmc: X-Video extension 2.2
vo_xvmc: X-Video MotionCompensation Extension version 1.1
Forced video codec: ffmpeg12mc
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
[VD_FFMPEG] XVMC accelerated codec.
INFO: libavcodec init OK!
Selected video codec: [ffmpeg12mc] vfm: ffmpeg (FFmpeg MPEG-1/2 (XvMC))
[VD_FFMPEG] XVMC-accelerated MPEG-2.
[VD_FFMPEG] Trying pixfmt=0.
VDec: vo config request - 720 x 576 (preferred colorspace: MPEG1/2 Motion Compensation and IDCT)
Trying filter chain: vo
vo_xvmc: query_format=1DC70082
vo_xvmc: Querying 1 adaptors
vo_xvmc: Quering adaptor #0
vo_xvmc: probing port #68
vo_xvmc: XvMC list have 2 surfaces
vo_debug: query(MPEG1/2 Motion Compensation and IDCT) returned 0x0 (i=0) 
vo_xvmc: query_format=1DC70002
vo_xvmc: Querying 1 adaptors
vo_xvmc: Quering adaptor #0
vo_xvmc: probing port #68
vo_xvmc: XvMC list have 2 surfaces
vo_debug: query(MPEG1/2 Motion Compensation) returned 0x0 (i=1) 
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
SwScale params: -1 x -1 (-1=no scaling)
Trying filter chain: scale vo
vo_debug: query(MPEG1/2 Motion Compensation and IDCT) returned 0x0 (i=0) 
vo_debug: query(MPEG1/2 Motion Compensation) returned 0x0 (i=1) 
The selected video_out device is incompatible with this codec.
Try adding the scale filter, e.g. -vf spp,scale instead of -vf spp.
[VD_FFMPEG] Unexpected init_vo error.
vo_xvmc: query_format=4D504553

Asking in #mplayer again (as I did in my last post about it), iive tolde me that the mplayer xvmc support would only work with NVIDIA’s hardware mpeg2 decoder. What a disappointment!

Turns out there is a (slightly outdated) patch at http://www.openchrome.org/ that brings the VIA XvMC support to mplayer.

Update: Check out their Mailing List, it might contain more recent and more professional patches!

Continue reading “mplayer & via mpeg2 hardware decoder” »

2006, November 27 (Mon)

Linux, Web Dump misc scripts: 32bit chroot on 64

compiling software in a 32bit chroot on a 64bit box which tries to loot out the arch with “uname” requires some guidance:


/bin/uname "$@"|sed -e's/x86_64/i686/'

Linux, Web Dump misc scripts: shadow mirror (aka xcopy/t)

populate a directory tree without the actual files, for example if you want to show someone your hdd content without giving her the data:

on the system with the data, create a list of directories:

find -type d > hdd_dirlist

and a list of files:

find -type f > hdd_filelist

on the target, replay these with

perl -ne'chomp;mkdir$_' ~/hdd_dirlist
touch .empty
perl -ne'chomp;link ".empty",$_' ~/hdd_filelist

beware of the links, if you want to put an actual file in place of a shallow one, rm it first or modify the scripts to create files instead of just links.

2006, December 18 (Mon)

Linux Was man in Firefox noch abschalten wollte


Link prefetching is when a webpage hints to the browser that certain pages are likely to be visited, so the browser downloads them immediately so they can be displayed immediately when the user requests it.

2006, December 28 (Thu)

Linux gajim bei suspend offline prügeln

Um zu vermeiden das man Jabbernachrichten verliert, muss man seinen Jabberstatus vor einem Suspend auf Offline setzen. Andernfalls merkt der Server nicht sofort das man offline ist. Dieses Feature haben viele Clients unter Windows und OSX (zB Psi), nicht aber unter Linux und vergleichbarem.

Gajim kann sowas mit gajim-remote. Die Kommunikation läuft über DBus. Der folgende Wrapper um gajim-remote setzt das Environment für den Session-Bus auf und führt dann gajim-remote aus.


# USAGE: gajim-remote-remote <display> <gajim-remote parameters>
eval $(DISPLAY=$DISPLAY dbus-launch --autolaunch=$(cat /var/lib/dbus/machine-id))
gajim-remote $gajimopts

Funktioniert nicht mit xdm (wohl aber mit gdm) aus Etch. Der Session-Bus will folgendermaßen aufgesetzt werden (zB in der ~/.xsession):

eval $(dbus-launch --autolaunch=$(cat /var/lib/dbus/machine-id))

2007, January 19 (Fri)

Linux Strange font problems in Firefox

I was having a strange issue where all the superscript text on Wikipedia would cause huge gaps — giant line height.

I’d get to see big gaps between or in midst of paragraphs.

But best see for yourself:
Screenshot of the problem

Apparently this line spacing issue is caused by an erroneous font description in the DejaVu Sans Condensed font:
This font inspector application says: Superscript y offset = 13400 (Screenshot by equinox.)

I have since removed the font, and the problem is gone.

2007, February 11 (Sun)

Linux, Netzwelt Shell.FM: A textmode last.fm-player

If you like last.fm, but (like me) you don't like all these shiny gui players, because you think that you don't need a gui to play music, you should try out Shell.FM.
Shell.FM is a very simple console player for last.fm, which seems to have all the features of gui players. The interface is not very intuitive, but it's well documented and quick to learn.
Anyway, you just need to enter your username and password and it will start playing your favourite songs.
It is written for Linux, but will probably run on any unix-based operating system.
For now it ran very stable on my ubuntu-based multimedia-system.

You can find everything you need at http://nex.scrapping.cc/shell-fm/

If you like this program you should also consider joining the group shell-fm on last.fm, where you can find some more stuff, like a perl module to control Shell.FM over a socket, an LCD module to output the status through lcdproc or a port to ARM which will make it run on some handhelds.

2007, April 04 (Wed)

Linux On C++ ABIs Or Debian, SCIM Input Method and a crashing Firefox

If you want to use the SCIM Input Method Editor on Debian (Etch) together with the official Firefox, you will ineviably be presented with:

/opt/firefox/run-mozilla.sh: line 131:  7083 Segmentation fault      "$prog" ${1+"$@"}
zsh: exit 139   /opt/firefox/firefox

Apparently the problem is caused by firefox being linked against libstdc++.so.5 while scim is linked against libstdc++.so.6. So what happens is that when Firefox tries to load the scim GTK_IM_MODULE, the libstdc++.so.6 is loaded into Firefox, and this won’t work because the ABI changed between version 5 and 6 of libstdc++.

This leaves us with three possible solutions:

  1. Compile Firefox yourself and link it against libstdc++.so.6

    I don’t like this solution because it is cumbersome, requires time and space, and has to be repeated for each new version of Firefox.

  2. Refrain from using SCIM and resort to good old XIM X Input Method instead.

    This solution works basically exactly as descibed on the SCIM website.

    You will have to export XMODIFIERS=@im=SCIM and export GTK_IM_MODULE=xim.

    Remember that with XIM, you must also have set LC_CTYPE to the corresponding language, i.e. export LC_CTYPE=zh_CN.gb2312 or else you won’t be able to activate the IME with Ctrl+Space.

    Because of the heavy environment tampering required here, it is most easy to create a little startup script for Firefox that sets the variables accordingly before invocing the firefox.sh script

    The disadvantage of this method is that it uses XIM (for details why this is bad refer to the SCIM documentation) and that you have to fiddle with your locale environment. It also dictates a single language that you have to use. Furthermore, the XIM edit style is always “outside of the application window” — you might or might not like this editing style.

  3. Use the C scim-bridge instead!

    Instead of using the scim GTK_IM_MODULE, there is another GTK_IM_MODULE available called scim-bridge. It is written in C and uses a socket communication with the C++-scim instead of being written in C++ like the scim GTK_IM_MODULE and therefore avoids the libstdc++ problems explained above.

    This package is available in Debian as scim-bridge.

    The scim-bridge is my prefered solution to this problem as it avoids recompilation of Firefox or XIM and features “on the spot” editing style.

    As you’d still want to use the regular scim module for all the other applications, I also recommend using a small Firefox wrapper that sets up the environment like this:

    [ x"$GTK_IM_MODULE" = "xscim" ] && export GTK_IM_MODULE="$GTK_IM_MODULE-bridge"
    /opt/firefox/firefox "$@"

Bonus: To use SCIM with Opera, keep in mind that Opera is a Qt (“KDE”) application. You can either use the XIM method described above and set QT_IM_MODULE to xim, or (prefered) install the packages scim-qtimm and scim-bridge-client-qt. Then you can set QT_IM_MODULE to scim (editing style: “outside of application window”) or scim-bridge (“on spot” editing style).

2007, April 08 (Sun)

Linux Juhuu, es ist ein Etch

Etch wurde so eben veröffentlicht und die Leute vom heise Newsticker arbeiten wohl auch an Ostern, wenn auch verwirrt: (heise online: Debian GNU/Linux 4.0 (Etch) veröffentlicht)

Die neue Distribution läuft nach Aussagen des Entwickler-Teams auf nahezu jedem Computer vom Handheld bis zum Supercomputer, weitere Informationen dazu enthält die Mitteilung zur Veröffentlichung.

und wohl noch nicht ganz wach: heise-doof.jpg

2007, April 20 (Fri)

Linux Booting floppy images using GRUB

Booting floppy images without having a real floppy drive can be handy for example when updating the BIOS or maybe even installing operation systems.

First get memdisk which is part of syslinux (also in the debian-package syslinux: dpkg -L syslinux|grep memdisk). memdisk is a small driver which emulates a disk in the RAM.

Then configure GRUB to take memdisk as kernel and the floppy image as initrd. memdisk and the floppy images need to be accessed by grub, so put them in /boot.

A sample GRUB configuration is:

title Upgrade BIOS
root (hd0,0)
kernel /memdisk
initrd /1KUJ09US.IMG

2007, April 30 (Mon)

Linux, Netzwelt Evolution & SyncML

For a long time, I've been trying to synchronize contacts and calendar entries between my mobile phone and evolution.
The right way to do this is obviously SyncML, as most modern mobile phones support it, and there are a lot of webservices who will provide you a SyncML-server for free.
However I always had issues getting SyncML to work with evolution (thunderbird/sunbird would be nice, too but I guess that's impossible at the moment).
Neither multisync, nor opensync worked for me in any way.

Now I finally found a solution that really works. There is a project called SyncEvolution. You will find the sources at http://www.estamos.de/projects/SyncML/index.html
Debian packages do not seem to be available right now.
Compiling and installing worked for me without problems. However you need some libraries and headers to compile it. On debian etch, you need to install these packages:


Then you can compile and install it with the usual `./configure; make; make install`

The configuration is a bit weird:

basically you will have to create these files in your home directory:

The last 4 files are optional, depending on which items you want to synchronize.

<server> is the identifier, just in case you have more than one SyncML-server.

syncml/config.txt contains the server configuration.

You can use etc/syncml-config.txt in the source directory as a template.
There are also templates for funambol and scheduleworld in the same directory.
I'm using www.scheduleworld.com.
mobical.net didn't work for unknown reasons.
See http://www.estamos.de/projects/SyncML/Compatibility.html for a list of compatible servers.

The configuration templates are well-commented, so I didn't need any further documentation.

I sometimes have problems, when syncing calendar entries that last a few days and are marked as 'all day'-events. Just enter a start and end time and it will work fine.

2007, May 07 (Mon)

Linux Newbie pitfalls: iwlist scan "No such device"

% sudo iwlist eth2 scan
eth2 Interface doesn't support scanning : No such device

% ifconfig|grep eth2

% sudo ifconfig eth2 up

% sudo iwlist eth2 scan
eth2 Scan completed :

2007, June 18 (Mon)

Linux How to set the environment using GDM

There seems to be a nearly undocumented way how to set the environment using GDM:


This file is sourced by /etc/X11/Xsession.d/55gnome-session_gnomerc which might be debian-specific.

Linux Small trick to execute something after an already running command has finished

Small trick to execute something after an already running command has finished:

fg; beep

2007, June 21 (Thu)

Linux ssh client keep-alive

man 5 ssh_config

Specifies whether the system should send TCP keepalive messages to the other
side. If they are sent, death of the connection or crash of one of the machines
will be properly noticed. This option only uses TCP keepalives (as opposed to
using ssh level keepalives), so takes a long time to notice when the connection
dies. As such, you probably want the ServerAliveInterval option as well. How‐
ever, this means that connections will die if the route is down temporarily, and
some people find it annoying.

So maybe echo TCPKeepAlive true >> ~/.ssh/config could prevent those dead ssh-sessions after resume. Let's give it a try.

2007, June 28 (Thu)

Linux, Programmierung Direct I/O filesystem access in Linux with O_DIRECT

I just tried to read files from the filesystem using direct i/o to avoid the operating systems caching effects.
The manpage of open lists the flag O_DIRECT for this. Although I included fcntl.h, my compiler complained that it couldn't find O_DIRECT:

contrib/myfile.c:44: error: ‘O_DIRECT’ undeclared (first use in this function)

The solution was easy:
You just have to

#define _GNU_SOURCE

before including fnctl.h.

This is actually mentioned in the manpage, but only in a footnote that is easy to overlook.

2007, July 11 (Wed)

Linux Thinkpad S3 after s2disk wakeup workaround

There is a problem with recent kernels (I think to recall 2.6.20 as the first to tail) and Thinkpads wakeup behaviour.

Please read the following problem description twice as many people seem to misunderstand my problem:

After the first (successfully) suspend to disk using swsusp from the vanilla kernel waking up from suspend to ram using the LID button fails. Waking up by pressing the Powerbutton still works.

Even /proc/acpi/wakeup tells LID is enabled for wakeup:

$ cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
LID       S3    *enabled
SLPB      S3    *enabled

It actually is not. There is a small workaround; just disable and reenable LID as wakeup source:

echo LID >/proc/acpi/wakeup
echo LID >/proc/acpi/wakeup

And maybe find out why swsusp fiddels with these values. After rebooting wakeup works out of the box

Edit(2007-07-16): Does not work reliable.

2007, July 12 (Thu)

Linux How to make gnome-power-manager (hal) respond to thinkpad-acpi hotkey events

thinkpad-acpi (known as ibm-acpi up to Linux 2.6.22) can generate ACPI events (loading with hotkey=enable) for several Fn-Fx combinations, including Fn-F4, which is already supported by ACPI. However, the generated events differ from the usual events.

button/sleep SLPB 00000080 00000002

ibm/hotkey HKEY 00000080 00001004

Using gnome-power-manager and hal on etch this makes suspending using Fn-F4 impossible, because the hal does not recognize the events. The fix is quite simple; build and install hal from lenny:

apt-get source -t lenny hal
apt-get build-dep hal
cd  hal-<version>/

Now you have to alter debian/rules: add ---enable-acpi-ibm to the configure target and build the package using:

fakeroot dpkg-buildpackage -uc -us

After installing the new packages and their depencies (hal-info from lenny) the new hald will send Sleep events when pressing Fn-F4 and Hibernate Fn-F4, which makes gnome-power-manager to initiate a suspend to disk cycle.

2007, July 17 (Tue)

Linux via: framebuffer cursor/ gray bar near upper left corner

Since recently switching from the open source to the binary VIA Xserver, I always had an annoying gray bar near the upper left corner of my screen. It would go away by switching to a text mode framebuffer and back to X though.

One hack would have certainly been to automate that switching after X has started, but it turns out that this gray bar is actually a shadow of the text mode cursor… guess proper initialisation isn’t VIA’s strength or something?

So instead, I added the following line to my /etc/init.d/entrance script:

@@ -43,6 +43,7 @@ case "$1" in
                export PATH=`pam_getenv -l PATH`
        set -e
+       /usr/bin/setterm -cursor off>/dev/tty9
        echo "."

This turns off the text mode cursor. Seems to be working fine so far.

2007, July 22 (Sun)

Linux You don't exist, go away!

If you are trying to use SSH inside a debian-installer session, you might run into some problems...

  • With the installer from lenny, ssh will complain about a missing libz.so.1.

    I couldn't find this file anywhere on the media, it is missing.

    You need a libz.so.1 from somewhere, so copy it to a USB stick or something.

  • Using the installer from sid, tring to ssh anywhere might result in the message "You don't exist, go away!"

    If you get this message, make sure to install libnss. (I only had to do this using the newt "install", not with installgui.)

Linux debian-installer: loop-aes fails with "not supported by kernel"

When installing from something involving an ISO image, d-i will load the wrong loop module and later on setting up loop-aes will fail.

After generating enough randomness, you will receive the message "An error has occured while configuring encrypted volumes", and the syslog shows

partman-crypto: ioctl: LOOP_SET_STATUS: Invalid argument, requested cipher or key length (256 bits) not supported by kernel.

To fix this problem, first proceed to the partitioner and select encryption with loop-aes. That will make d-i unpack the necessary files to lib/modules/*/updates

Now switch to a console and modprobe -v -r loop (this is a rmmod replacement.)

You will probably need to umount the cd image first: umount /cdrom
(Now try again: modprobe -v -r loop)
Then cd to lib/modules/*/updates and insmod ./loop-aes.ko
(this will load the right loop module for use with loop-AES!)
You might want to remount your cdrom:
mount /hd-media/*.iso /cdrom -o loop
(Alternatively, you can Esc out a few times in d-i and select the autodetection from the main menu again.)

Now you should succeed in setting up loop-aes.

(This problem should be fixed in one of the next debian-installer versions.)

Linux crypto-root on loop-AES (partly) using debian-installer

First of all, crypto needs to be done using newt ("install", not installgui). This is a known limitation of debian-installer and documented somewhere on the d-i website.

Secondly, when installing from something involving an iso image, d-i will load the wrong loop module. If that is your case, please make sure to read loop-aes "not supported by kernel"?.

Unfortunately, the debian-installer doesn't want to let you encrypt your root with loop-aes even if you have an unencryped /boot

Once you have arrived at the partman-crypto screen and set up your crypto devices, the next thing you need to do is patch debian-installer to not bitch about having / on loop-aes.
This can be done by modifying a file in /lib/partman/check.d/ and removing the check (thanks to fjp@#debian-boot for the pointer.)

If, after generating enough randomness, d-i fails with "An error has occured while configuring encrypted volumes", check the article "loop-aes 'not supported by kernel'".

Otherwise, the install should now go through fine.

Finally you'll want to chroot into your new system, and come up with some loop-aes initramfs hooks so that your system will be bootable.

You can use those in the loop-aes-utils debian package source as a starting point:

apt-get source loop-aes-utils
tar xzvf *.tar.gz
cd util*
gunzip < ../*.diff.gz | patch -p1
grep -R debian initramfs

and execute the commented lines.

However, they are broken, so fix the bugs in these scripts!

You will also want to add a feature to these scripts so that it reads your key from a removable media.

Remember: the "key" in your encryption is your keyfile. The passphrase is just an additional blocker, but if your keyfile gets in the wrong hands, your security is more than halved!
This means that you absolutely don't want to keep the keyfile in the initrd (where it would be stored in plaintext).

Lastly you will probably want to regenerate your initrd so that the system becomes bootable:

mount proc proc -t proc
update-initramfs -k $(ls lib/modules) -u
umount proc

Confirm reboot in the debian-installer


Continue reading “crypto-root on loop-AES (partly) using debian-installer” »

2007, October 24 (Wed)

Linux, Programmierung thttpd and hgweb.cgi

hgweb.cgi, which is a Pythonscript to provide webaccess to a hg repository, does not work out of the box with thttpd.

The error is:

args = ('REQUEST_URI',)

The quick-and-dirty fix is kinda simple; write a small wrapper which sets REQUEST_URI and runs hgweb.cgi. The content of REQUEST_URI seems to do not matter at all.

export REQUEST_URI="/blafuck/"
exec ./hgweb.cgi

2009, January 16 (Fri)

Linux umtsmon dns

If you want to use umtsmon on openSUSE, it will fail to set the DNS entries. The reason is that with NETWORKMANAGER=yes in /etc/sysconfig/network/config, netconfig refuses to update the resolv.conf as it thinks only NetworkManager should do so.

You usually don't want to disable NetworkManager in sysconfig, as that would disable NetworkManager (so you can't configure WLAN/LAN).

So you will have to set up a custom NETCONFIG_DNS_POLICY in /etc/sysconfig/network/config to tell netconfig that you want both ppp and NetworkManager to control the DNS configuration:


Also see netconfig(8) for more information.

2009, January 21 (Wed)

Linux git ssh debugging

If you want to debug git-ssh-interaction, just use
GIT_TRACE=2 git whatever

2009, January 29 (Thu)

Linux SCIM Compose support in X11 Apps

The compose (Multi_key) support in SCIM for non-GTK applications depends on the input method "Other Languages/English/European languages" being selected.
Even if you do not use this input "method", it will still affect the compose functionality when the panel is disabled. You can notice this if compose does not work in XTerm and GNU Emacs complains about "<Multi_key> is undefined". Strangely, XEmacs works.

2009, February 15 (Sun)

Linux Xen Debian lenny upgrade

If you're just upgrading your Xen-domU to lenny and the new lenny-standard-kernel,
you might end up with a broken system, where ssh returns PTY allocation request failed on channel 0.

This is probably also true for other system, it seems that lenny mounts /dev/pts via
udev, while etch had some /etc/init.d/-fallback.

Try installing udev.

2009, February 23 (Mon)

Linux Bind generic application to specified IP address

I needed to force a generic server application to only bind to a specified IP address on my computer, so I got nusse to find me this code:


You can compile it with gcc -D_GNU_SOURCE -nostartfiles -fpic -shared bind.c -o bind.so -ldl

Then start the program like this:

BIND_ADDR="" LD_PRELOAD=bind.so java -Djava.net.preferIPv4Stack=true -jar db4oServer.jar 8875

A similar tool seems to exist in the linux-vserver suite called chbind

2009, February 25 (Wed)

Linux ejabberd http-bind/http-poll

If you want to enable http-bind or http-poll in ejabberd, e.g. to set up jwchat, don't forget to load the modules.

{mod_http_bind, []}

Otherwise jwchat will silently fail with "Service unavailable".

2009, February 27 (Fri)

Linux binary diff

If you want to diff binaries, try diff'ing the hexdumps of the two binaries.

hexdump binary_a >hexdump_a
hexdump binary_b >hexdump_b
diff -urN hexdump_a hexdump_b

Linux slice universal binaries

Slicing universal binaries (OS X) can be done with ditto.

To extract the Intel-part of a Universalbinary, do the following:
ditto --rsrc --arch i386 Universal_Binary Intel_Binary

(Just hinting search-engines as I could not get proper results.)

2009, May 14 (Thu)

Linux scrapi libtidy.so fail

If you want to use scrapi on AMD64 (or any any OS/Plattform than Windows, Linux/i386 or OSX) you'll run into some caveats:

Scraper::Reader::HTMLParseError: Scraper::Reader::HTMLParseError: Unable to load /var/lib/gems/1.8/gems/scrapi-1.2.0/lib/scraper/../tidy/libtidy.dylib

Scrapi comes with precompiled libtidy.so (i386) and libtidy.dll. Just replacing libtidy.so with the one from Debian/Lenny will lead to segfault.

/var/lib/gems/1.8/gems/tidy-1.1.2/lib/tidy/tidybuf.rb:39: [BUG] Segmentation fault
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]


A quick'n'dirty hack is to use the one from Etch. Just copy libtidy.so to /var/lib/gems/1.8/gems/scrapi-1.2.0/lib/tidy.

Now bug the developer why he has to include binary-crap.

2009, June 18 (Thu)

Linux block selecting in (u)rxvt

Press alt and start selecting with the mouse.

2009, July 10 (Fri)

Linux dynamic environment variable setup

Like having different working directories for different compilers. That means, it is necessary to set up some environment variables to have PATH, LDFLAGS, CPPFLAGS or PKG_CONFIG_PATH point to the wanted libraries and binaries.

Furthermore, I like to put some “packages” in its own prefix (which most people will disagree), like


So to keep this flexible, it would be nice to have it just include all directories that match. — Excluding the source ones, that is.

I wrote this down in some function, this might not be the best way to do it however ;-)

Continue reading “dynamic environment variable setup” »

2009, September 01 (Tue)

Linux Xrandr custom resolution

Some monitors claim to support less resolutions than they do, or sometimes your video card might be broken and incorrectly detect the monitor data. In such a situation, xrandr will not show an entry for the desired resolution and you have to add it yourself.

To do so, you first have to create a new “mode” using the xrandr --newmode function. To get the timings, you can use the gtf utility. Together, a command might look like this:

`gtf 1600 1200 60|grep Modeline|sed -e's|Modeline|xrandr --newmode|'`

Then you can assign this mode to your monitor, like this:

xrandr --addmode VGA '"1600x1200_60.00"'

Remember to put the double quotes, this is because gtf outputs the mode name in quotes. If you don’t like this, use a different way to parse the gtf output.

Linux openSUSE multiple parallel distribution-default kernels

I’d like to install multiple kernels, one of the recent development Linux 2.6.31 kernels that openSUSE makes available in the Kernel:HEAD project and the ones in the distribution update channel that contain mostly security fixes and are of version 2.6.27 for openSUSE 11.1.

Unfortunately, the GTK package manager offers no good way to install multiple versions of the same thing, so I wrote two scripts that will download and install the kernel using rpm and also delete the older kernels.

clean_kernels will use rpm -e to uninstall all kernels except the two most recent. Just run it as is

get_kernel will download and possibly install the latest kernel from Kernel:HEAD. You should make a symlink with ln -s get_kernel get_update_kernel which will then download and possibly install the latest kernel from the update repository.

Maybe there are better ways to do this, tell me if you know.

2009, September 02 (Wed)

Linux xterm startup extremely slow under certain locales (chinese zh_CN.UTF-8)

I noticed xterm/uxterm being extremly slow on startup and also on displaying the fonts menu when running under a zh_CN.UTF-8 locale. strace shows the culprit:

03.833720 writev(3, [{"1\1\4\0\1\0\7\0", 8}, {"*-GBK-0", 7}, {"\0", 1}], 3) = 16 <0.000032>
03.845074 writev(3, [{"1\1\5\0\1\0\t\0", 8}, {"*-*-GBK-0", 9}, {"\0\0\0", 3}], 3) = 20 <0.000044>
03.906162 writev(3, [{"1\1\5\0\1\0\v\0", 8}, {"*-*-*-GBK-0", 11}, {"\0", 1}], 3) = 20 <0.000046>
04.135018 writev(3, [{"1\1\6\0\1\0\r\0", 8}, {"*-*-*-*-GBK-0", 13}, {"\0\0\0", 3}], 3) = 24 <0.000040>
04.767843 writev(3, [{"1\1\6\0\1\0\17\0", 8}, {"*-*-*-*-*-GBK-0", 15}, {"\0", 1}], 3) = 24 <0.000031>
06.062369 writev(3, [{"1\1\7\0\1\0\21\0", 8}, {"*-*-*-*-*-*-GBK-0", 17}, {"\0\0\0", 3}], 3) = 28 <0.000032>
07.999531 writev(3, [{"1\1\7\0\1\0\23\0", 8}, {"*-*-*-*-*-*-*-GBK-0", 19}, {"\0", 1}], 3) = 28 <0.000032>
10.235677 writev(3, [{"1\1\10\0\1\0\25\0", 8}, {"*-*-*-*-*-*-*-*-GBK-0", 21}, {"\0\0\0", 3}], 3) = 32 <0.000032>

… and so on.

One possible workaround is to disable the GBK fontset in /usr/share/X11/locale/zh_CN.UTF-8/XLC_LOCALE. This file has an entry like the following:

#  fs3 class (Chinese Han Character GBK)
fs3    {
       charset {
               name    GBK-0:GLGR
       font    {
               primary GBK-0:GLGR
               substitute GB13000.1993-1:GLGR

If you remove it, xterm will be back to its blazing fast startup time.

Further readings:
Solaris Bugreport and fix in Solaris
Chinese blog post related to this problem on FreeBSD
Another blog post with the same solution as explained here
And a chinese forum thread about the issue

Proper fix welcome…

2009, October 10 (Sat)

Linux Disable ZeroCD on Huawei UMTS USB-sticks

The Huawei E1552 (and other) UMTS USB-stick provides a ZeroCD called flashdrive, which provides drivers and utilities. To disable it (and prevent it to be mounted all the time), you can use the following AT-command:


(Source: Huawei forums)

2009, October 30 (Fri)

Linux screencast with ffmpeg

ffmpeg can record the X server screen for you and store it directly for example in Flash Screen Video format. This is much more favourable than some other solutions in my opinion :-)

example: ffmpeg -f x11grab -s 1024x600 -r 120 -i :0.0 -vcodec flashsv /tmp/out.flv

1024x600 is the screen size and 120 the rate. Important is the .flv-extension for the suitable container format.

Linux Unihan-Wtpen SCIM chinese character handwriting recognition under Linux

Chinese character handwriting recognition under Linux using the Chrasis Input Pad for SCIM and the Unihan-Wtpen recognition engine by Wintone (Beijing).

Continue reading “Unihan-Wtpen SCIM chinese character handwriting recognition under Linux” »

Linux Linux中文手写输入法使用Chrasis的SCIM写字板和汉统/北京文通的辨识软件


Screenshot FLV

2009, December 02 (Wed)

Linux wine PPTVIEW (PowerPoint Viewer)

wine c:/Program\ Files/Microsoft\ Office/Office12/PPTVIEW.EXE
fixme:heap:HeapSetInformation 0x110000 1 (nil) 0

I’m not sure maybe it is something particular to my wine install, but the PowerPoint Viewer refuses to start. I finally found out that this is caused by the environment variable LANG being set to something other than en_US.UTF-8, so the fix…

LANG=en_US.UTF-8 wine c:/Program\ Files/Microsoft\ Office/Office12/PPTVIEW.EXE 

Unfortunately, even with the powerpoint viewer I haven’t been able to view this presentation, which made me try this approach at all. It crashes at roughly the same position that OpenOffice.org goes into 100% CPU during import, oh well…

Continue reading “wine PPTVIEW (PowerPoint Viewer)” »

2010, February 10 (Wed)

Linux Get back the Gnome logout keybinding

Since I upgraded Gnome from 2.24 to something more recent, what was then Ctrl+Alt+Del (or <Control><Alt>Delete speaking of gconf settings) didn’t show the logout dialog anymore, but rather the shutdown/reboot one! I like to be able to log out or switch user with a keyboard shortcut, however, there is no predefined action which would lead to that dialog anymore.

As a workaround, create the following entries in the gnome registry, for example using gconf-editor:
in /apps/metacity/global_keybindings/run_command_10, enter the keybinding (e.g. <Control><Alt>Delete)
in /apps/metacity/keybinding_commands/command_10, use the command gnome-session-save --logout-dialog --gui — this will do the magic trick of opening the log out dialog.

Disable the old binding to shutdown using gnome-keybinding-properties by clicking on the entry and hitting backspace, if desired.

2010, February 24 (Wed)

Linux xmessage utf-8

People are claiming that xmessage does not support unicode utf-8, or that you should switch to some gnome crap instead. Try specifying the resource *international: true and it will work as advertised. (You might still have to set up your fonts properly.)

By the way, a proper Gnome-alternative is Zenity.

2010, May 17 (Mon)

Linux ASRock X58 Extreme3

Installed an ASRock X58 Extreme3 motherboard, so far the following results:

Linux Kernel 2.6.34

  • basic function works out of the box (as expected!)
  • hibernate (suspend to disk) breaks
    • should work if you unload xhci_hcd (USB3)
  • suspend to ram (mem) suspends, but does not resume
    • caps lock & scroll lock LEDs flash on resume
    • diagnostic LED shows 24
    • pm_tests pass
    • pm_trace hash matches drivers/base/power/main.c:564
  • sensors shows some coretemp temperatures
    • W83677HG-I has no driver (would be needed to read fan speed, vcore, etc.)
  • couldn’t find any controllable fan (BIOS can control 2 pwm fans and 2 voltage fans, but only manually except CPU fan)
  • system clock is way too slow! It lags 10 minutes just after 2 hours of operating. hardware clock seems to be fine though(?)

maybe not related to the board

  • Sony photo camera is not recognized as mass storage unless rmmod -f usb_storage && modprobe usb-storage after connecting; somewhat annoying.

not used yet:

  • USB3
  • SATA3 (6Gb/s)

overclocking experiments

  • can easily adjust QPI / core speed in BIOS.

random thoughts

  • I feared most the northbridge cooler fan; but it is perfectly silent (to my ears).
  • ECC ram works as advertised
  • remember to turn on virtualization features and turbo boost stuff in BIOS (everyone would check that, I guess)
  • direct BIOS flash from USB is very convenient
  • use amidmi or amidedos to edit dmi data

2010, May 19 (Wed)

Linux rc.status on the left??


Useful if you have a huge resolution and having trouble making out which line the “failed” belongs to :-)

--- /etc/rc.status      2010-05-19 16:05:42.561038358 +0200
+++ /etc/rc.status      2010-05-19 10:09:18.287053928 +0200
@@ -70,14 +70,15 @@
         norm=`echo -en "${esc}[m\017"`
         stat=`echo -en "\015${esc}[${COLUMNS}C${esc}[10D"`
+        stat=`echo -en "\015${esc}[G${esc}[14@${esc}[10C...${esc}[11D"`
-     rc_done="${stat}${done}done${norm}"
+     rc_done="${stat}   ${done}done${norm}"
-   rc_failed="${stat}${warn}failed${norm}"
+   rc_failed="${stat} ${warn}failed${norm}"
-     rc_dead="${stat}${warn}dead${norm}"
-   rc_unused="${stat}${extd}unused${norm}"
+     rc_dead="${stat}   ${warn}dead${norm}"
+   rc_unused="${stat} ${extd}unused${norm}"

More refinement with xtty=$(stty -g); stty -echo; echo -en "\033[6n"; read -d R curpos; stty $xtty, then see if cursor is at beginning of line and go up one line.

2010, June 02 (Wed)

Linux SUN UNIX Keyboard & Linux Gnome

I shot a UNIX keyboard on ebay.


Of course, it “just works” when you plug it in. However, I want it to work properly, that is, the special keys on the left should show their labels when assigning them e.g. in gnome-keybinding-properties. To do that, it is apparently necessary to edit the xkb rules & xml files which are found in /usr/share/X11/xkb/rules on my distribution.

There is a “Sun Type 5/6” Layout available in gnome-keyboard-properties, but it mysteriously renders the BackSpace key unusuable — this might be a particular bug of my installation, any hints appreciated. (has apparently been fixed in this commit, which probably means fixed in xkeyboard-config 1.8)

Update; the old solution provided problematic (it has been hidden below.) Here is the new approach:

Fix the BackSpace key with this patch:

--- a/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-16 20:39:59.937546375 +0200
+++ b/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-15 00:56:22.547604150 +0200
@@ -62,6 +62,8 @@ xkb_symbols "sunbasic" {
     include "inet(evdev)"
     include "us(basic)"
+    // these keys are common to all layouts
+    key <BKSP> {	[ BackSpace	]	};
     include "pc(function)"
     include "pc(editing)"
     include "keypad(x11)"

Fix the “too old” AltGr mapping (XOrg changed it from Mode_switch to ISO_Level3_Shift, which is defined in the level3 symbols:)

--- a/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-16 20:39:59.937546375 +0200
+++ b/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-15 00:56:22.547604150 +0200
@@ -74,7 +76,8 @@ xkb_symbols "sunbasic" {
     key <LFSH> { [ Shift_L		]			};
     key <RTSH> { [ Shift_R		]			};
     key <LALT> { [ Alt_L		]			};
-    key <ALGR> { [ Mode_switch		]			};
+//  key <ALGR> { [ Mode_switch		]			};
+    include "level3(ralt_switch)"
     key <LMTA> { [ Meta_L		]			};
     key <RMTA> { [ Meta_R		]			};
     key <LCTL> { [ Control_L		]			};

Shuffle the modifier maps:

--- a/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-16 20:39:59.937546375 +0200
+++ b/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-15 00:56:22.547604150 +0200
@@ -116,9 +119,9 @@ xkb_symbols "sunbasic" {
     modifier_map Control { Control_L, Control_R };
     modifier_map Shift   { Shift_R, Shift_L };
     modifier_map Mod1    { Meta_L, Meta_R };
-    modifier_map Mod2    { Mode_switch };
-    modifier_map Mod3    { Num_Lock };
-    modifier_map Mod4    { Alt_L };
+//  modifier_map Mod2    { Mode_switch };
+    modifier_map Mod2    { Num_Lock };
+    modifier_map Mod3    { Alt_L };

Gnome wants its so-called “<Alt>”-binding on Mod1. I put the ♦Meta-keys there, because they’re in the right place. It further requires Mod2 to be Num_Lock, otherwise it is not happy and a lot of modifier keys stop working when Num_Lock is enabled. (Only the Mod2 is ignored when calculating the overlaps.) The former Mode_switch is mapped to Mod5 by the include above.

With this configuration, the following is now an useful addition to your .Xresources:

xterm*metaSendsEscape: true
xterm*altIsNotMeta: true
xterm*altSendsEscape: false

That way, Alt can be used to generate “Alternate keys” and ♦Meta works for key movement.

(X)Emacs on the other hand wants all kinds of “Meta” to be on one modifier, and (optionally) all kinds of “Alt” on the same, or another. My previous setup was causing one Meta key and the Alt key mapped to Mod1, and another one to Mod4. With the modifier mappings above, Meta correctly generates M- and Alt — generates A- (Super, aka Win-key, would get interpreted as S- in XEmacs.)

I suspect since I have not bound any <Super> keys, Gnome-Do is now confused and launches on a simple press of the Space-bar! Makes you unable to types spaces. I don’t know how to fix this. Trying to assign Alt+space as the Summon Key fails — it only displays “space”… since I don’t use Gnome-Do anyway, I removed it for now using gnome-session-properties.

I wanted to add the UNIX layout to the keyboard image display in the Gnome keyboard properties, so I made a new layout in the rules directory:

1. Added a new model to base.xml:

        <description>Sun Type USB UNIX Layout</description>
        <vendor>Sun Microsystems</vendor>

2. Do the same for base.lst

! model
  sun_unix        Sun Type USB UNIX Layout

3. Add rules to base that set the desired options, on the way also fixing the missing geometry for the type6 and euro keyboard:

! model		=	keycodes
  sun_unix 	=	sun(type6_usb)

! model		=	geometry
  sun6	 	=	sun(type6)
  sun_unix 	=	sun(type6unix)
  sun6euro 	=	sun(type6tuv)

! model		layout			=	symbols
  sun_unix	us			=	sun_vndr/us(type6)
  sun_unix	*			=	sun_vndr/us(type6)+%l%(v)

Fix a bug in the rules that manifests when you use more than keyboard layout — because of the missing rules, the “pc” symbols are added, causing havok in the modifier mappings

! model		layout[1]		=	symbols
  sun6		*			=	sun_vndr/us(type6)+%l[1]%(v[1])
  sun_unix	*			=	sun_vndr/us(type6)+%l[1]%(v[1])
  sun6euro	*			=	sun_vndr/us(type6)+%l[1]%(v[1])

Modify the ctrl:nocaps rule to make CapsLock an additional right Control (the default key for example in VirtualBox) with this patch: (optional)

--- a/usr/share/X11/xkb/symbols/ctrl	2010-06-16 20:39:59.922548680 +0200
+++ b/usr/share/X11/xkb/symbols/ctrl	2010-06-14 22:21:41.482666941 +0200
@@ -5,7 +5,8 @@
 // eliminate the caps lock key completely (replace with control)
 partial modifier_keys 
 xkb_symbols "nocaps" {
-    replace key <CAPS>	{  [ Control_L, Control_L ] };
+//  replace key <CAPS>	{  [ Control_L, Control_L ] };
+    replace key <CAPS>	{  [ Control_R ] };
     modifier_map  Control { <CAPS>, <LCTL> };

Fix the geometry (caps and control are swapped):

--- a/usr/share/X11/xkb/geometry/sun	2010-06-16 20:39:59.910515296 +0200
+++ b/usr/share/X11/xkb/geometry/sun	2010-06-14 22:29:08.208691859 +0200
@@ -2885,7 +2885,7 @@ xkb_geometry "t6unix" {
 	row {
 	    top= 39;
-	    keys { <FRNT>, <COPY>, { <CAPS>, 9, shape="CAPS" },
+	    keys { <FRNT>, <COPY>, { <LCTL>, 9, shape="LCTL" },
 		   <AC01>, <AC02>, <AC03>, <AC04>, <AC05>, 
 		   <AC06>, <AC07>, <AC08>, <AC09>, <AC10>, 
@@ -2902,7 +2902,7 @@ xkb_geometry "t6unix" {
 	row {
 	    top= 77;
-	    keys { <FIND>, <CUT>, { <LCTL>, 9, shape="LCTL" },
+	    keys { <FIND>, <CUT>, { <CAPS>, 9, shape="CAPS" },
 		   <LALT>, {<LMTA>, "LMTA"},
 		 { <SPCE>, "SPCE" },
 		   {<RMTA>, "RMTA"}, <COMP>, <ALGR>

Other problems

Unfortunately, I cannot get the Compose LED to light up.

Gnome doesn’t accept the SunFront keybinding to bring windows to the front — what’s up with that?? It works when I just assign it, but stops working on next login. As a workaround, I could get it to work by setting /apps/metacity/window_keybindings/raise_or_lower to the magical value 0x8c in gconf-editor

It is not neccessary to choose any options in the gnome-keyboard-properties.

Continue reading “SUN UNIX Keyboard & Linux Gnome” »

2010, July 08 (Thu)

Linux Multiseat hacks (gnome gdm)

I have two screens connected to a powerful box. Mostly, I’m using these for coding and it’s running Xinerama with radeon (sssh don’t say anything).

Only sometimes however, I would like to share the machine with a second user.

There are several recommended ways for multiseat setup:

  • Configure the Xserver with seperate screens (not Xinerama). Start Xephyr/Xnest on each screen
  • Start two seperate Xserver (this requires seperate graphic cards or maybe this patch which I couldn’t get to work)

Furthermore, you need to fiddle with the login manager to do everything “right”.

As my setup is more temporary, I opted for a middle way. It remains not without rough edged though… The main login remains running on two screens, and in the case of wanting to share, I will set up a Xephyr instance on one monitor.

Because of Xinerama, Xephyr doesn’t work out of the box like that. So I chose a small hack: I open an empty xterm (which has the netwm ability to go to fullscreen) and embed the Xephyr in it:

uxterm -title Xephyr +sb -hold -e ''

move the xterm window to the second monitor and switch it to fullscreen… I am using Gnome and have assigned a keybinding for that. That way, Xephyr will be running “full screen” on just one monitor, something that it isn’t able to do on its own (Xephyrs fullscreen would expand over both monitors due to Xinerama)

Now we need to start the Xephyr and allow the login for the other account. Again, we have two possibilities. One is to use the xdmcp mode of gdm, and another to use gdmflexiserver — the Gnome user switcher.

Update: I can’t get the SCIM input method editor to work with xdmcp… anyone knows why? So I’ve resorted to the gdmflexiserver one for now.

For the xdmcp, we need to enable it. For example, in SuSE, set DISPLAYMANAGER_REMOTE_ACCESS="yes" in /etc/sysconfig/displaymanager. Then it is enough to use a wrapper script. For access to the input devices, root permission is required though.

For the gdmflexiserver approach on the other hand, it is necessary to replace /usr/bin/Xorg — since gdmflexiserver --xnest is “not implemented”…

The wrapper script or Xorg replacement thus works like this:

First, we define the devices which we want to give the Xephyr use:


These are examples from my box, the Razer is a mouse and the strange keyboard is a cheap Cherry one — who knows why they can’t afford to brand its ID. Look in /dev/input/by-id after connecting your devices to find out their IDs. This approach is more flexible than using the “event#” devices, whose numbering might change if connected differently.

Now construct the real paths and add some checks to see if the devices are connected:

if [[ -h $keybd && -h $mouse ]] {

only in the Xorg case, we now loop over all available displays and find the first one which has a empty xterm window created as outlined above, to plant the Xephyr into:

	for ((disp=0;disp<$((${DISPLAY#*:}+0));++disp)) {

in the wrapper case, we set the dummy disp variable instead


finally, we locate the empty window using xwininfo and the -title as specified on top:

	OIFS=$IFS; IFS=$'\n'
	winin=($(DISPLAY=:$disp xwininfo -name Xephyr -children)); IFS=$OIFS
	if [[ $winin[1] == 'xwininfo: Window id: '*' "Xephyr"' && \
		$winin[4] == '     1 child:' && \
		$winin[5] == *' (has no name): ()'* ]] {
		if [[ $winid[4] == 0x* ]] {

Xephyr doesn’t seem to know about the default fonts, so we construct a fontsdir here, might need to adjust this to your local site font dirs. Now for the start command. In case of the Xorg replacement for use with gdmflexiserver, it is important to get rid of the -verbose flag which Xephyr does not understand. The -parent switch designs Xephyr to embed itself into another window:

exec env DISPLAY=:$disp Xephyr -zap -retro \
	-mouse evdev,,,device=$mouse \
	-keybd evdev,,device=$keybd,xkbmodel=evdev \
	-fp ${(j:,:)fontsdir} -parent $winid[4] \

for the wrapper script, we use the -query parameter for xdmcp query:

exec gnomesu -- Xephyr -zap -retro \
	-mouse evdev,,,device=$mouse \
	-keybd evdev,,device=$keybd,xkbmodel=evdev \
	-fp ${(j:,:)fontsdir} -parent $winid[4] \
	-once -query $@

just finish all the open blocks now…


however, in the Xorg replacement script, we will want to fall back to the real Xorg when we haven’t prepared any special window for Xephyr:

exec Xorg.old $@

As you can see, we moved /usr/bin/Xorg to /usr/bin/Xorg.old and put the replacement script up as /usr/bin/Xorg instead. That way, you can now prepare an xterm window as per above and execute gdmflexiserver without need for root.

With the wrapper script, just save it somewhere. You can then call it like this:

./xephyr-xdmcp :3

Where means your local host which you are going to query using xdmcp and :3 is a free display number for Xephyr to listen on.

An outstanding trouble I’m having in both cases is with the Gnome keyboard-properties tool which will set the keyboard layout upon login. Since it needs a different layout — evdev layout in the case of Xephyr, and local connected keyboard layout in the case of plain X, it will break the keyboard layout directly after login.

So far the only workaround is to rightclick on the desktop, “Open Terminal” and type in the command

setxkbmap -model evdev

before you can start working proper in the Xephyr instance. Maybe someone can come up with a better fix?

Continue reading “Multiseat hacks (gnome gdm)” »

2010, August 11 (Wed)

Linux consolekit & sound card control

to move control over sound card in case you have applied some dirty hacks you have to refer to root powers.

First, remove all access to the sound card from current user (user1):

setfacl -x u:user1     /dev/*dsp /dev/audio /dev/mixer* /dev/snd/*(^/)

Then add it back to for another user (user2):

setfacl -m u:user2:rw- /dev/*dsp /dev/audio /dev/mixer* /dev/snd/*(^/)

pulseaudio -k will reload the resp. pulseaudio and will not find any card for user1, but find the cards for user2. I only did this with no client connected, maybe needs more investigation.

2010, August 13 (Fri)

Linux Direct Rendering 32bit vs. 64bit

Problem: You believe you have your Linux set up correctly, graphics driver is a good one, direct rendering works as is confirmed by glxgears (64bit) works fine, and glxinfo says direct rendering: Yes

However, some 32bit software (e.g. wine) causes errors. WINEDEBUG=+wgl will reveal:

 Direct rendering enabled: False

although driver etc. are recognized properly. Further debugging of the problem can be done with LIBGL_DEBUG=verbose. The 32bit app will say

libGL: OpenDriver: trying /usr/lib/dri/r600_dri.so
libGL error: failed to create dri screen

This shows two things:

1. the driver is the correct one (note lib = 32bit vs. lib64 = 64bit as would be the output given by glxgears). If the driver were wrong, there would be an elf class error (you can set the driver path explicitly with LIBGL_DRIVERS_PATH)
2. cannot create dri screen :/

The 64bit one will have OpenDriver: trying /usr/lib64/dri/r600_dri.so (for example) and no error.

This instance of the problem was caused by the following: the 32bit and 64bit versions of libdrm and/or Mesa were different _. This happened due to an X.org upgrade which upgraded the 64bit parts, but the 32bit stuff installed in parallel with an older version (can I blame the package manager for not marking this as a conflict?)

Making sure the various package.x86_64 and package-32bit versions were exactly the same, this problem resolved.

Linux Xephyr fixed font not found

The input method doesn’t work inside Xephyr? Sometime you find out that .xsession-errors says

 Preparation of font set "fixed" for XIM failed.

The font path could be wrong. Make sure that the path to misc is the first one in row.

 xset +fp /usr/share/fonts/misc

would fix it for the moment (path might vary).

Compiling Xephyr I missed the following switches:

./configure --enable-xephyr --enable-kdrive-evdev --enable-kdrive-mouse --enable-kdrive-kbd --enable-kdrive --prefix=/usr --with-fontrootdir=/usr/share/fonts --libdir=/usr/lib64

Thanks for paying attention!

2010, August 25 (Wed)

Linux nvidia sucks

Unfortunately the open-source nouveau driver is not there yet, and their proprietary shit doesn't even do RandR 1.2, which means no sane way for multiple-display setup with single-display fullscreen gaming, or rotation if you need that.

Thanks for listening.

On openSUSE at least, you can use the proprietary driver after installation by adding nouveau.modeset=1 to the kernel command line (no other hackery was necessary for me). Unfortunately, the installation breaks the OpenGL driver of nouveau.

2011, March 29 (Tue)

Linux Evolution forbids Online if NetworkManager is not online

#evolution @ irc.gimp.org
Neihi, is there any way to force evolution online?
NeiI’m not connected through network manager but I need to check my mail now… before updating gnome I could just click on online and it would work but now this seems to be forbidden
@mcrha|afkhi Nei, depends on your version, check evolution --help. Otherwise move away /usr/lib(64)/evolution/<version>/modules/libevolution-module-networkmanager.* or some such file while evo is offline
@mcrha|afk*while evo is shutdown
Neimcrha|afk: there is a --online switch in --help, but it doesnt work :P deleting the network manager module works however, thanks…
@mcrhaNei, yup, newer version of evo has --force-online
Neimcrha: nice, from what version?
@mcrhaNei, I’m not sure, 3.0 for sure
Neioh, … I guess I will still have to wait a while for that :P
@mcrhaand what is your new version?
Neiis it that the nm feature was added that breaks this? I believe my old evo 2.28 also detected network manager but still allowed me to use the online button?
@mcrhabut yes, the new network manager module “broke” this. It’s not broken because you seem not to have configured your network interface through network manager, because if you would, then this might work (network manager would report to evolution that you are actually online). There is some checkbox in the network interface to be managed by network manager, if I recall correctly

Thanks mcrha!

2011, May 23 (Mon)

Linux wlan speed up rt2860 vs rt2x00

some users might have a RaLink RT2860 network device, such as some EeePC

my distribution kernel by default enabled the rt2860sta driver which is from the vendor.

however, there is a better choice: recent kernel come with the rt2×00 driver. Here is how you can switch (on openSUSE)

it connects to the network much faster after using the other driver and it doesn’t put so many error messages in the syslog.

cd /lib/modules/`uname -r`/build
make menuconfig

go to

-> Device Drivers
  -> Staging drivers
    -> Exclude Staging drivers from being built

and deselect Ralink 2860/3090 wireless support

then go to

-> Device Drivers
  -> Network device support
    -> Wireless LAN
      -> Ralink driver support

and enable (module) Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support

now Exit & save the config. You can save some compile time just compiling the subdirectory like such:

make SUBDIRS=drivers/net/wireless/rt2x00
make SUBDIRS=drivers/net/wireless/rt2x00 modules_install

remove the old driver

find /lib/modules/`uname -r` -name rt2860\*.ko -exec rm {} +

reboot or

ifconfig wlan0 down
modprobe -rv rt2860sta
modprobe -v rt2800pci


if the modinfo for the module is missing (error on insmod), make sure to extract the vmlinux image:

cd /lib/modules/`uname -r`/build
zcat /boot/vmlinux-`uname -r`.gz >vmlinux

2011, October 22 (Sat)

Linux Gnome 3 & XTerm

My company upgraded their Ubuntu to 11.10 so I was faced with the choice between UNITY or Gnome 3. As I was using Gnome 2 before (and still will be for a while at home), I thought to try the gnome-shell.

The biggest change is away from the Task bar to the Exposé-like overview of all windows, combined with a per-application chooser on the left (called “dash” in Gnome new-speak). The Alt+Tab window switcher got Application centric too. The application-behaviour means: switch between windows of the same application with Alt+(key over tab). After getting used to it, it’s not that bad, even faster for some tasks.

However, there was one big problem. I’m still using the XTerm and just can’t leave it for something like gnome-terminal. I usually open a lot of xterms on my desktop. I have them display something sensible in their title bar. Now with Gnome 3, every XTerm is recognized as its own little application, that means I have to switch between XTerm-windows using Alt+Tab.

While this itself maybe wouldn’t be that big a deal, it also results in all the XTerm-windows only showing their class in both the Alt+Tab switcher and the dash (remember, the switcher and the dash are supposed to show the Application, not the apps window title). That means it gets really really difficult to find an XTerm window, as the title bar content is no longer visible anywhere.

So I had to resort to patching the gnome-shell to treat all the windows with a class of UXterm as one single application. Now I can switch to an xterm using Alt+Tab, and between xterms with Alt+(key over tab). A first step of making Gnome 3 usable to me!


Download extension. it cannot be accepted on the official extensions website because it works for local apps with the correct desktop files, but still useful for remote apps grouping and if you don’t want to bother about desktop files. you can install the extension with gnome-tweak-tool

2011, October 25 (Tue)

Linux Gnome 3 Authentication required

More fun with my company switching to the new Ubuntu 11.10…

With Gnome 3, new authorization dialogs have been introduced to interface with PolicyKit (I love all those KITs by the way…), you can see them at this gnome live page. The company policy is to set up Ubuntu in the same way for everyone, and all the machines have several users that are allowed to install software. They are in one group — Ubuntu policy is to not use the root user.

As a developer, I am allowed to install software through the Ubuntu software center, or should be, anyways. With the Gnome 3 PolicyKit authorization dialog, choice between several possible users has been simplified, i.e. removed! So I get asked to enter the password for the “IT Administrator” account, which I obviously don’t know. Effectively resulting in me not being able to install any software.

I had to patch the gnome-shell (again) to restore at least basic usability. It asks for the current user password, when this user is permitted to perform that function (instead of the “first” one, whichever that might be.)

get the Gnome 3 PolicyKit fix here

Yes, there are bug reports for this

Continue reading “Gnome 3 Authentication required” »

2011, November 12 (Sat)

Linux openSUSE 11.2 to 11.4 upgrade rollup

here’s my personal summary

  • upgrade went very well. although not supported, a simple dist-upgrade worked like a charm

the only shock was after the first reboot. GRUB was broken. I didn’t even see the GRUB screen. The machine would be stuck in an endless reboot loop. BIOS screen → reboot → BIOS screen → reboot … Very puzzling issue that I haven’t been able to fix. I reinstalled the GRUB from Linux, and also from the grub prompt using (setup), to no avail.

In the end, I had to revert to my 11.2 GRUB version (funnily enough both are 0.97). I probably won’t have the energy to research this further.

What of course stopped working was my dirty multiseat hack. Instead of looping over the displays, I chose to loop over gnome sessions, because the new X is more securely set up so we need to steal the auth cookie to do what we want. setxkbmap also stopped accepting the “evdev” model, so I had to fix this by using -keycodes evdev -model pc104

As a bonus, I now know how to connect keyboards with different locales: use setxkbmap -device [`xinput list` ID here] -layout de (or -layout us)

Also, I opted to patch /usr/share/X11/xkb/symbols/sun_vndr/us again. Favorably, the BackSpace and AltGr key-bindings have been fixed, but the Alt and Meta keys have been broken.

Alt key got assigned Mod1 now, with Meta getting Mod4. No thanks, I don’t want to switch windows with Alt+Tab when my keyboard has Meta-keys in that place. So I had to switch the assignments for Mod1 and Mod4.

2011, November 27 (Sun)

Linux Skype microphone not working on 64-bit

If the mic doesn’t work in Skype, and your system does use PulseAudio (as most do these days) you might be missing alsa-plugins-pulse-32bit package on openSUSE / RPM or the lib32asound2-plugins on Debians

2011, November 29 (Tue)

Linux BadWindow crashes due to Ubuntu's gtk-vector-screenshot

if you are experiencing mysterious crashes of various Gtk3 applications, giving BadWindow Error messages, often when using completion popups or dialogs, it might be because the Ubuntu version of gtk-vector-screenshot has unfixed bugs compared to the Debian one

2011, December 08 (Thu)

Linux ASRock X58 Extreme3 in 2011

a little follow-up to this post from 2010

with linux 3.2-rc4

  • pm-hibernate works
  • pm-suspend works
  • W83677HG-I sensors driver has been written by Guenter Roeck
  • I bought a newer sony camera

2012, February 11 (Sat)

Linux Xephyr deadlock / freeze

Xephyr suddenly freezes on you, after some random amount of 10 minutes? You might be victim of Nvidia binary crap hijacking your libGL, replacing it with a dubious one. Make sure there is no nividia in the output of ldd =Xephyr and check the ls -l /usr/lib*/libGL.so* output. The rouge nvidia library was named libGL.so.290.10 on my system

2012, June 12 (Tue)

Linux plugwork in textmode

I want to show how certain tasks can be automated easily step by step using just a few tools. Today’s example will be about web automation. Perl will be used, but any other language would do.

To get things done, the important part is to choose the right ready-made components. For Perl, these can be found on the CPAN. When looking for modules, one has to be aware that there is both good and crap modules out there. Check the reverse dependencies, recent releases and maybe the ratings. A quick check on the search engine might also tell if the module is proven tech.

For web automation, the module needed is WWW::Mechanize. Often it will already be packaged by your distribution so on Debians, install libwww-mechanize-perl and on openSUSE get the perl-WWW-Mechanize package.

More to learn for SuSE users: For acquiring SuSE packages, the web interface on opensuse.org will find packages in the build service and provide one click install. Pro-tip for text mode: If you install the osc package, finding Perl packages gets yet easier: The command osc se 'perl(WWW::Mechanize)' will find the package containing this Perl module.

The work can begin. First you should know which site to automate. Often, it requires filling out of forms. Then, open the site in your web browser and open a terminal. WWW::Mechanize comes with a little tool to help us get started. Just type mech-dump http://yourwebsite to get a list of the form fields:

GET http://www.google.de/search [f]
  ie=ISO-8859-1                  (hidden readonly)
  hl=de                          (hidden readonly)
  source=hp                      (hidden readonly)
  q=                             (text)
  btnG=Google-Suche              (submit)
  btnI=Auf gut Glück!            (submit)
  gbv=1                          (hidden readonly)

there we have a possible form to fill out and can also peek at the hidden values. Nothing that the “View Source” button cannot do, but more convenient.

By the way, if you are seeing garbled output for national characters and are using UTF-8 in your terminal, then you need to fiddle with the Perl Unicode settings. This can be done by calling PERL_UNICODE=S mech-dump http://www.google.de instead. S will turn on Unicode on standard input and output, latter being your terminal. See man perlrun for more details.
For an amazing write-up about the state of Unicode and its caveats, see this post by Tom Christiansen. You will need to install the Symbola font to see this camel:

Continue reading “plugwork in textmode” »

2012, June 14 (Thu)

Linux shell-work in plug-mode

Welcome to the second edition of automation and having fun in text-mode only. We will build a small monitoring system and integrate it with a shell script. Because POSIX sh is boring and the script doesn’t need to work on any limited platform, we will use Z shell

So, the first line of the script is:


next, we call the program whose output should be monitored. The idea is that we want to get informed whenever there is a change in the output. Of course, you can fill in whatever criterion suits your needs here. The output is then stored to a temporary file:

perl googl.pl > googl-result.$$

the resulting output is compared to the output from last time the program was run, and if there is a change, notification should happen. the cmp program is used to check if two files are equal. additionally, we figure notification should only get sent when there actually is an output. a copy of the message should be logged to the terminal. so, the following code is crafted

if { ! cmp -s googl.output googl-result.$$ } {
	if [[ -s googl-result.$$ ]] {
		cat googl-result.$$
		perl send-notification.pl "$(<googl-result.$$)"

note that so far this is a place-holder, nothing has been thought up as how to deliver the notification. That’s the next topic

to finish off the script, we should store the newly recorded output as last output. Then, we wait a while before restarting the script for the next iteration

mv googl-result.$$ googl.output
sleep 60
exec $0

(first part: plugwork in textmode)

Continue reading “shell-work in plug-mode” »

2012, October 01 (Mon)

Linux Nvidia binary driver and nouveau switching

Nvidia binary driver for Linux has the annoying habit of overwriting OpenGL libraries. However, the nvidia-versions are incompatible with the open source ones.

Unfortunately while the nouveau driver is ok for most things, occasionally I run into applications where there are rendering errors, for example in dolphin. So the proprietary driver has to be used.

However since the installation is not possible in parallel by default, a simple reboot is not enough. To solve this problem, we devise a script that gets run at boot and moves the proper libraries into place or out of it.

2013, October 30 (Wed)

Linux, Programmierung, Web Dump Network Scanner Server, headless

Usage scenario:

Your small group has a scanner in walking distance, and wants to use it for simple scanning.

  • It is not worth it to connect the scanner to the user’s computer,

  • and also not worth it to be running back and forth between scanner and computer to check the scanning progress (as is suggested by saned).

  • Mixed local/network scanning on the machine is not required (as suggested in scanbd.)

  • The scanner is connected to a machine without display but with audio hardware. In our case it is an old broken Thinkpad.

  • Maybe the scanner is a cheap crappy scanner without automatic document feeding etc.

This script will poll the buttons, scan according to two pre-sets (you could make the scripts more complex if desired) and publish the result on a Windows share.

Communication with the user is done through speech synthesis software.

End user experience:

  • The Windows share is added once through “Connect Network Drive” in Windows or as a smb:// Bookmark in Nautilus, possibly by a local “Computer Expert”

  • User has something to scan, takes the papers to the room with the scanner. He puts each sheet on the scanner and pushes Button 1. When the scan is finished, he does the same with the next sheet and so on. At the end, the user pushes Button 4 to signal he is done scanning.

  • User goes back to his computer, copies the finished PDF file out of the network share. If necessary, he launches Adobe or another software to fix up any rough edges in the scan.

  • User could also print this document to some printer in yet another room, after reviewing that everything is in order.

Script to do it:

You can grab your copy here: scanbtn.tar. Detailed information is inside the README file therein. Enjoy!

2015, March 04 (Wed)

Linux Toshiba Z30 evdev notes

The Toshiba Z30 is a very nice laptop and works out of the box with Linux. Two things can be fixed however:

  • enabling the mouse wheel emulation for the pointing stick
  • making the touchpad enable/disable hotkey (Fn+F9) work

they require patches to the evdev driver due to Bug#11227 and #39174 which are unlikely to get fixed for X11. The code-remap patch is provided by Gianni Ceccarelli. The patch for mouse wheel emulation can be downloaded from this page.

Here are the relevant config file snippets:


Section "InputClass"
	Identifier      "2 button stick Wheel Emulation"
	MatchProduct    "DualPoint Stick"
        MatchIsPointer  "on"
        Driver  "evdev"
        Option  "Emulate3Buttons" "on"
        Option  "EmulateWheel"  "on"
	Option  "EmulateWheelButton"    "2"
	Option	"XAxisMapping"		"6 7"
	Option	"YAxisMapping"		"4 5"


Section "InputClass"
	Identifier      "Toshiba input device buttom remap"
	MatchProduct    "Toshiba input device"
        MatchIsKeyboard "on"
        Driver  "evdev"
	Option  "event_key_remap" "418=156 419=157 530=199"

This will remap the zoom-buttons to Launch1 and Launch2 as I couldn’t find any zoom buttons implemented in X11.

2015, June 09 (Tue)

Linux, Web Dump Firmware updates for Z30 from Linux

BIOS update

  • Download bios .exe from Toshiba (US site), it includes ISO
    (EU updates are only for Windows ☹ )
  • Extract iso image from .exe
  • Run isohybrid image.iso
  • cp image.iso /dev/usbstickhere
  • reboot
  • set bios to CSM boot
  • F12 for boot menu → USB stick
  • cross fingers…
  • set bios back to UEFI boot

SSD firmware update

  • Download Samsung firmware update tool
  • Download SSD firmware package from Toshiba
  • extract *.enc firmware files from the self-extracting archive
  • run ./magician -d 0 -F -p /path/to/firm

Required folder structure for /path/to/firm:


Linux, Web Dump Keyboard Light on Z30

By default in GNOME, you cannot toggle the keyboard light. For GNOME, there is no solution to use the key binding (XF86KbdLightOnOff) as intended, because gnome-settings-daemon reserves the key at a level that does not allow any further capturing. Other DMs may not suffice from this “feature”.

What you can do is, to put the function on another keyboard shortcut (ex. Winkey+Z) and have it execute this script

That will toggle through the three keyboard states (automatic, on, off). You can put it on suid-root so that you can change the file in the /sys interface.

Update you can also use acpid and this config file:


(thanks to nulli)