Archive for the ‘work’ Category

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).

Setting the repeat rate on an input device (Kernel 2.4 and 2.6)

Monday, December 8th, 2008

If you ever come into the situation of having to set the repeat delay/period on an input device (/dev/input/eventX), with the additional challenge of needing it to work on both 2.4 and 2.6 kernels, maybe this code snippet might help you (fd is the filedescriptor of the device, opened writable):

        #include <linux/input.h>
        struct input_event ie;
        ie.type = EV_REP;
        ie.code = REP_DELAY;
        ie.value = 1000; /* 1 second initial delay */
        if (write(fd, &ie, sizeof(ie)) == -1)
                perror("REP_DELAY");
        ie.code = REP_PERIOD;
        ie.value = 250; /* 4 events per second */
        if (write(fd, &ie, sizeof(ie)) == -1)
                perror("REP_PERIOD");

Looks pretty trivial, doesn’t it? But it took me quite some time to realize that I needed to write a “magic” event into the device to set the properties ;)

“smart” suspend in pm-utils

Tuesday, October 7th, 2008

I finally implementd the “smart” suspend in our pm-utils package. This means that hopefully more machines will just suspend to RAM “out of the box” without any tweaking of configuration etc. It also leverages the quirks list in HAL which is a bit bigger than the one in s2ram (but IMVHO also of lower quality…) in case the machine is unknown to s2ram.

Give it a try in the next beta, or, if you can’t wait any longer, fetch it from home:seife:Factory (the Build Service is pretty busy lately, so the packages are not built for Factory yet, just use the 11.0 version, it should work in 11.1 too).

UMTS/GPRS Image compression

Thursday, September 18th, 2008

While reading another of Frank’s blog posts, I remembered that I had the same problem some time ago and used bmctl.pl, a perl script that I had found somewhere on the web to disable image compression on 3G connections. Maybe it is useful for someone…

Updated storage-fixup package

Thursday, September 18th, 2008

After reading about Frank’s various problems on the Samsung Q45, I decided to help him out and updated the storage-fixup package in FACTORY, so now it includes the fix for his machine.

Frank, now you only need to start using FACTORY ;)