“First, I believe that this nation should commit itself to achieving the goal, before this decade is out, of landing a man kerman on the Moon Mun and returning him safely to the Earth Kerbin.”

February 13th, 2012

With the guidance (and borrowed spacecraft) of an experienced kerbanaut, I made my first landing on the Mun!

Check out Kerbal Space Program!

Files listed multiple times / infinite file list – Samba/Debian kFreeBSD/ZFS

June 25th, 2011

When viewing files over a Samba share, I noticed that each file was listed multiple times and that the number of files kept growing without stopping. I found out that this is a known bug in Samba.

https://bugzilla.samba.org/show_bug.cgi?id=4715
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=612503

There is a workaround, but it is not enabled by default in the Debian Samba package. It seems they are waiting for upstream to fix it, even though there has been no activity in the upstream bug report for almost 4 years.

The workaround is to add:
directory name cache size = 0
in the [global] section in smb.conf

DRDY ERR and ICRC ABRT with VIA VT6421 SATA controller

July 23rd, 2010

01:07.0 RAID bus controller: VIA Technologies, Inc. VT6421 IDE RAID Controller (rev 50)

A Samsung F3 1TB drive connected to my PCI SATA controller started giving me the followed error messages as soon as I had a drive connected.

[125192.884053] ata6: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[125192.900395] ata6.00: configured for UDMA/33
[125192.900414] ata6: EH complete
[125192.949404] ata6.00: exception Emask 0x12 SAct 0x0 SErr 0x1000500 action 0x6
[125192.952120] ata6.00: BMDMA stat 0x5
[125192.954609] ata6: SError: { UnrecovData Proto TrStaTrns }
[125192.957046] ata6.00: failed command: READ DMA EXT
[125192.959455] ata6.00: cmd 25/00:00:84:cd:ba/00:01:3e:00:00/e0 tag 0 dma 131072 in
[125192.959457] res 51/84:84:00:00:00/84:ce:00:00:00/e0 Emask 0x12 (ATA bus error)
[125192.964388] ata6.00: status: { DRDY ERR }
[125192.966883] ata6.00: error: { ICRC ABRT }
[125192.969389] ata6: hard resetting link
[125193.288054] ata6: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[125193.304393] ata6.00: configured for UDMA/33

The solution? I downloaded the latest stable kernel: 2.6.34.1

Update: The fix is now in the latest Debian squeeze kernel (linux-image-2.6.32-5-686 2.6.32-18), so I’m using the official Debian kernels once again. The following instructions could still be helpful if you want to compile a custom kernel on Debian.

Then I unpacked the file. To make the new kernel fit into my existing system, I copied the latest kernel configuration from /boot.
# cp /boot/config-2.6.32-5-686 .config

Using the old config, I ran the kernel configuration to make sure everything looked OK.
# make menuconfig

And finally, I compiled and installed the new kernel as a Debian package.
# make deb-pkg
# dpkg -i ../linux-image-2.6.34.1_2.6.34.1-1_i386.deb

It seems the newer kernel has a better driver for this particular controller. Now, the error messages are gone and some problems with disk speed I experienced earlier are gone.

Note: I had to do this two times. I use zfs-fuse, and when I changed to the new kernel I was told my pool was corrupted, even though I have two mirrored disks. When I changed back to the older kernel, I could reach them again. The second time, I exported the pool, changed the kernel and then imported the pool again.

# zpool export tank
(boot with new kernel)
# zpool import tank

Unsupported character set “iso-8859-1″! when printing with CUPS/Samba

April 15th, 2010

My printer stopped working. It seems this is common when using an old Debian etch install with ISO 8859-1 and then upgrading to Lenny, since the new version of Cups only supports UTF-8. I tried changing my system locale, but that didn’t work. A solution was found by googling: Simply add “display charset = UTF8″ to the “[globals]” section in /etc/samba/smb.conf.

Big thanks to kevmitch at the Ubuntu forums who posted the solution!

High-resolution time measurement in Linux

March 1st, 2010

I found this site which describes everything you need to know :)

http://www.kerrywong.com/2009/05/28/timing-methods-in-c-under-linux/

Left-align code in WordPress

February 18th, 2010

The default theme in WordPress uses “text-align: justify” for everything in a post, which can stretch code and shell commands to cover an entire line. I didn’t want that, so I used the Theme Editor to comment out/remove that line.

.post {
margin: 0 0 40px;
text-align: justify;
}

Now, things look okay!

Compile custom kernel (Linux 2.6.31.8) patched with RTAI (latest CVS version – vulcano) for Ubuntu (9.10)

February 16th, 2010

Problem
The rtai package in Ubuntu 9.10 doesn’t contain a patch for the latest Ubuntu kernel, so a kernel with RTAI support can’t easily be compiled with standard packages.

A solution

Compile a custom kernel image package using vanilla sources and patches from a CVS snapshot of RTAI.

Required packages
I think the packages kernel-package and cvs are enough.

# aptitude install kernel-package cvs

The kernel

Browse the RTAI CVS repository. Right now, the latest version is called vulcano. The kernel patches are located in vulcano/base/arch/x86/patches. My current Ubuntu kernel version was 2.6.31-19-generic, so I chose the patch named hal-linux-2.6.31.8-x86-2.4-09.patch, which is for the kernel version 2.6.31.8. Since the versions are almost the same, it will be easier to use the old Ubuntu kernel configuration.

The next step is to download and extract the vanilla kernel sources in /usr/src. Finally add a symlink which points to the kernel sources.


# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.8.tar.bz2
# tar xvjf linux-2.6.31.8.tar.bz2
# ln -s linux-2.6.31.8 linux

To get the required patch, checkout the latest CVS sources.

# cvs -d:pserver:anonymous@cvs.gna.org:/cvs/rtai co vulcano (latest stable version)

Next, patch the kernel sources with the correct patch.

# cd /usr/src/linux-2.6.31.8
# patch -p1 -b < ../vulcano/base/arch/x86/patches/hal-linux-2.6.31.8-x86-2.4-09.patch

It’s time to build the kernel. It will be built as an Ubuntu kernel image, which means it will be added automatically to the boot loader upon installation and fits nicely into the existing structure.

The current kernel configuration is copied from /boot.

# make-kpkg clean
# cp /boot/config-2.6.31-19-generic .config
# make oldconfig

Reply to the questions which pop up (about Interrupt Pipelines, for example). Just press ENTER for defaults if you aren’t sure about a question.

There are a few things left to configure, at least I had to configure them to get rid of some error messages.

Problem: include/linux/ipipe.h:76:2: error: #error “CONFIG_NR_CPUS is too large, please lower it.”
Solution: Disable “Support sparse irq numbering” (SPARSE_IRQ=n)

Problem: ipipe.c prints an error message about per_cpu__irq_state_union being undefined
Solution: Disable “Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)” (CC_STACKPROTECTOR=n)

Problem: The RTAI docs say that module versioning support should be disabled.
Solution: Disable “Module versioning support” (CONFIG_MODVERSION=n)

Now, build the kernel! You might as well build the headers at the same time.


# fakeroot make-kpkg --initrd kernel_image kernel_headers

Go do something else while the kernel compiles if your computer is slow. :) When it’s done, it’s time to install the new kernel. The new .deb-files have been placed in /usr/src.

# cd /usr/src
# dpkg -i linux-image-2.6.31.8_2.6.31.8-10.00.Custom_i386.deb linux-headers-2.6.31.8_2.6.31.8-10.00.Custom_i386.deb

Now, reboot the computer to see if your new kernel works. It should, but if it doesn’t, choose an older kernel in the boot loader to get back into your system.

RTAI

When the patched kernel is up and running, it’s time to compile RTAI itself and install it. The default options in the configuration should be fine, but change them if you want a certain feature. Note that the default setting for the kernel source location is /usr/src/linux, which our symlink takes care of.

# cd /usr/src/vulcano
# make menuconfig
# make
# make install

Note: The RTAI documentation tells you to have a separate build directory, but when I tried that I got the following error messages:

Makefile:303: ../vulcano/scripts/Kbuild.include: No such file or directory
Makefile:527: ../vulcano/arch/x86/Makefile: No such file or directory

When I did everything in the source directory as above, the error messages never appeared.

After the installation

Enter your new RTAI directory.

# cd /usr/realtime/

You’ll find the RTAI modules in modules/ and some tests to run in testsuite/.

Remember, load rtai_lxrt.ko for ‘user’ tests and rtai_sched for ‘kern’ tests.

Good luck!

Debian/Ubuntu: Man pages for system calls and library calls

February 15th, 2010

A quick tip if you want to look up system and library calls in the man pages.

Install the following package:

# sudo aptitude install manpages-dev

Adding more swap space as a file in Linux

February 4th, 2010

I’ve had some “out of memory” problems on a host system running VirtualBox. I’ve decided to add more swap memory to the host to see if it helps.

Since the hard drives are already partitioned I had to add the new swap memory as a file. I followed the following guide and added 2GB of memory.

http://www.linux.com/archive/feature/113956

This is what I did:

# dd if=/dev/zero of=/swapfile bs=1M count=2K
# mkswap /swapfile
# swapon /swapfile
# vim /etc/fstab

Added the following line:
/swapfile    none        swap    sw        0    0

Things are looking good so far, but I’ll wait a couple of days to see if the problem returns.

Edit:

As of now, the guest system has an uptime of 12 days. Success!

How did you get here?

January 7th, 2010

Hello! This blog is rather empty at the moment. I’d appreciate it if you could post a comment and tell me how you got here, since there shouldn’t be any links pointing here yet.

Just curious!