It's not possible? Says who?

Simple local catch-all mail server

without comments

You don’t need “real” mail delivery on your machine?

But you want to receive e.g. status mails from cron?

You want to get all mails originating from localhost, regardless of the recipient, so you can detect services and programs gone rogue?

Try OpenSMTPD. There’s a package for Arch Linux, here’s the manual and here’s my config (/etc/smtpd/smtpd.conf):

# To accept external mail, replace with: listen on all
listen on localhost
# map any recipient to my user account
table catchall { "@"="johnlate" }
# "listen on localhost" should already take care of this
reject from ! local
# apply catchall mapping
accept for any virtual <catchall> deliver to mbox
# default rule, if I ever change the catch all mapping
reject for any

Written by johnLate

October 20th, 2015 at 1:08 am

Posted in Uncategorized

Clipboard sharing over VNC broken? (Linux server)

without comments

I use ‘vnc4server’ on an Ubuntu machine. After some recent update ‘vnc4config’ refuses to start and clipboard sharing with clients (Windows, UltraVNC in one case) does not work.

Apparently the problem is this: vnc4server syncs the “cutbuffer”, but most applications use “Selections” (“PRIMARY” and “CLIPBOARD”); somehow this reminds me of XKCD #927. For a better explanation and a solution go to the autocutsel website:

Written by johnLate

February 1st, 2013 at 1:24 am

Posted in Uncategorized

VGA passthrough to a Xen HVM DomU (Windows 7; Dom0: Arch Linux)

with 3 comments

I don’t like dual boot solutions to switch between Windows and Linux. I’m considering to put Windows into a virtual machine. However, the main reason to keep Windows at all is occasional gaming. Therefore I did a quick & dirty Xen installation to figure out whether this is a viable option for me.

Here are my notes:

  • basic Arch installation using archlinux-2012.12.01-dual.iso
  • as usual, the arch wiki pages were helpful: Official Arch Linux Install Guide, Unofficial Beginners’ Guide, Xen
  • installed xen-hg-unstable using packer
  • used lsusb -t to figure out which usb devices are connected to which root hub
  • used lsusb -v to get PCI-ID (iSerial) of that hub
  • to unbind a device from its driver and make it available for passthrough:
    • echo $ID > /sys/bus/pci/device/$ID/driver/unbind
    • echo $ID > /sys/bus/pci/drivers/pciback/new_slot
    • echo $ID > /sys/bus/pci/drivers/pciback/bind
  • after unbinding the VGA adapter: blank screen – therefore: ssh!
  • created a qcow2 Container for the guest system
  • config file for the VM:
  • name="windows"
    disk = [
    #       "/dev/sda,,hdb,w",
    vif=[ 'bridge=xenbr0' ]
    pci=["00:02.0", "00:1a.0", "00:1b.0"]
  • VNC just shows “serial0 console”, but delivers mouse events!
  • lspci:
  • [...]
    00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
    00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
    00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
  • 00:02.0 is Intel HD Graphics 2000 (from a Core i5-2500T)
  • 00:1a.0 has a keyboard and a mouse attached to it
  • the VM went into standby once, waking it up with ‘xl trigger windows s3resume’ resulted in a bluescreen -> disabled standby in Windows

I installed drivers from the Intel website for the graphics adapter, everything else worked fine out of the box.

To test the performance I used the “Windows Experience Index” and StarCraft II, once in the VM and once in a similar installation running directly on the same hardware:
I combined three screenshots here… left to right: running without Xen; Xen (vcpus=2); Xen (vcpus=4). The degraded hard disk performance is probably due to using a container file instead of a real partition. Apart from the memory operations the results are quite good.

StarCraft II was running at 1920×1200 “Windowed (Fullscreen)”, low settings. I chose one of my last replays, about 20 minutes long, set it to follow the camera of the other player and used Fraps to measure the performance:

[FPS]  min   max   avg
VM:     19    60    41.160
real:   21    60    45.109

For a quick and dirty proof of concept this was quite successful. Next will be an attempt to do VGA passthrough on another machine with a NVidia GeForce GTX560Ti, but I don’t know when I will find time for that, yet.

Written by johnLate

December 17th, 2012 at 1:40 am

Posted in Uncategorized


without comments

I recently needed to compile a proprietary kernel module for a different kernel than was currently running. There were multiple Makefiles involved and several references to header and kernel object directories based on “uname -r”.

Why didn’t I just boot the target kernel version? Well, the module is a driver for a specific device required for a certain service. Rebooting into the new kernel before building the new module would have caused more downtime for the service.

As I didn’t want to carefully edit several Makefiles and other files, I did a quick web search and found fakeuname. It worked fine and enabled me to fix some other unexpected compile errors, before shutting down the service. So I didn’t need to manually tamper with the version detection and still had minimal service downtime.

Written by johnLate

May 7th, 2012 at 1:11 am

Posted in Uncategorized

Arch: post installation; herbstluftwm, flash

without comments

Using the Beginners’ Guide and the Xorg wiki pages, installing X is not very hard. I just installed the required packages with pacman.

Then I needed a window manager. I chose herbstluftwm, which I haven’t used until now. Thorsten, the author, studies at the same university as I and I think it’s a cool project. As I’m trying out new stuff anyway, the decision was a no-brainer.

I installed herbstluftwm-git via yaourt. I copied the example configuration files from /etc/xdg/herbstluftwm to ~/.config/herbstluftwm and created a .xinitrc.

Launching X with startx worked at the first attempt. chromium and flashplugin also were easy to install. Just sound didn’t work right away, which I solved by consulting the Advanced Linux Sound Architecture (ALSA) wiki page.

But fullscreen flash didn’t work right away. Read the rest of this entry »

Written by johnLate

March 31st, 2012 at 2:45 pm

Posted in Uncategorized

First steps with Arch Linux

without comments

Core message (aka “TL;DR”): If you’re new to Arch Linux, start with:

those pages will probably save you a lot of time and frustration.

I finally decided to try out Arch Linux. I did the base install a few days ago. A bunch of unrelated stuff has happened since then, so I hope I recall the following correctly.

As always when trying out new stuff, I could rely on my talent to immediately run into some issues. Read the rest of this entry »

Written by johnLate

March 27th, 2012 at 10:50 pm

Posted in Uncategorized

Quick & Dirty git statistics (commits, insertions, deletions)

with one comment

Need to know who made how many commits and how many changes in your source tree?

Here’s a quick and dirty way to generate such statistics:

perl -e 'foreach(`git shortlog -s -n`){'\
'foreach(`git log --author="$a" --pretty=tformat: --numstat -C`)'\
'printf "%5dc %8d+ %8d- %s\n",$c,$p,$m,$a;}'


   72c    26183+     2506- Bob Byte
   20c     1270+      104- Jim Vim

Written by johnLate

January 31st, 2012 at 8:30 pm

Posted in Uncategorized

Creating a custom keyboard layout for Windows

without comments

I recently switched from a keyboard with German layout to one with US layout. But I still need German umlauts and other special characters.

US International seemed to contain everything I needed. There was just one annoying problem: Dead keys.

In Ubuntu this was no problem, there is a “US Intl. – no dead keys” layout.

I didn’t find this layout in Windows. But Microsoft provides a tool to create own keyboard layouts, The Microsoft Keyboard Layout Creator.

With this tool you can open existing layouts and modify them. Have fun.

Written by johnLate

October 5th, 2011 at 6:31 pm

Posted in Uncategorized

Cracking a BIOS password

with 2 comments


Someone in my family owns an older laptop, but they have lost the BIOS password. You can boot into Windows XP, but you can not enter the BIOS Setup (e.g. for changing the order of boot devices) without password.


I found a tool called CmosPwd which tries to decrypt BIOS passwords. However, there was a problem: it only runs on DOS.  Therefore I took a DOS boot floppy disk image and added CmosPwd to it (you can use e.g. MagicISO to edit floppy images).

But how to boot a floppy disk image when the machine boots directly into Windows XP?  You can instruct the NTLDR (XP’s bootloader) to boot Grub4DOS instead of the Windows kernel and use Grub4DOS to load the floppy image into memory and boot from it. Copy the floppy image, grldr from Grub4DOS to C:, edit your boot.ini and create a menu.lst.

Finally you just need to reboot the machine, select Grub4DOS in the boot menu, and run cmospwd.

Written by johnLate

September 9th, 2010 at 8:27 pm

Posted in Uncategorized

Installing XenServer 5.5 on a remote machine (gPXE + HTTP)

with 7 comments


Imagine you have a remote machine several kilometers/miles away. It is running Linux and you have root access via ssh over the internet. But you can not operate the BIOS screen or any regular installers (because you have no access to keyboard-in or VGA-out). Furthermore, the machine is not configured for booting from network. The currently running Linux installation is no longer needed and you have to install XenServer.

There is a section “PXE installation” in the official manual, but that requires setting up or reconfiguring a DHCP server and a TFTP server. But what if there is no DHCP server in that network or if you have no access to it? Let’s do this with a fixed IP and just an HTTP server.


Imagine something goes wrong: Especially if you have to drive all the way to the server or call and pay someone to reboot it, you should test everything on another machine you have physical access to.

Battle Plan: automatic installation

  1. Store the installation data on a HTTP server
  2. Provide the installer with an answer file, so it does not require user input.
  3. Modify the installation image to fix some issues regarding the use of a static IP.
  4. Setup the network bootloader
  5. Reboot the remote machine / start installation

Read the rest of this entry »

Written by johnLate

April 24th, 2010 at 5:30 pm

Posted in Uncategorized