Archive for the ‘work’ Category

Nifty dnsmasq Trick: Reverse Lookup using a specific Server

Tuesday, June 22nd, 2010

With dnsmasq, it’s easy to look up a whole domain using a special dns server. The option is

   --server=/foo.corp/10.11.12.13

This will look up everything “*.foo.corp” using nameserver 10.11.12.13. So far, so good. But today I also needed the reverse lookup for a specific IP adress zone to be done via a specific nameserver. Reading the manpage, I found no option for that, but then I remembered stuff that I had learnt in a distant past: that reverse lookups are actually a name lookup of the in-addr.arpa zone, with the “reversed” IP address. So I tried

  --server=/10.in-addr.arpa/10.11.12.13

and that one works fine, looking up everything 10.x.x.x using 10.11.12.13.

And it still was much easier than using ugly bind. That’s why I prefer dnsmasq in daily use over bind, dhcpd and all the other crap. It just works ;)

Rebuilding a single kernel module

Wednesday, April 28th, 2010

Due to Bug 596844, I had to rebuild the i915 module with a patch. I have done things like that quite often over the last years, and every time I have to dig through the documentation, so I’ll put it up here in the hope that I’ll find it easier in the future and that it might be useful for somebody else ;)

There are only a few steps, following the README.SUSE in the kernel-source package:

  • install the kernel-syms and kernel-source packages
  • copy the kernel sources to some other place where you have write access as a normal user (this is not in the README, but I hate doing stuff like that as root, so I’m doing it anyway)
  • patch the source
  • build the module

Or, as an almost-copy’n'pasteable list of commands:

cd /tmp
cp -a /usr/src/linux/ . # do not only copy the symlink ;)
cd linux/drivers/gpu/drm/i915/
patch < /tmp/i915-nofbc.diff # your diff
make -C /usr/src/linux-obj/x86_64/desktop M=$(pwd)
ls -l i915.ko

You need to adjust the directory given to “make -C” to your desired kernel flavour, of course, but that’s it. Copy the module over to /lib/modules and reboot (I usually save the old module somewhere else, in case something goes wrong, but you probably figured that out already).

Followup: Accounts in Claws-Mail

Wednesday, April 14th, 2010

Just to let everyone know that it was me being blind and not Claws-Mail lacking the function to rearrange the Folder list. As Paul pointed out in his comment on my post, there is “File -> Change Folder Order”, pretty much on top of all other options. So no need to pull out your favourite editor and mess around with XML files ;)

(Sometimes I’m wondering why I am not finding easy stuff like that anymore. My wife or children would probably have found it immediately. Maybe I’m not looking hard enough, because I’m not expecting it to be there? Maybe I’m just spoiled by 10 Years of using console tools for almost everything? I know that I tried to drag and drop the accounts, even though I do not really like drag-n-drop for such configuration changes, because it could happen accidentally. Or, in other words, the “Change Folder Order” menu entry is pretty well matching my personal taste of how such things should be implemented, but I did not find it anyway. Am I the usability designers nightmare after all? Who knows ;) )

Rearranging Accounts in Claws-Mail

Sunday, April 11th, 2010

I recently added a new account to my Claws-Mail configuration. That account will soon become one of my main accounts, so I was not happy about it being shown on the bottom of the folder list, below all my less important accounts.
Using the GUI, I could not find a way to move it around. I already thought about manually changing the configuration, editing all the references for all accounts.
Fortunately, when looking around the ~/.claws-mail directory that contains everything, I found folderlist.xml which is an easy to understand (and edit) XML file that describes how the folders are displayed. I did no fancy stuff, just moved the <folder type=”imap”…> … </folder> block, that corresponds to the new account up to the first place and voilá — it works.
BTW: Claws-Mail is still my favourite email client after using it for over a year - that clearly is a new record ;)

New Challenges

Sunday, October 4th, 2009

Some of you might have already noticed it: I’m no longer working for SUSE.
To avoid any misunderstanding: It was my very own decision to leave, and it was not an easy one.
I was almost 9 years at SUSE in Nürnberg, which is 400km away from home and my family. Now I moved to a job closer to home: less than 10km.
I’ll still be doing linux development, in the embedded area, which is a pretty exciting and interesting opportunity for me. My machines will of course still run openSUSE, and so there’s no doubt that I will have to fix the occasional bug from time to time…

Now I only need to find out how to change that @opensuse email address so that it points to a valid mailbox again… ;)

Using PAN/NAP instead of rfcomm/ppd

Monday, August 10th, 2009

I finally got a new mobile phone - one that not only supports rfcomm (”serial port” via bluetooth) but also the “PAN Network Access Point” profile - which allows a computer to connect to the internet easily, without many extra layers like PPP etc.

It’s actually quite easy to use. (Note: I’m doing all that on recent openSUSE Factory, but I am pretty sure that it would work just as good on plain 11.1)

It is very handy to have the bluez-test package installed, many of the tools I am using are in that package.
First, we need to create a connection to the phone, exchange PIN numbers etc. I use bluetooth-applet from the gnome-bluetooth package (or the one from bluez-gnome) for that, it’s just the best maintained tool for the task, even if you are a KDE guy like I am, I’d highly recommend it.

Now we need to find out the phones Bluetooth-Address (bdaddr):

seife@stoetzler:~> test-discovery
[ 00:24:EF:xx:xx:xx ]
    Name = seife C510
    Paired = 1
    LegacyPairing = 1
    Alias = seife C510
    Address = 00:24:EF:xx:xx:xx
    RSSI = -54
    Class = 0x5a0204
    Icon = phone

The hex number after “Address” is the bdaddr of your device.

Now we can create a network device:

seife@stoetzler:~> test-network 00:24:EF:xx:xx:xx nap
Connected /org/bluez/16833/hci0/dev_00_24_EF_XX_XX_XX to 00:24:EF:xx:xx:xx
Press CTRL-C to disconnect

Now you should have a bnep0 network interface and can (as root) either run dhcpcd directly on it, or create a config file “ifcfg-bnep0″ in /etc/sysconfig/network like this:

BOOTPROTO='dhcp'
NAME='pand network device'
STARTMODE='auto'
USERCONTROL='no'

and then call “ifup-dhcp bnep0″.

Two things to consider:
First, if your system is using NetworkManager, you don’t get DNS addresses into resolv.conv. See this post for details. I now have

NETCONFIG_DNS_POLICY="STATIC_FALLBACK ppp0 bnep0 NetworkManager"

in my /etc/sysconfig/network/config

Second, test-network will terminate the connection after 1000 seconds (it is only a test tool), but it is easy to fix, just copy it to ~/bin/my-test-network (or whatever name you like) and apply the following trivial diff:

--- /usr/bin/test-network
+++ ~/bin/my-test-network
@@ -35,9 +35,10 @@
 print "Press CTRL-C to disconnect"

 try:
-       time.sleep(1000)
-       print "Terminating connection"
+       while 1:
+               time.sleep(1000)
 except:
        pass

+print "Terminating connection"
 network.Disconnect()

I’m not a python wizard, so I’m pretty sure you can do better, but it works well for me.

Improving XFS unlink() performance

Thursday, May 28th, 2009

I knew for quite some time that XFS has an abysmal performance on huge deletes - e.g. deleting a Linux kernel source tree can take several minutes. But when I had to do multiple images with kiwi yesterday on my relatively new server machine at home, it started to really annoy me, so I invested some time to find out if there is a way to improve the situation.
This is what I started from (numbers are from bonnie++):

/dev/sda1 /space3 xfs rw,noatime,nodiratime,noquota 0 0

Version 1.01d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
server           4G 69024  31 71616  10 32732   6 75462  39 77511   6 120.9   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   341   1 +++++ +++   311   1   340   2 +++++ +++   249   1

The first hint I got from a colleague was to use “logbufs=8″ mount option. This increases the number of buffers that XFS uses for its log. Whatever that means. At the first try, it did not change anything until I realized that a “mount -o remount,…” was not enough, I had to unmount and newly mount the filesystem with the option to make it work.
This is the result, still not too impressive with regard to delete performance, the difference might be purely statistical noise:

/dev/sda1 /space3 xfs rw,noatime,nodiratime,logbufs=8,noquota 0 0

bonnie++:
Version 1.01d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
server           4G 66413  31 68420  10 32467   5 76001  40 77143   6 107.2   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   338   2 +++++ +++   313   1   332   2 +++++ +++   269   1

But the really good results came only after also increasing the logbuffer size with the “logbsize=262144″ option:

/dev/sda1 /space3 xfs rw,noatime,nodiratime,logbufs=8,logbsize=256k,noquota 0 0

Version 1.01d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
server           4G 77932  33 85196  10 32134   6 59205  32 76792   6 184.5   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16  1495   5 +++++ +++   848   2  1468   7 +++++ +++   916   3

Now that’s a real improvement and I’ll keep it like that.

But beware, there are some caveats:

  • The file system has to support the larger buffer sizes, which means you need a sufficiently new kernel. As I am running openSUSE 11.1 on this machine, this is not really a problem, but I had to enable the “version 2 log format” with “xfs_admin -j /dev/sda1″ because this partition was created using SLES10 and I am not sure if I still would be able to mount it on an old machine.
  • It will use more memory. I guess that it needs at least 2 MB (256kB * 8 buffers) per filesystem, probably more. But on a box with 2GB of RAM, I’ll gladly spare that for better performance.

One note: those “measurements” were taken on a Core2 Duo machine using an abit IP35-E mainboard. The used disk drive was my old Maxtor STM3500630A 500GB IDE drive. I did not do any statistical corrections etc., so your mileage may vary.

Cross compilers for openSUSE

Thursday, April 30th, 2009

Based on Torsten Duwe’s great work (currently in the Buildservice in home:duwe:crosstools), which is building but not working 100% correctly, I fixed the powerpc version up (I have no other architecture to test on) and put them into the openSUSE Buildservice in home:seife:cross for now.
Get them from here: http://download.opensuse.org/repositories/home://seife://cross/SLE_11
(don’t get put off by that SLE_11, the cross compilers should be pretty system agnostic. For testing I ran them on a SLES10 which is probably older than anything you want to use, and they worked just fine)

Edit: I just found out that this only works because I have a patched rpm on my SLES10 which understands lzma compression. I have added SLES10SP2 to the repository so that pre-LZMA-rpm distributions still can use it.

So if you need a powerpc crosscompiler, just add that repository, install packages “cross-powerpc-embed-linux-gnueabi-binutils”, “cross-powerpc-embed-linux-gnueabi-gcc”, “cross-powerpc-embed-linux-gnueabi-glibc” and “cross-powerpc-embed-linux-gnueabi-kernel-headers” and you are ready to go.
Make sure that /opt/cross/bin is in your $PATH and configure your project for target “powerpc-embed-linux-gnueabi”.

Still TODO: get them into a proper semi-official project.

Oh - and of course I already changed my favourite embedded projects so that they are now able to build with an “external” toolchain ;)

How to get the pipe symbol on a US keyboard?

Monday, February 9th, 2009

Yesterday at FOSDEM 2009, I was asked in an interview done by linux-community.de’s Nils Magnus, “how do you get the pipe symbol on keyboards without that extra key” (which “international” keyboards have, but US keyboards don’t).
Apart from that question being off-topic, as the interview was supposed to be about my netbook talk I had held just before, it’s funny that I knew the answer offhand, since I am very often in the situation to use a german keymap on a US keyboard. So here it is:

Copy this into your .Xmodmap:

! use altgr-# as pipe - if i have an US keyboard
! without key 86, i can use this as pipe.
keycode 51 = numbersign apostrophe bar bar bar bar

Then make sure that “Xmodmap ~/.Xmodmap” is run during login. I think this is done by /etc/X11/xinit/xinitrc.common, but don’t quote me on that.

So now you have the pipe on “AltGr - #” (On a german keyboard. With the US keycaps it is “AltGr - |”, which is not too inconvenient).
The “<" and ">” characters, which are also on this key (again, with a german layout), can be easily be typed by “AltGr - Shift - Y” for “<" and "AltGr - Shift - X" for ">“.

Maybe this is helpful to somebody besides me.

Have fun ;)

Important Privacy Notice

Monday, December 8th, 2008

If you care for your privacy, make sure to always delete /var/lib/zypp/AnonymousUniqueId before using any of the package management tools (YaST2, zypper).