You should be able to read the key press events from one of the /dev/input/eventX files. Try running evtest http://manpages.ubuntu.com/manpages/precise/man1/evtest.1.html The /dev/input interface should let you grab the events before they get seen by X11 / xkb so it would work in a headless setup as well.