Powered by
Movable Type 3.38 mod_perl/2

 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

WORDCHARS=${WORDCHARS//[&=\/;\!#%\{]}

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

Enjoy.

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

BitchX:

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

SILC:

/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 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:

/usr/local/bin/uname

#!/bin/sh
/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

http://kb.mozillazine.org/Network.prefetch-next:

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.

gajim-remote-remote:

#!/bin/sh
# USAGE: gajim-remote-remote <display> <gajim-remote parameters>
DISPLAY=$1
shift
gajimopts=$*
eval $(DISPLAY=$DISPLAY dbus-launch --autolaunch=$(cat /var/lib/dbus/machine-id))
export DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID DBUS_SESSION_BUS_WINDOWID
shift
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))
export DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID DBUS_SESSION_BUS_WINDOWID


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:

libecal1.2-dev
libecal1.2-6
evolution-dev
evolution-data-server-dev
libedata-book1.2-dev
libedataserver1.2-dev
libdb3-dev
libcurl3
libcurl3-dev

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:
.sync4j/evolution/<server>/spds/syncml/config.txt
.sync4j/evolution/<server>/spds/sources/addressbook/config.txt
.sync4j/evolution/<server>/spds/sources/calendar/config.txt
.sync4j/evolution/<server>/spds/sources/memo/config.txt
.sync4j/evolution/<server>/spds/sources/todo/config.txt

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:

~/.gnomerc

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:

^Z
fg; beep


2007, June 21 (Thu)

Linux ssh client keep-alive

man 5 ssh_config


TCPKeepAlive
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`
        fi
        set -e
+       /usr/bin/setterm -cursor off>/dev/tty9
        $DAEMON
         fi
        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

Enjoy

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:

KeyError: 'REQUEST_URI'
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.

#!/bin/sh
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:

NETCONFIG_DNS_POLICY="STATIC_FALLBACK ppp* NetworkManager"

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:

http://www.ryde.net/code/bind.c.txt

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="127.0.0.2" 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.


{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]

Aborted

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

package1/lib
package1/bin
package1/include

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:


at^u2diag=0

(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写字板和汉统/北京文通的辨识软件

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

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??

Result:

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 @@
         attn="${esc}[1;33m"
         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_running="${stat}${done}running${norm}"
-   rc_failed="${stat}${warn}failed${norm}"
+   rc_failed="${stat} ${warn}failed${norm}"
    rc_missed="${stat}${warn}missing${norm}"
   rc_skipped="${stat}${attn}skipped${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}"
   rc_unknown="${stat}${attn}unknown${norm}"
   rc_done_up="${esc}[1A${rc_done}"
 rc_failed_up="${esc}[1A${rc_failed}"

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.

sun_unix_keyb.jpg

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 };
 };
 
 hidden

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:

    <model>
      <configItem>
        <name>sun_unix</name>
        <description>Sun Type USB UNIX Layout</description>
        <vendor>Sun Microsystems</vendor>
      </configItem>
    </model>

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>, 
 		   <AC11>,
@@ -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:

#!/bin/zsh
mouse=Razer_Razer_1600dpi_3_button_optical_mouse
keybd=046a_0011

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:

mouse=/dev/input/by-id/usb-${mouse}-event-mouse
keybd=/dev/input/by-id/usb-${keybd}-event-kbd
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

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

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): ()'* ]] {
		winid=($=winin[1])
		if [[ $winid[4]  0x* ]] {
			fontsdir=(/usr/share/fonts/*(/))

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 -retro \
	-mouse evdev,,,device=$mouse \
	-keybd evdev,,device=$keybd,xkbmodel=evdev \
	-fp ${(j:,:)fontsdir} -parent $winid[4] \
	${@:#-verbose}

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

exec gnomesu -- Xephyr -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 127.0.0.1 :3

Where 127.0.0.1 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?