Here I'll list things I learned while fiddling with UNIX/Linux/MacOS X (which is a BSD derivate).

mediawiki gives "Fatal exception of type MWException Error" error

Add the following to the end of LocalSettings.php:
require_once "$IP/extensions/LocalisationUpdate/LocalisationUpdate.php";
$wgLocalisationUpdateDirectory = "$IP/cache";
Made sure www-data: owns all of the mediawiki files and dirs.

axcall gives connect but no data

axcall to host x gives a connect but no output: restart ax25d on host x.

see how much data needs to be written do disk for sync()

grep -e Dirty: -e Writeback: /proc/meminfo

PulseAudio: pipe audio-in to audio-out

gst-launch pulsesrc ! pulsesink

remove audio from a video file

Use one of these:
ffmpeg -i example.mkv -c copy -an example-nosound.mkv
ffmpeg -i example.mkv -vcodec copy -an example-nosound.mkv
(which one depends on ffmpeg version)

recent raspbians fail to configure network device

Make sure you have this in /etc/network/interaces:
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

replacing " CC " / " CXX " in make output by real command (autoconf)


when redirecting python script output, nothing appears

Run python with the "-u" flag.

kernel "make menuconfig" all garbled / not working cursor keys

Check if /usr/bin/make menuconfig works (with explicit path). If so, you may be using "colormake" which interferes with make menuconfig.

Enabling a gpio pin on a Nanos G20

Find the pin you want to use in this document. Then: PA... start at offset 0, PB... start at offset 32. So if you want to use pin PB17 (TCLK4), invoke:
echo 49 > /sys/class/gpio/export

"Enable multithreading to use std::thread: Operation not permitted"

Most of the times this is because you did not build the program with the "-pthread" flag. On ubuntu this is also caused by something else and can be fixed by linking with "-Wl,--no-as-needed".

autocomplete in vim

apt-get install vim-youcompleteme
vam install youcompleteme

NFS over wifi is slow

Mount it with small block sizes:
-o rsize=1024,wsize=1024

active tab in gnome-terminal hardly distinguishable from others

Edit ~/.config/gtk-3.0/gtk.css and add the following:
@define-color vanheusdencom #007c04;
TerminalWindow .notebook tab:active {
 background-color: shade(@vanheusdencom,1.1);

dpkg-buildpackage: override CFLAGS

Set the following environment variables:

perl: warning: Setting locale failed

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_GB:en",
        LC_ALL = (unset),
        LANG = "nl_NL.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
resolve this using (Debian/Ubuntu):
apt-get install locales
locale-gen en_GB:en nl_NL.UTF-8
dpkg-reconfigure locales
locale-gen is part of the "locales" package.

"timeseal" on a non-x86 Linux system

When playing chess on e.g. fics one sometimes need a program called "timeseal". This program is available for Linux in an x86 binary. If you want to run it from ARM, that's a bit of a problem. Solution is openseal. boot from sata

Make sure you have a recent boot-loader on the sd-card.
Then in the boot loader:
setenv mmcroot /dev/sda1 rootwait rw
Make sure to clear the environment from earlier experiments!

Find windows key in bios from linux

hd /sys/firmware/acpi/tables/MSDM
od -a /sys/firmware/acpi/tables/MSDM

"The following signatures couldn't be verified because the public key"...

This happens occasionally in Debian.
gpg --keyserver --recv-key B17430190E8C1F28D8AE
gpg -a --export B17430190E8C1F28D8AE | apt-key add -
Of course you need to replace "B17430190E8C1F28D8AE" by the hex-code given by the error message.

where to find axudp?!

It is actually called ax25ipd and is part of the ax25-apps package.

let wget ignore robots.txt

Add the following to the command-line:
-e robots=off --wait 1

looking up all information required for udev rules

for DEVICE in $(find /sys ! -type l -iname "*${CLUE}*"); do ls -dl $DEVICE; udevadm info -a -p $DEVICE; done
Where 'ttyUSB0' is an example for a device you're looking for.

converting eml files to an mbox file

for i in *eml ; do echo 'From - Thu Sep 5 08:43:40 2013' ; cat "$i"; echo ; done > ~/mail/mails

disable virtual desktop in fvwm

Edit /home/folkert/.fvwm/.fvwm2rc and change "DesktopSize xxx" to "DesktopSize 1x1".

libvirtd: Timed out during operation: cannot acquire state change lock

Check that there's no left-over PID-file for the guest you're trying to start. E.g. when the guest is called 'minix', check for /var/run/libvirt/qemu/

KVM instance refuses to resume

This for example happens when a change to the configuration of that VM is pending. E.g. a change that could not be done while the VM was running. The only solution seems to be: remove the resume-data and restart the VM.
virsh managedsave-remove of the vm...

XBoard complains about fonts

This can be worked around by starting xboard like this:
LANG=C xboard

Converting an IBM codepage 437 to UTF-8

In the MS/PC-DOS era, most computers used "codepage 437" which gave those nice lines and block-patterns.
If you like to convert those to UTF-8 so that systems that have no knowledge of "codepage 437" can view it, you can convert it using "iconv":
cat myfile-in.txt | iconv -f 437 -t utf8 > myfile-out.txt

Building a package on Debian (or Ubuntu), the quick way

Debian tends to bother you with all kinds of questions etc while building packages which are fine for maintainers but not neccessary for a quick test by yourself. In such a case, build it with the following command line:
dpkg-buildpackage -us -uc -b

Change font size of Qt software (eg kcachegrind) under Gnome

Invoke qtconfig.

"perl: warning: Falling back to the standard locale ("C")."

This can be salvaged by (on Debian) invoking:
dpkg-reconfigure locales
There, choose your locale(s) and in the next screen choose the default to use.

Set "screen" tab name / show tab name in status line

One can set the title of an xterm or from a window, but it is also possible to give each tab/subwindow a name. When in a screen session, press ctrl + a and the " (yes, double quotes): you will see then a list of tabs. But if the first thing you do is starting an ssh session to somewhere else, this name won't change from its default. By adding the following to /etc/bash.bashrc to each host you ssh to, then the name of each tab will change to its hostname:
echo -ne '\ek'`hostname -s`'\e\\'
Add the following to .screenrc to see a list of tabs at the bottom of the terminal:
hardstatus alwayslastline "%{kr}%H%{rk} %{kc}%-Lw%{= rk}%50>%n%f* %t%{-}%+Lw%< %{gk}%-19=%c %D,%d %M"

Getting rid of the annoying delay after password type

Edit /etc/pam.d/loging and look for:
auth       optional  delay=3000000
change that to:
auth       optional  delay=1
also look for files in /etc/pam.d that use Then add "nodelay" (without the quotes) behind that line.

Raspberry Pi constantly crashes

This can be triggered if you have an USB to serial converter (PL2303 or FTDI) connected.
Solution: run rpi-update and add the following to /boot/cmdline.txt:
profile=2 loglevel=7 dwc_otg.microframe_schedule=1 dwc_otg.fiq_fix_enable=1  sdhci-bcm2708.sync_after_dma=0 sdhci-bcm2708.enable_llm=1 dwc_otg.lpm_enable=0
If it doesn't help, you can install the "watchdog"-package. Add the "bcm2708_wdog" module to /etc/modules (and invoke "modprobe bcm2708_wdog"), install the watchdog package and uncomment the line with "watchdog-device =" in it.

wifi disconnects "reason 3"

Make sure there are not 2 wpa_supplicant processes running. E.g. configuration by /etc/network/interfaces (Debian, Ubuntu) as well as network-manager.

LSR safety check engaged!

This error message is sometimes seen in the kernel logging when accessing certain serial ports.
In that case, verify that the io/irq settings of the serial ports are what is detected. E.g.:
root@weerstationserver:/home/folkert# grep ttyS /var/log/dmesg
[    6.188621] 0000:01:00.0: ttyS0 at I/O 0xe030 (irq = 16) is a ST16650V2
[    6.210299] 0000:01:00.1: ttyS1 at I/O 0xe020 (irq = 17) is a ST16650V2
[    6.231805] 0000:01:00.2: ttyS2 at I/O 0xe010 (irq = 18) is a ST16650V2
[    6.253235] 0000:01:00.3: ttyS3 at I/O 0xe000 (irq = 19) is a ST16650V2
Now then if the safety check message is about ttyS0, then run:
setserial -a /dev/ttyS0
You then might see that the serial port is actually connected to totally different i/o port and irq settings.
To resolve that, change those settings to what is listed in the kernel messaging (dmesg):
setserial /dev/ttyS0 port 0xe030 irq 16


The dos2unix package on Ubuntu is called 'tofrodos'.

add-apt-repository behind proxy

This command requires both 'http_proxy' as well as 'https_proxy' to be configured.

Changing GDM background on Debian

Change the file location in:

OpenLDAP on Debian

All examples talk about a "cn=Manager" user. On Debian this is "cn=admin".

Debian & Xorg

Xorg under Debian no longer expects xorg.conf in /etc/X11, instead it wants a file under /usr/share/X11/xorg.conf.d/ starting with a 2 number digit.

Prefer IPv4 over IPv6

Add the following to /etc/gai.conf:
precedence ::ffff:0:0/96 100

Python, threading.Timer & clock adjustments

If the system time is set somewhat earlier than it was, a running "threading.Timer()" (Python) takes longer than set up.
This matters of you let the time jump using e.g. ntpdate.

Debian 6: Chrome icon missing from menu

cp /opt/google/chrome/google-chrome.desktop /usr/share/applications/

Configuring Nabaztag with WPA

  • Switch off, press (and keep pressed) the button and switch on. Stop pressing the button when the lights become (dark-) blue (almost instant).
  • Enable TKIP in your access point
  • Choose a password with at least one capital in it(!), one word (no spaces) and no special characters

Rebuilding VMware kernel modules

vmware-modconfig --console --install-all

Make boot-fsck (ext2/3) abortable

In file /etc/e2fsck.conf:
allow_cancellation = true

.m1v to .mpg

mencoder-mt -of mpeg -ovc copy -o output.mpg input.m1v

MySQLAR doesn't work at all when installing from tar-file on Debian

Make sure that a user 'mysqlar(d)' was created (with home-directory pointing to the data-directory), also make sure that that user has write-rights on the datadir. Move the mysqlar.cfg to /etc, move the .daily file to /etc/cron.daily (same thing for mysqlar.weekly and monthly).
Add the following to the crontab of root:
*/5 * * * * hourly=1 daily=1 weekly=1 monthly=1 /usr/local/bin/mysqlar_graph > /dev/null
Also apply this patch first before installing. It makes mysqlard handle database restarts more gracefully.

SVN: "Error: Entry 'com.cpp' has unexpectedly changed special status"

svn pd svn:special com.cpp
... and retry e.g. your commit command.

"IBM ToolsCenter bootable media creator" refuses to download updates/diagnostics

Solution: run as root

Xen vm: "hwcap index 0 already defined as nosegneg"

Change /etc/ so that hwcap 1 nosegneg is replaced by hwcap 0 nosegneg.

IBM Director (5.20.3) complains about a certificate which is about to expire

The following message is logged: The certificate that is used for CIMOM authentication, located in the data\cim\keystore\ibmd_cert.jks file, will expire soon..
You can fix that by entering the following on the server itself:
/opt/ibm/director/bin/dircli certmgr -g

Extract audio from videostream (e.g. .flv-file)

mplayer -dumpaudio file-in.flv -dumpfile file-out.mp3

In Debian: rc.local seems to aborts halfway

In the shebang-line, remove the '-e' switch.
#!/bin/sh -e
The premature exit is caused by a command having a non-0 exit.

Problems while mounting a CIFS/SMB share

Enable debugging in the kernel for more details on what is going on:
echo 1 > /proc/fs/cifs/cifsFYI

cannot change data mode on remount

You'll see that message if you're trying to remount a filesystem with a different journalling option.
Solution is to explicit give all parameters to mount so that it doesn't look at fstab.
mount -o remount,rw /dev/sda1 /

SuSE 10 & VLAN

  • Install the package 'vlan'
  • Create a /etc/sysconfig/network/ifcfg-vlanx and replace 'x' with the vlan-number you want this device to be in
  • In the ifcfg-vlanX file, add a line 'ETHERDEVICE=ethX' where ethX is the device to which you want to bind this "vlan-interface"
  • You might want to truncate the original ifcfg-ethX so that you don't have an ip-address on that one
  • Check in /proc/net/vlan/config that you have 2 vlan-devices connected to a physical adapter
  • In the output of 'ifconfig' you'll see an adapter for each new vlan adapter

Maximum file-integrity

  • Mount all filesystems with 'barrier=1' and 'errors=remount-ro'.
  • Also use 'data=journal' Please note that for the root-filesystem you need to add 'rootflags=data=journal' as a kernel bootparameter and not in fstab!
  • Enable "Mirror Write Consistency" for md-devices (see below)
  • Disable write-cache: hdparm -W 0 /dev/hda (or sda/hdb/etc.)
  • In VMware server on Linux hosts, add 'scsi0:0.writeThrough = "TRUE"' to the .vmx-file of your virtual machine. This prevents VMware from caching the data, forcing it to disk immediately.

Symantec backup Linux agent does not start (on Debian)

Make sure you've installed the "libstdc++5" package.
To check if it'll work, run /opt/VRTSralus/bin/beremote --log-console. Please note that you cannot end that process with ^c.

Enabling GRUB to boot from RAID1 MD /boot device

Make sure your md0-device (which contains /boot) is clean, e.g. not rebuilding.
# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)

Mirror Write Consistency

It seems that Linux doesn't enable a mirror-write-consistency-scheme by default when creating a RAID1 MD-device. You can enable it afterwards with:
mdadm -G /dev/md0 -binternal
Or, if you want to put it on an external device (and not within the md itself - this is prefered for performance reasons):
mdadm -G /dev/md0 -b /dev/MWCBITMAPDEVICE
Also see the mdadm man-page.

SuSE 11 not executing PHP scripts

Check that in /etc/php5/apache2/php.ini short_open_tag is set to 'On'.

EntropyKey on Linux

Do not install ekeyd-uds_*.deb.

Apache ignoring .htaccess

Make sure you add AllowOverride AuthConfig to the <Directory>-statements in the site-definition (e.g. /etc/apache2/sites-enabled/000-default).

Asterisk & SpeedTouch home 546 adsl modem

For it to work you first need to disable the "SIP helper" (which is not helping at all).
Log-in to your modem (usually: telnet and give the following command:
firmware versioncommand
< 5.3nat unbind application=SIP port=5060
config save
>= 5.3connection unbind application=SIP port=5060
After that, reboot the modem.

IBM 9417-HB7 / Lenovo L171P and Xorg

A working monitor-device section would be:
Section "Monitor"
  Option       "CalcAlgorithm" "XServerPool"
  HorizSync    30-81
  Identifier   "MonitorUSB"
  Option       "DPMS"
  VendorName   "ibm lenovo"
  VertRefresh  56-76

Hot adding cpus in VMware

If you hot-add cpus to a vm in VMware, you need to switch them on to be able to use them:
for i in /sys/devices/system/cpu/cpu[0-9]*/online ; do echo $i ; echo 1 > $i ; done

Asus EEE PC 901 & 2.6.30 kernel

When installing the 2.6.30 kernel one might notice that wireless doesn't work. At least on Debian testing of 2006/6/17. This can be fixed with:
apt-get install rt2860-source
tar jxf /usr/src/rt2860.tar.bz2 modules/rt2860/common/rt2860.bin
mv modules/rt2860/common/rt2860.bin /lib/formware

Disabling scrolling with cursor in browser

Occasionally I suddenly had a cursor in my browser which made scrolling a hell. You can disable this by pressing 'F7'. It is called "caret browsing" and is an accessibility feature.

32bit on 64bit Debian

Installing a 32bit package on a 64bit system:
dpkg -X debfile.deb /emul/ia32-linux

bind9/named won't resolve altough zone-files look correct

It seems bind is sensitive for spaces instead of tabs in the zone-files.

"Aangifte 2008" application of Dutch "belastindienst" crashes when downloading known data

  • First install the ib2008-application
  • Surf to and download your .IBV-file ('sofinr.IBV')
  • Create the directory ~/ if it does not exist already
  • Copy the downloaded IBV-file to the ~/ directory
  • Proceed with using the ib2008-application!

Resetting password of a MediaWiki user

MediaWiki is the software behind Wikipedia.
UPDATE user SET user_password = MD5(CONCAT(user_id, '-', MD5('newpassword'))) WHERE user_id = NR
Replace 'NR' by the user_id (and 'newpassword' by the new password of course) of the user from which you want to change the password.

bc rounds off the results down

You can make bc emit more digits by adding 'scale=x; ' to your command.
echo 'scale=4; 2/3' | bc

Re-adding a disk to a md raid1-set after temporary failure

When for example one of the 2 Virtual I/O servers underneath your Linux LPAR crash or reboot etc. your md raid1-set will put the disk in error-state. To recover do the following (/dev/md1 is the raid-set, /dev/sdb6 is the disk served by the faulty VIOS):
mdadm /dev/md1 --manage --set-faulty /dev/sdb6
mdadm /dev/md1 --manage -r /dev/sdb6
mdadm --add /dev/md1 /dev/sdb6

Mounting CIFS/SMB share gives "cannot mount read-only"-error

When mounting a share via CIFS/SMB (a microsoft windows share or samba share) I got the following error:
mount: block device //servername/sharename is write-protected, mounting read-only
mount: cannot mount block device //servername/sharename read-only
The solution was to install the 'smbfs' package.

Play video with repeat

Using Mplayer:
mplayer -fixed-vo -loop 0

Compiling a Debian kernel package using distcc

Distcc enables you to distribute a compilationjob over multiple hosts.
apt-get install distcc
mkdir /usr/local/distcc
ln -s /usr/bin/gcc /usr/bin/g++ /usr/bin/cc /usr/bin/c++ /usr/local/distcc
Then before compiling:
  • export DISTCC_HOSTS='host1 host2...'
  • export CC=distcc
  • export CONCURRENCY_LEVEL=2 (number of compiles to do in parallel)
  • export PATH=/usr/local/distcc:$PATH

Installing Skype 2.0 on 64-bit OpenSuSE 11.1

For installing Skype 2.0 on OpenSuSE 11.1 one first need to install the following packages:
  • libqt4-32bit
  • libqt4-qt3support-32bit
  • libqt4-x11-32bit

Compiling ntp using the NMEA-PPS patch for Linux-pps without fiddeling with include-files

The method described here is not complete, it needs an extra switch added to CFLAGS. Furthermore, it assumes that you first copy some include-files around as described here. That all is not needed.
If you use this:
CFLAGS="$CFLAGS -I/lib/modules/`uname -r`/build/include -I/lib/modules/`uname -r`/build/Documentation/pps \
-I /usr/include -DHAVE_PPSAPI" \
LDFLAGS=-lrt ./configure --prefix=/usr/local/ntp --disable-all-clocks --disable-parse-clocks --enable-NMEA \
all is fine. Ntpd is then installed in /usr/local/ntp.
Then it is just a matter of adding:
/usr/local/sbin/ppsldisc -d /dev/ttyS1 -v                                                                                                                                                       
/usr/local/ntp/bin/ntpd -g                                                                                                                                                                      
to e.g. /etc/rc.local.
You might notice that the ppsldisc included in the linux-pps kernel patch doesn't accept the parameters as seen above, for that use the patch which can be found here.

Firefox & delete upto the first slash in de address bar with ctrl+backspace

To be able to do so, you need to "surft to" "about:config" and then search for layout.word_select.stop_at_punctuation. Then set it to true.

VIA EPIA SN10000EG & frequency scaling

For that, you don't use the acpi-variant (as you do for older EPIA systems) but instead the 'e_powersaver' module.

VIA EPIA SN10000EG system gives errors when doing memtest

It seems that memtest86 v3.4 fails to correctly handle the SN10000EG motherboard. Solution is to use version 2.01.

HTC SPV E650 won't connect via USB to windows in vmware workstation

It seems the HTC SPV E650's implementation of USB is not entirely correct, seen from timing point of view. This very frequently causes windows under vmware workstation not to detect it. It seems that this can be solved by switching off the phone, connecting it and then switching it on.

Monitoring state of IBM Serveraid raid-set using NAGIOS

'smartctl' does not work for this raid-adapter. One can use the output of the 'ipssend' command from the IBM dumplog program.
#! /bin/sh


/usr/bin/sudo /usr/local/bps_monitoring/serveraid/ipssend getconfig 1 al > $TMP

if [ `grep -c "State *: Online" $TMP` -ne 2 ] ; then
	echo CRITICAL one of the disks is not online
	rm -f $TMP
	exit 2

if [ `grep -c "Logical drives/Offline/Critical: 1/0/0" $TMP` -ne 1 ] ; then
	echo CRITICAL logical driver offline/critical
	rm -f $TMP
	exit 2

if [ `grep -c "Defunct disk drive count *: 0" $TMP` -ne 1 ] ; then
	echo CRITICAL one or more defunct drives
	rm -f $TMP
	exit 2

echo OK all fine
rm -f $TMP
exit 0
Please note that you need to add a sudo-line for this to work:
nagios	ALL=(root) NOPASSWD: /usr/local/serveraid/ipssend

Letting bind/named query a specific DNS server for only one specific domain

Add to the file /etc/bind/named.conf.local:
zone "" {
	type forward;
	forward only;
	forwarders {;; };
Of course you need to replace '' as well as the 2 ip addresses in the 'forwarders'-line.

Making postfix only send through 'smart relayhost' when direct connection is not available

I use this construction to have a fallback option when the direct connected ADSL-line is down: replace 'relayhost' in '' by 'smtp_fallback_relay'.

Firefox 3 renders pages incorrect

Add the following to the device-section of your Xorg configurationfile:
	Option "XAANoOffscreenPixmaps" "true"

VMware 6.0.3 (build 80004) on Debian with the 'linux-image-2.6.25-2-686' kernel image

  • install vmware
  • when the script fails (it will), download "vmware-any-any-update117b.tgz" from, untar it (altough the name is .tgz it is a .tar file, so use 'tar xvf') and run the ''-script contained in that tgz file
  • run "CC=/usr/bin/gcc-4.1"
  • when the script has finished, vmware won't start due to an "version 167.0 expected, got 137.0" error: fix this by rerunning(!) the "CC=/usr/bin/gcc-4.1" command

Monitoring Squid with MRTG

One can use this example (mirror) for that. One must, though, add the following to the top of the MRTG-file:
EnableSnmpV3: yes
at least when using recent versions of the Squid proxy server.

Mounting an cifs share gives "mount error 112 = Host is down" error

Mount the share with 'smbfs' instead - at least when mounting from an windows 95/98/me host.

smbclient refuses the '-L' (list shares) command

Simple: place the '-L' switch before the host-address.

snmptrapd suddenly processes no traps at all anymore

Newer versions of net-snmp require that you set a community or else it'll refuse everything.
So add to your /etc/snmp/snmptrapd.conf:
authCommunity log,execute,net public
Now all traps with community 'public' will be allowed.
Check this page for more details.

MySQL: removing duplicate rows from a table

First create a temporary table containing the cleaned-up data:
CREATE TABLE without_duplicates_temp SELECT * FROM original_table GROUP BY columns, that, must, be, unique;
and then just delete the original and rename the temporary table:
DROP TABLE original_table;
RENAME TABLE without_duplicates_temp TO original_table;

Force check of all filesystems after reboot (fsck)

touch /forcefsck

Konig CMP-UPS 650 & NUT

When you have a Konig CMP-UPS 650 you would like to connect to NUT, use the 'megatec' driver.

How to clear the pagecache, dentries and inodes

echo 3 > /proc/sys/vm/drop_caches
Afterwards, echo '0' to this file.

Getting rid of that obsolete delay after password authentication

In Debian, add nodelay to the line with in /etc/pam.d/common-auth.

Installing Debian 4.0r01 on system with an Intel DG965WH motherboard

System is very slow

The solution is very simple: upgrade the bios! The difference in speed is massive. Oh I also switched on HPET timers in the bios.

CD-ROM player not detected

Do a network install!
  • use a complete path for the tftp image, e.g.: "/tftpboot/pxelinux.0" (to prevent error messages about absolute path: "Only absolute filenames allowed")
  • use a dhcp server (bootp doesn't seem to work)
  • install the tftpd-hpa package, the 'normal' tftpd gives the following error: tftp server does not support the tsize option
  • install 'stable' or else no kernel modules will be found, upgrade later if you wish
  • select the 'em64t-smp' kernel package (that is the "intel-amd64")
  • set the partition on which '/boot' resides to bootable! this is required as else the bios won't boot with a "no bootable device" error

Reducing disk-access (and thus saving power)

Mount filesystems with parameters:
  • noatime - do not update inode when a file got accessed or use relatime when it still must be updated somewhat
  • commit=300 - do not flush buffers to disk every 5 seconds (like ext3 does default) but every 5 minutes - only do this when your system never crashes and is on a UPS or a laptop-battery
  • async
Enable laptop-mode with this command:
echo 5 > /proc/sys/vm/laptop_mode
Expire dirty buffers only after a day (same warning applies):
echo 864000 > /proc/sys/vm/dirty_expire_centisecs

Displaying .odt-files (OpenOffice) inline in Mutt

First install the odftools, then add the following to .mailcap:
application/vnd.oasis.opendocument.text; odfread %s ; needsterminal

Backspace does not work

stty erase
after that(!) press ^v and then backspace. Then press enter.

_getpty() fails on IRIX with 'operation not permitted'

Check to see if /usr/sbin/mkpts has mode 4755.

mount -t smbfs gives "smbfs: mount_data version 1919251317 is not supported"

On Debian you then need to install the 'smbfs' package, on RedHat you need 'samba-client'.

Synaptic Touchpad slow on Debian 4.0

Add the following to /etc/X11/xorg.conf (section 'InputDevice', identifier 'Synaptics TouchPad'):
        Option  "MinSpeed"      "1.0"
        Option  "MaxSpeed"      "1.0"
        Option  "AccelFactor"   "0.2"
If it then moves too fast, adjust the 'AccelFactor'.

SpamAssassin 'sa_learn'/updatedb/backups make system unresponsive

Not only can you renice the cpu priority, one can also renice the I/O priority. For this to work you need to use the 'cfq' I/O scheduler and the ionice utility.
Enabling the cfq I/O scheduler:
echo cfq > /sys/block/hda/queue/scheduler
Then create the following script (/usr/local/bin/LP):

/bin/nice -n 40 /usr/bin/ionice -c 3 $*
Now when you want to run some disk-intensive process while not suffering too much, but 'LP ' in front of the command. E.g. 'LP updatedb'.

Force the Linux kernel to re-read a partitiontable

blockdev --rereadpt /dev/device
Do NOT do this on a device where filesystems are mounted from.

Setting the default editor to vi

Current versions of Debian have the nasty habbit of using some non-vi-compatible editor for editing crontabs etc. This can be corrected using "update-alternatives --config editor".

Fixing time-management in vm-instances on VMware

Install the VMware tools in the guest os, then in the .vmx-file set the following parameters to TRUE:
  • tools.syncTime - sync periodically
  • time.synchronize.continue - sync after snapshot
  • time.synchronize.restore - sync after reverting to a snapshot
  • time.synchronize.resume.disk - sync after resume
  • time.synchronize.shrink - sync after defragmenting a virtual disk
Do NOT run any other timekeepers in the guest operating system! (like the W32Time service on windows and the NTP daemon on UNIX systems).
Read this pdf (written by VMware) for more details and background information.

X11 forwarding over SSH on a Debian system does not work

Make sure that in the file /etc/ssh/sshd_config the parameter X11Forwarding is set to yes. Also you need 'xauth' which is in the xbase-clients package.

Backup to LTO3 tapestreamer performs very slow

When using cpio the default blocksize is 512 bytes. Now the more or less optimal blocksize for an LTO3 tapestreamer is 256KB. So a better performance can be achieved by adding '--block-size=512': this lets cpio backup using 512 blocks of 512 bytes(!).

During installation of the IBM Websphere application server cannot be found

On RedHat, install the xorg-x11-deprecated-libs package.
On Debian, install the libs/libxp6 package.

apt-get (from Debian) suddenly segfaults

Delete the file '/var/cache/apt/pkgcache.bin' and re-run 'apt-get update'.

NAT stopped working after upgrading Linux kernel to 2.6.20

Edit the .config in the kernel source directory and set CONFIG_NF_CONNTRACK_ENABLED to either 'y' or 'm'.
After that, run 'make oldconfig' and rebuild your kernel and its modules.

Optimizing Perl

First run the script with profiling enabled:
perl -d:DProf
then run the profile-dumper:
dprofpp tmon.out

Copy (duplicate) a two-dimensional array in Perl

@target = map [map $_ = $_, @{$_}], @source;

Optimizing a site with Mambo for search engines

The default urls of Mambo are not compatible with search engines. This causes only(!) the front- (first) page of your website to appear in search engines like Google. The following settings solve this.
In the file configuration.php (in the root of your Mambo setup), change the following line:
$mosConfig_sef = '0';
$mosConfig_sef = '1';
To make this work you MUST also add the following to the .htaccess file in the root of your Mambo setup:
RewriteEngine On
RewriteRule ^content(.*) index.php
RewriteRule ^component/(.*) index.php

Speeding up Firefox

"Surf to": about:config and set the following parameters:
browser.blink_allowed false
layout.frames.force_resizability true
network.http.pipelining.maxrequests 10
network.http.pipelining true
network.http.proxy.pipelining true
network.http.max-connections 64
network.http.max-connections-per-server 21
network.http.max-persistent-connections-per-server 8

Really slow bittorrent downloads

Sometimes bittorrent downloads go really slow, even when the upload-rate is at its maximum. Now that is also the cause of the slow download: if the upstream is saturated, the acks for the download-packets are delayed enormously. Solution: limit the upload-rate to a few KB below your maximum upload-rate.

Preventing webserver hackers from connecting to IRC servers

Sometimes when a user runs some picture-gallery or forum software, your server gets more or less hacked: a hacker will start under the user with which your webserver runs ('www-run' for example) an ircbot. You can prevent this with this:
iptables -I OUTPUT -m owner -p tcp --destination-port 6660:6669 --uid-owner nobody -j REJECT
This will not work if the hacker runs his/her irc-server on a different portnumber then the ones blocked.

Enabling remote X in Fedora 2/3/4

In /etc/X11/gdm/gdm.conf change the line with DisallowTCP=true in it to DisallowTCP=false.
Then restart X. Don't forget to adjust your firewall.

Allowing remote X

On the server execute this:
/usr/X11R6/bin/xauth list :0 | awk '{ print $NF }'
remember that output then on the client to this:
export DISPLAY=__hostname_of_your_X_server__:0
xauth add __hostname_of_your_X_server__:0 . __output_of_previos_command__

Debugging an application that expects data via STDIN

# create a named pipe: mkfifo mypipe # pipe your applications input into that named pipe: cat data > mypipe & # run gdb: gdb application # then in gdb: run < mypipe

Disabling the 'accesskey' html-option

Certain sites, like remap the ALT+F key to their find menu. I find this annoying. To disable this behaviour in firefox, surf to 'about:config' and double click on 'accessibility.accesskeycausesactivation' (which sets it to false).

Using a TER-GX102 S GSM-modem with smstools

In the configurationfile put:
mode = ascii
Leave everything else to default-mode.
Don't forget to enter phonenumber is international format (with countrycode) without the '+'!

Curl always failing with errorcode 52

When curl always fails with errorcode 52 also for sites that are available, add '-A curl' to the commandline.

Letting Firefox open new windows in a new tab instead

In the address-bar, enter "about:config", then search for "browser.tabs.showSingleWindowModePrefs". Double click on that line so that it becomes 'true'.
Then open the preferences menu from the menu-bar. Go to "advanced" and then search for "Tools": below there you can find "Force links that open new windows to open in...", click the radio-button before "a new tab".
With these settings all new windows will go to a new tab unless it has features like different size or no toolbars. If you also want these kind of windows to be opened in a tab, go back to "about:config" and search for "". When found, set it to "0".

VPND across tor

It is possible to have a VPN accross a Tor anonymous network. For that you need vpnd which limits this 'trick' to the platforms supported by vpnd which are currently Linux and FreeBSD. You also need tsocks.
On the server, you have a file vpnd.conf which looks like this:
mode server
keyfile vpnd.key
randomdev /dev/urandom
keepalive 300
pidfile /var/run/
noanswer 3
mtu 576
sendbuf 3072
The local and remove address are the addresses used in the vpn. You also need to change the 'server'-line.
On the client you have something like this:
mode client
keyfile vpnd.key
randomdev /dev/urandom
keepalive 300
pidfile /var/run/
noanswer 3
mtu 576
sendbuf 3072
Of course, the portnumber in the server line as well as the ip-address should match with what you configured on the server side. Also make sure that 'local' and 'remote' match!
After that, create a (shared) key which you will need to transport safely from the server to the client. Use an PGP encrypted e-mail for example.
Starting the vpn on the server is only a matter of:
and on the client you type:
tsocks vpnd
Don't forget to edit tsocks.conf so that it points to your tor-client!
server =
server_type = 5
server_port = 9050
You may need to change the server ip-address (if the tor-client runs on an other box then the box running the vpnd-server) as well as the port-number.
Warning: make sure that you use ip-addresses as long as tsocks doesn't support socks 4a as otherwhise you will still send out a (non-anonymized) DNS request!

Postfix annoyances

Postfix refuses to deliver to a mailbox > 50MB

Set 'mailbox_size_limit' to some other value:
mailbox_size_limit = 2147483648

Postfix refuses e-mails > 10MB

Set 'message_size_limit' to some other value:
message_size_limit = 2147483648

Postfix refuses to deliver mail while there's plenty diskspace left ('452 Insufficient system storage')

Set 'queue_minfree' to some other value:
queue_minfree = 2024000
WARNING: 'queue_minfree' must be at least 1.5 x the 'message_size_limit'!

Changing size of gnuplot images

You for example enter this in your gnuplot script:
set term png
replace that by for example:
set term png size 1024,480

Running minimalist from procmail

  • create user 'mlist'
    in /etc/aliases, set:
    minimalist:     mlist
    listname:       mlist
  • in /home/mlist/.procmail put:
    * ^To:.*minimalist
    * !^X-Loop:.*minimalist
    * !^From:.*postmaster
    | /usr/local/sbin/
    * ^To:.*listname
    * !^X-Loop:.*listname
    * !^From:.*postmaster
    | /usr/local/sbin/ listname

Run several fetchmail mail retrievals in parallel

Fetchmail doesn't have a standard way of retrieving mail for multiple servers at the same time. With this script you can do so:

cd ~
for i in `grep -e "^ *poll " ~/.fetchmailrc | awk '{ print $2; }' | sort -u` ; do \
	(mkdir -p .$ ; FETCHMAILHOME=.$ fetchmail -f ~/.fetchmailrc $i &) ; done
For it to work, your .fetchmailrc should look like this:
poll servernickname via hostname:

Calculating effective bitrate for ADSL

IP-traffic is tunneled over ATM when using ADSL. So you won't get the exact 2Mbit or what ever your ISP tells you you have.
To find the real bandwitdh: divide by 9.6 and then multiply by 8.

CPAN modules fail to compile

Then you're probably on a RedHat >= v9 system.
Do this:
export LANG=C
and retry.

complaints of grsecurity-kernel about RLIMIT_CORE being 0

If, while running program x, a segmentation fault occurs in program x and syslog outputs the following string:
Apr 17 11:55:06 yyy kernel: grsec: attempted resource overstep by requesting 4096 for RLIMIT_CORE against limit 0 by (x:z) UID(y) EUID(y), parent (y:y) UID(y) EUID(y)
then kernel tried to write a core-file for the program x to disk, BUT the max size of the core file is set to 0.
Growing the maximum size of a core file:
ulimit -S -c 8192

GCC (ld) complains: ld: Undefined symbols: ___gxx_personality_v0

Add the following to the line with LDFLAGS=:

Enabling root-access on MacOS X

It is o-so-trivial:
passwd root
and enter the new root-password twice.

KDE only using TrueType and Type1 fonts after upgrade to 3.1.3

After upgrading KDE from version 3.1.2 to 3.1.3 (in Debian), KDE suddenly only used TrueType and Type1 fonts. If you have only a limited set of fonts, this is a bit of a nuisance since everything might look a little odd then. If this is the case, check that you have switched off 'Anti Aliasing' in the font-menu of the KDE-control center. If it is off and things look still weird (after restarting KDE!) check the file /etc/fonts/local.conf and uncomment the following line:
  <!-- <dir>/usr/X11R6/lib/X11/fonts</dir> -->
it should then look like this:
After that, run the following command and restart KDE:
fc-cache -f -v

NFS shares get stale after a while or don't mount at all

This might be caused by the fact that the server really wants to have portnumbers below 1024 for the session. Adding insecure to the exports-file fixes that.
/home	somehost(rw,insecure)

Postfix (+ fetchmail) complains about mail-loops

When retrieving your e-mail for your domain to your local system with fetchmail via PostFix, mail seems to get bounced.
If the system you're receiving the mail from uses QMail or PostFix to process your mail, add:
to the end of the line saying something like:
	user 'username' there with password 'password' is * here options ... dropdelivered

'apt-get' (Debian) says "E: Dynamic MMap ran out of room" and bails out

Create a file /etc/apt/apt.conf and put something like:
Apt::Cache-Limit 67108864;
in it. If it still fails, make that number higher.

"Girotel" with Konqueror

When you want to do your banking stuff in Girotel with Konqueror:
  • Disable Java
  • In "browser identification", set for the following sites the identity to "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)":

Displaying a man-page in ASCII

man ManName | col -b > ManName.txt

Get a Perl-module from CPAN

The easy way which also automatically fetches all modules needed by the module:
perl -MCPAN -e 'install modulename'
perl -MCPAN -e 'install WWW::Search'

nfs mounts mysteriously failing

When you get the following error:
rpc.mountd: refused mount request from x.x.x.x for /something (/): no export entry
make sure the nfs-server can resolve the hostname of the client-system.

Hard to find bugs in scripts

To switch on tracing:
set -x

`at' not doing anything when running seti@home

Run atrun with -l <number of seti@home instances>.
If you're running for example 2 instances of seti@home (or something similar), do:
atrun -l 2.0

domain lookups returning SERVFAIL

Say you've setup a DNS for your domain. You did everything like the HOW-TO told you.
But for every query you do, you get something like "** server can't find hostname: SERVFAIL".
Then add the following:
to the top of your zone-file and restart bind (named).

Handling files > 2GB

In your source, before all the #include-statements, put the following:
Use open64, create64, lseek64, etc.
When you want to printf an offset, use the following:
printf("%lld", offset);

Creating a shared library

First, compile your C-code:
cc -fPIC -O -c file.c -o file.o
Then, create a .a-file:
ar -r libname.a file.o
and finally, create the shared library:
ld -x -shared -soname -o --whole-archive libname.a

Windows user gets message when printing through Samba

Add the following command to the printer-section:
print command = echo `date` print job queued: %p %s | tee -a /dev/tty11 \
	| smbclient -M %m 2>&1 > /dev/null ; lpr -r -h -P %p %s

Building a Linux-kernel on an Alpha

The magic command is:
make boot modules modules_install
Output-image is in arch/alpha/boot/vmlinux.gz.
Also, see:

System acting funny after updating GLIBC

I found that after updating glibc and things, multiple programs started acting funny: Apache+SquirrelMail denying all logings, nmbd segfaulting, etc. etc. Stopping those processes and restarting them didn't seem to help. The only "solution" I could find was... a reboot! Very very strange. If anyone knows what I forgot to do (yes, I ran ldconfig) please tell me:

inetd[xxx]: getpwnam: root: No such user

So you decided to upgrade glibc to the latest and greates version, but now suddenly inetd gives this strange error in syslog and you don't seem to be able to, for example, pick up your mail through pop3. The solution is this: in /etc/nsswitch.conf replace "compat" to "files" for the following three entries:
passwd:         files
group:          files
shadow:         files

Reducing the frequency of disk-writes

I found that my Linux-system was way to noisy for my bedroom: almost every 5 seconds it was writing to disk. I found 2 solutions:
1. use noflushd, but I didn't like that: it also spins down the harddisk which reduces the lifetime of your harddisk
2. fiddle around with mount-options and kernel-parameters
For the last option, I did 2 things: in /etc/fstab I added 'noatime' to the options of the mounted partition:
/dev/hda2       /       ext3    defaults,noatime  1 1
and I set some parameters which make disk-reads occur as soon as (reasonably) possible and disk-writes only when all buffers are at their limits:
echo "90 500 0 0 600000 600000 95 20 0" > /proc/sys/vm/bdflush
/sbin/elvtune /dev/hda -r 2048 -w 131072
Warning: don't use these settings if your PC is not reliable and crashes often or when power-outtages occur frequently!

Comparing files & taking some action based on outcome

Method 1

cmp -s file1 file2 || {
  # do something

Method 2

cmp -s file1 file2
if [ $? = 1 ]
  # do something

Configuring a WIFI-setup

When you want to change the channel or baudrate or something, first bring down the interface. I found that otherwise the changes are most of the time(!) ignored.
ifconfig ethx down
iwconfig ethx ...
ifconfig ethx up

Configuring TINC for a VPN

Tinc can be kind of hard to setup when you're new to it; the manual is just way to elaborate. For the impatient, I wrote a very small howto. You can find it here: tinc_mini_howto.html