First experiences with Linux kernel 2.6.32

Last week Linux 2.6.32 was released. I’m currently using it with the bfs-scheduler patchset.

I experienced three glitches so far on my Gentoo installation. I hope these are not cases of RTFM.

Portaudio with ALSA cmipci-driver

With a freshly rebooted kernel I’m pretty quickly seeing these messages in /var/log/message.

pulseaudio[4338]: alsa-util.c: Dies ist wahrscheinlich ein Fehler im ALSA-Treiber 'snd_cmipci'. Bitte melden Sie diesen Punkt den ALSA-Entwicklern.
pulseaudio[4338]: alsa-util.c: snd_pcm_dump():
pulseaudio[4338]: alsa-util.c: Hardware PCM card 0 'C-Media CMI8738' device 0 subdevice 0
pulseaudio[4338]: alsa-util.c: Its setup is:
pulseaudio[4338]: alsa-util.c:   stream       : PLAYBACK
pulseaudio[4338]: alsa-util.c:   access       : MMAP_INTERLEAVED
pulseaudio[4338]: alsa-util.c:   format       : S16_LE
pulseaudio[4338]: alsa-util.c:   subformat    : STD
pulseaudio[4338]: alsa-util.c:   channels     : 2
pulseaudio[4338]: alsa-util.c:   rate         : 44100
pulseaudio[4338]: alsa-util.c:   exact rate   : 44100 (44100/1)
pulseaudio[4338]: alsa-util.c:   msbits       : 16
pulseaudio[4338]: alsa-util.c:   buffer_size  : 16384
pulseaudio[4338]: alsa-util.c:   period_size  : 8192
pulseaudio[4338]: alsa-util.c:   period_time  : 185759
pulseaudio[4338]: alsa-util.c:   tstamp_mode  : ENABLE
pulseaudio[4338]: alsa-util.c:   period_step  : 1
pulseaudio[4338]: alsa-util.c:   avail_min    : 15503
pulseaudio[4338]: alsa-util.c:   period_event : 0
pulseaudio[4338]: alsa-util.c:   start_threshold  : -1
pulseaudio[4338]: alsa-util.c:   stop_threshold   : 1073741824
pulseaudio[4338]: alsa-util.c:   silence_threshold: 0
pulseaudio[4338]: alsa-util.c:   silence_size : 0
pulseaudio[4338]: alsa-util.c:   boundary     : 1073741824
pulseaudio[4338]: alsa-util.c:   appl_ptr     : 231533
pulseaudio[4338]: alsa-util.c:   hw_ptr       : 212998

I think with Linux 2.6.30 I experienced these problem for the first time, both for the onboard 82801EB/ER (ICH5/ICH5R) audio controller and the add-on C-Media CM8738 controller. Since then I’ve been reinstalling the ALSA driver 1.0.20 from http://www.alsa-project.org each time I recompiled a new kernel. 1.0.21 showed the same problem. Pulseaudio progessed in this period from 0.9.15 to 0.9.21, the latest being the one I’m currently using.

What changed with 2.6.32 however is, that onboard 82801EB/ER (ICH5/ICH5R) now appears to be working. After listening with onboard audio for a bit, I remembered, why I installed an elcheapo PCI-card. The onboard audio carries such an amount of noise, that it is unbearable.

NFS

When I tried to mount a locally exported file system on a remote system, these segmentation fault showed up in /var/log/messages:

kernel: rpc.mountd[3885]: segfault at 13 ip 0804c133 sp bfc98530 error 4 in rpc.mountd[8048000+12000]

This could be fixed be recompiling net-fs/nfs-utils-1.2.1.

ACPI-Wakup

I’m using the below command sequence to let my PC wake-up and boot at 7:15 in the morning, so that it’s ready, when I come into the company. This worked flawlessly until I switched to 2.6.32.

# echo 0 > /sys/class/rtc/rtc0/wakealarm
# echo $(date -u '+%s' -d 'tomorrow 7:15') > /sys/class/rtc/rtc0/wakealarm
# cat /proc/driver/rtc 
rtc_time    : 17:07:41
rtc_date    : 2009-12-11
alrm_time   : 07:15:00
alrm_date   : 2009-12-12
alarm_IRQ   : yes
alrm_pending    : no
24hr        : yes
periodic_IRQ    : no
update_IRQ  : no
HPET_emulated   : yes
DST_enable  : no
periodic_freq   : 1024
batt_status : okay

Here is someone, who apparently experiences this as well.

Inkscape keyboard and mouse reference as a booklet

I’ve used Inkscape on a couple of occasions. Inkscape is such a powerful program, but I think, it’s it’s not one of the easiest to use. Somehow, each time I’m using Inkscape I’m again struggling with the same basic concepts. I can’t really say, how things would need to be changed, to make it really more simple.

Anyway Inkscape sports such a plethora of keyboard and mouse functions, that I thought, it would be probably very useful to have a small booklet in paper form beside your keyboard.

Therefore I basically copied the Inkscape keyboard and mouse reference into OpenOffice and created this OpenOffice file, designed to be printed on A4 paper. The actual shuffling of the pages to print the file as booklet is not done within OpenOffice, but by transforming PostScript files using the psutils. I guess pretty much every Linux distribution should have them on board.

To actually create the booklet I’ve saved the OpenOffice source into this PDF file with OpenOffice’s “Export to PDF” function. Then, I used evince from the Gnome Desktop Environment to create a file randomly called t.ps by printing to a PostScript file (inkspace-key.ps). The final booklet file is created by executing the following commands:

psbook -s16 inkscape-keys.ps t.ps
pstops '2:0L@.7(21cm,0)+1L@.7(21cm,14.85cm)' t.ps tt.ps
ps2pdf14 tt.ps

The psbook reorders the pages in such a way, that once printed double sided in landscape format, the resulting stack of pages can simply be folded in the middle. The pstops command then rotates, scales and positions each A4 page, so that two pages are printed on each side of a piece of paper. ps2pdf then creates a new PDF file (tt.pdf).

At home I’m using a Canon Pixma ip4000 printer. For this booklet I don’t use the printers ability to print double sided, since front and back page then have a slight offset. I use evince again to first print the odd numbered paged, re-feed the printed pages as they are stacked back into the feeder and print the back sides with the even pages. Now you should have a booklet, that you can simply fold in the middle. This is the resulting PDF file the above three command executions as an example.

You might need to fiddle a bit with the “0” and “14.85cm” parameters for the pstops command, so that the front and the back of a page properly align.

Last confirmation about the defect disk. (Updated)

Clearing the disk

In preparation of sending the Samsung hard disk back to the dealer as a warranty issue, I cleared the whole disk with a “dd” command (dd if=/dev/zero of=/dev/sdb bs=64k). I monitored the process by running vmstat 10 in another terminal window. The resulting bo-column (block out) is reflected by the diagram to the right.

The whole operation took roughly 4 hours and 10 minutes. The drive operated at full for the first third, than things obviously got flaky. The same effect I saw with my file system copy operations. Large periods where the drive operates with only 4 — 6 Mb/s output rate.

Hopefully this will be prove enough for the dealer to replace the drive.

Zeroing replacement drive

Update: In the meantime I’ve received a replacement drive. Just to see, if this drive was ok, I repeated the zeroing of the complete drive. I’m assuming, that the minor hiccup at the beginning doesn’t mean any problems.

Heureka, I’ve found it …

Since I’ve build my PC in the beginning of 2008 I’ve been struggling with the disc write performance. Evidence of my problems are these posts: here, here and here and here.

According to the changelogs of the recently released Linux kernels, there were quite a bit of changes in the ext3/ext4 file systems. Therefore in the beginning of October I moved all my file systems from XFS to Ext4 in the hope for things to get better. Once the data was restored the situation was as bad as before, it even felt a bit worse. During this backup and restore process for the first time it dawned on me, that my Samsung F1 hard disk might be the culprit. In particular once I looked at the S.M.A.R.T. data with GSmartControl.

S.M.A.R.T. Data Hardcopy
When I looked at the data for the first time after the restore operation, the data looked much than in this screenshot. There recoverd ECC and Soft Errors in 6-7 digit numbers. However never ever did I see that the disk reported an error to the operating system.

And, what I probably should have considered earlier, that the transfer to the external ESATA drive always worked with top performance, the copy back process to the original disk than was awful again. I even went so far to copy the OS to another external USB drive to remove the OS from the equation. I booted from the USB drive and redid the backup and restore operation. Again with the same result, that the Samsung disk showed a very bad write performance. This was when I finally decided to order another hard drive. Tom’s Hardware gave Samsung Spinpoint F3 pretty good marks and that’s the one I ordered then.

Gkrellm Snapshot
And what can I say? My problems were gone, completely and utterly gone. Look at the little Gkrellm screenshots on the right. The left half shows the copy process from the old, “bad” disk (top half) to “good” new disk. As you can see, the new disk is even faster than the old one. The right half however shows the copy process from the “good” F3 disk to the “bad”, old F1 disk. Here you can observe the very low write performance of the old F1 disk (top half).

Then I obtained the Samsung hutil disk utility and did a low level reformatting of the old F1 disk and also did self diagnostic with a complete surface scan. Both operation didn’t show any problem whatsoever. I redid some copy operations to the old F1 and the new F3 disks and logged the output from vmstat and created the below diagrams.

Each time the data was copied with the following command line:

tar -c -b 128 -f - source-dir | tar -x --checkpoint=1000 -b 128 -C /destination-dir/

The data was collected with vmstat 10 | tee /tmp/logfile. Roughly 120Gb were transferred.

Optimal Performance Diagram
This the diagram for the copy process to the “good” new F3 disk (bi is “block in” for the read op, bo is “block out” for the write op). The source disk was the old F1 disk. The whole process took about 38 minutes. This is the raw text file from the vmstat command. As you can see the read performance of the old F1 disk is perfectly fine.

Bad Performance Diagram
And here is the diagram for copy process from the new F3 to the old F1 disk. Simply bloody awful write transfer rate. The whole operation took about 98 minutes. This is the raw text file from the vmstat command. The spikes are probably due to the hard disk write cache. Now wonder, that the whole desktop might get sluggish with such a bad behavior.

I’m so annoyed, that I didn’t draw the right conclusions earlier. I could have spared me more than 1½ year of frustration with Linux in general.

These little (annoying) problems …

SUN Type 6 Keyboard

SUN Type6 Keyboard

In the company I’m using a SUN Type6 USB keyboard. I’ve tried a couple of keyboards, but this still has the nicest feel of them all. The Linux evdev assigns the symbols Super_R (1 in the right picture), Menu (2 in the picture) and ISO_Level3_Shift (3 in the picture) in order to the three key right of the Space key. For me personally the ISO_Level3_Shift is a little bit far to right and I’m missing a right Control key. With Xorg server 1.5.3 I was able to remap the Super_R key to ISO_Level3_Shift and the right most key to Control_R by using setxkbmap and xmodmap.

$ setxkbmap -symbols "pc+de+inet(evdev)+level3(rwin_switch)"
$ xmodmap remapctrl

The file remapctrl contains the lines:

keycode 108 = Control_R Multi_key
clear control
add control = Control_L Control_R

All good and dandy. Then I switched to Xorg server 1.6.3.901-r1 (on Gentoo Linux).

It still sort of works. When I press the remapped ISO_Level3_Shift and “q” on the keyboard I’m getting the expected “@“. The same should be true for the “~” key. However the “~” is a dead key to produce characters like “ã” with two key strokes. Here, the newly remapped ISO_Level3_Shift has no effect and the same with all other dead keys.

When I remap the Menu key to ISO_Level3_Shift however with

$ setxkbmap -symbols "pc+de+inet(evdev)+level3(menu_switch)"

then all the dead keys like “~” work again as expected. I guess to need to fiddle with /usr/share/X11/xkb/keycodes/evdev to get a final fix.

Missing icon in systray

Systray Icons

Some time in the past I switched from Amarok 1.4 to Mpd with the client Gmpc as my preferred music listening solution. Originally the icon in the Xfce4 systray looked ok as on the right side in the picture to the right (the light blue musical note).

After having installed the icon set Tango and after having switched the icon set a couple of times, I ended up with a systray, which looked like the left side in the picture (some generic icon for the Gmpc).

I then went searching, why in some icon sets the Gmpc systray icon was displayed correctly, while in others it was replaced with some generic icon.

After a bit of digging I found, that the Tango icon set, that I installed doesn’t inherit from the icon set hicolor, which appears to be the mother of all icon sets. Gmpc installs its icons in the hicolor directory structure. As I looked at the file /usr/share/icons/Tango/index.theme it read like this:

[Icon Theme]
Name=Tango
Comment=Tango Icon Theme
Inherits=gnome,crystalsvg
Example=x-directory-normal

After I changed “Inherits=gnome,crystalsvg” to “Inherits=hicolor,gnome,crystalsvg” everything looked fine in the systray again.

Wrong framerate on virtual consoles

Again, in the company I inherited a newer flat screen display panel compared to the old one, which had a resolution of 1280×1024. The new one now is capable of 1600×1200 pixels. After reconfiguring /etc/X11/xorg.conf and reboot into the X11 session everything was fine. However, now each time, when I’m shutting down the system or when I switch to one of the virtual Linux consoles, I’m getting an error message from the display, that the vertical and horizontal sync frequencies are out of range. Very annoying.

After some experimentation I have found a workaround. Before shutting down or changing the virtual console, I change the X11 resolution of the X11 server to the 1024×768 size with the key combination CTRL+ALT+Keypad- or CTRL-ALT-Keypad+. I’m wondering, if it has something to do with the fact, that I’m using a Nvidia graphics card. I think a came across similar problem reports in Ubuntu forums, which also mentioned Nvidia cards.

Some additional DB2 notes

In my original article I wrote, that I had some problem with the to_char() function while moving the Oracle database structure to DB2. The problem wasn’t so much about, that to_char() isn’t supported on DB2 (it is, it’s basically the same thing as varchar_formar()), but that the Migration Toolkit had generated a 3 argument version of to_char(), the 3rd argument being some I18N parameter. Apparently, what the MTK deduced from the originating database didn’t fit with DB2 9.7. Anyway, this is probably still a MTK issue.

Working with DB2 for the last weeks has been mostly a pleasant experience. First of all there comes a GUI (db2cc aka the DB2 command center, which is basically a front end to a couple of graphical tools) with the database, which simplifies most administration tasks and which also provides a SQL editor to help with the development of your SQL queries. Therefore you don’t necessarily need any 3rd party software, to make your life easier. Second, if you look up the explanation of a particular SQL error (db2 ? SQL?????N), you will receive helpful suggestions, what might have caused the problem. This was frequently good enough for me to keep going without further reading in any manuals.

However I also have an issues with db2ce, the SQL command editor. When I try to save my developed SQL query to a file only the root (/) directory is offered as the destination location. I was unable to select a different location with the file selection box. If I tried to create a directory within the file selection dialog, I received a SQL22204N error and the dump/db2dasdiag.log file contained the following:

2009-08-25-16.19.31.198185+120 I5362G279          LEVEL: Error
PID     : 27995                TID : 3041135504
FUNCTION: DB2 Tools, DB2 administration server, db2dasFMdirectoryCreate, probe:30
CALLED  : DB2 Common, OSSe, ossDirectoryCreate
RETCODE : ECF=0x90000001 Access denied

Unfortunately there is no indication of the file path, which might cause the error.

The other issue concerns the user administration. I’m trying to give an additional system user access to some tables from the main schema. I’m received a large Java stack trace once I clicked in the respective dialog box to select the tables from the particular schema and I can’t proceed. Something like this:

    ....
    at javax.swing.JComboBox.setEnabled(JComboBox.java:1381)
    at com.ibm.db2.tools.common.AssistCombo.setEnabled(Unknown Source)
    at db2_udb.UserGroupAddObjectDialog.itemStateChanged(Unknown Source)
    at com.ibm.db2.tools.common.AssistCombo.notifyItemListeners(Unknown Source)
    at com.ibm.db2.tools.common.AssistCombo.itemStateChanged(Unknown Source)
    at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1214)
    at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1271)
    at javax.swing.JComboBox.contentsChanged(JComboBox.java:1318)
    at com.ibm.db2.tools.common.AssistCombo.contentsChanged(Unknown Source)
    at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:111)
    at common.JComboBoxModel.setSelectedItem(Unknown Source)
    at javax.swing.JComboBox.setSelectedItem(JComboBox.java:564)
    at com.ibm.db2.tools.common.AssistCombo.setSelectedItem(Unknown Source)
    at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:612)
    at com.ibm.db2.tools.common.AssistCombo.setSelectedIndex(Unknown Source)
    at common.ComboBox.setSelectedIndex(Unknown Source)
    at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.jav
    ....

When I’m terminating the db2cc Java even segfaults:

Unhandled exception
Type=Segmentation error vmState=0x00000000
J9Generic_Signal_Number=00000004 Signal_Number=0000000b Error_Value=00000000 Signal_Code=00000001
Handler1=B7D150E5 Handler2=B7DB7A0D InaccessibleAddress=A9824680
EDI=A8B013DC ESI=00000000 EAX=A9824680 EBX=A946787C
ECX=00000000 EDX=A9824680
EIP=AA9149C8 ES=0000007B DS=0000007B ESP=A94676CC
EFlags=00010282 CS=00000073 SS=0000007B EBP=A94676DC
Module=/home/db2inst1/sqllib/lib32/db2jddba
Module_base_address=AA8BE000 Symbol=_ZN13jdbcAEProfileD1Ev
Symbol_address=AA91497C
Target=2_40_20081105_025433_lHdSMr (Linux 2.6.27-gentoo-r8)
CPU=x86 (4 logical CPUs) (0xbe195000 RAM)
----------- Stack Backtrace -----------

I guess I need to check the DB2 forums for some hints.

Originally I installed DB2 on a AMD64 server to get familiar with the software. The actual destination server however was a 32bit Intel box. There is a PDF in the DB2 9.7 documentation set, which describes the various available options. After some fiddling I choose the combination of db2look and db2move to transfer the data.

On the originating host I executed:

db2look -d httpd -z db2inst1 -dp -e -o struc.sql
db2move HTTPD EXPORT -sn DB2\*

Then the data was transferred to the destination host, where I executed the commands

db2 -tvf struc.sql 
db2move httpd import -io insert

to restore the database. The “-io insert” is important here, otherwise you would have received errors in connection with tables, which reference foreign keys.

Otherwise it’s still smooth sailing with DB2.