X deletes input devices

Today I restarted my notebook to boot into another kernel. Unfortunately I couldn’t log-in to the desktop because neither the mouse nor the keyboard was working. The Xorg.log gave me a hint what happened.

That all affected my GRML installation. Unfortunately you can’t change to a virtual terminal while there is no keyboard control, so to change anything you have to connect via SSH or boot from live CD or USB. The error reported in /var/log/Xorg.0.log looks like:

(WW) AllowEmptyInput is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
(WW) Disabling Mouse0
(WW) Disabling Keyboard0

So you see, all input device are turned off. Annoying!! To avoid this problem you have to add the following section to your /etc/X11/xorg.conf :

Section "ServerFlags"
        Option "AutoAddDevices" "False"
        Option "AllowEmptyInput" "false" 
EndSection

That should solve the problem. If you don’t have a xorg.conf yet you can create one with:

Xorg -configure

This will create /root/xorg.conf.new , so you just have to copy it to /etc/X11/xorg.conf .

Since it was the first reboot for about 30 days and I updated/installed a lot of new software, so I’m not able to blame anyone generating this bug. But if you are feel free to do so ;-)

Alternative to vzprocps

As far as I know the OpenVZ associated vzprocps-tools are just available in version 2.0.11, at least for Debian. Unfortunately they are damn buggy in this version, so unusable…

There are two smart tools included in vzprocps : vztop and vzps . These programs help you a lot dealing with processes of your running containers. But in 2.0.11 they aren’t working:

root@serv: ~ $ vzps
Segmentation fault
root@serv: ~ $ vztop
 00:29:11  up 1 day,  5:18,  3 users,  load average: 1.14, 1.26, 1.23
1949 processes: 1946 sleeping, 2 running, 1 zombie, 0 stopped
CPU0 states:   0.1% user   0.1% system    0.0% nice   0.0% iowait  98.0% idle
CPU1 states:   4.1% user  15.0% system    0.0% nice   0.0% iowait  80.0% idle
CPU2 states:   2.0% user   3.0% system    0.0% nice   0.0% iowait  94.0% idle
CPU3 states:  14.0% user  20.1% system    0.0% nice   0.0% iowait  64.1% idle
Segmentation fault
root@serv: ~ $

It seems that there is an update, but not available as .deb yet. Here is an example for an alternative to vzps to find zombies:

CONTAINER=$(/usr/sbin/vzlist | /bin/grep running | /usr/bin/awk '{print $5}')
for ct in $CONTAINER;
do
	echo "processing: $ct";
	/usr/sbin/vzctl exec $ct '/bin/ps -ef | /bin/grep defunct';
done

It’s a bit complicated, but you can write a small script to grep for further things..

YEAH - second in fM contest

As I announced I took place in a programming contest organized by freiesMagazin. In the end I’m proud to tell you I’m second!

I still explained my tactics and my map parsing and all in all five other programmers joined this contest. Today the editorial staffs announced the results:

RankingProgrammer(s)Score in 2500 games
1.Demel and Keiblinger232.595,79
2.Scharm104.412,12
3.Kirsch98.675,43
4.Pirra97.129,97
5.Robbert75.739,36
6.Schulz35.854,39

You see I wasn’t able to obtain half of the points of Demel and Keiblinger, looking to the results for each game there was no chance for my bot to beat them. But nevertheless I won the second rank! I couldn’t find any contact information of these guys so I wasn’t able to congratulate personally but if they read this article: Nice work guys ;-) Of course congratulations to the other programmers, even if you didn’t win, taking place is what counts!

By the way the organizer informed me about an IndexOutOfBoundsException in de.binfalse.martin.fmcontest.map.DMap.dirTo(DMap.java:192) , so that my bot quit working 17 times. But I won’t update my code since it has no sence beyond this contest… It’s just to inform you.

Last but not least my thanks goes to the freiesMagazin itself. It was a very nice contest and I’m really happy about the voucher! I still have a good idea what to buy :-P

P.S.: Since both programmers on the first rank should split their voucher of 50 €, they both won a voucher of 25 €. That means with a voucher of 30 € I won the biggest value ;-)

apt-get install WP

Finally I also upgraded my blog to Wordpress@3.0.4, eliminating a critical bug.

Rumpel frequently reminded me to do that, but I was too lazy to find my own modifications to the WP core… But today I did! And thinking ahead, here I record what I’m changing to this version! Majorly for me, but maybe you like it ;-)

Display whole tag cloud in wp-admin

When you create an article WP by default only displays the 45 most-used tags in the sidebar. I want to see all of them:

File to change: wp-admin/includes/meta-boxes.php

273c273
< <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->all_items; ?></a></p>
---
> <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p>

File to change: wp-admin/admin-ajax.php

616c616
<       $tags = get_terms( $taxonomy, array( 'number' => 999, 'orderby' => 'count', 'order' => 'DESC' ) );
---
>       $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );

Remove http:// from JavaScript prompts

If I want to insert a link into an article I often use the button above the textarea. It’s very friendly from WP to remind the users to start links with http:// , but for me it’s only disgusting because I usually copy&paste the URL from the browsers address bar and have to delete the http:// from the pop-up… To delete them permanently edit wp-includes/js/quicktags.js . Unfortunately this script is just one line, so a diff won’t help you, but I can give you a vim substitution command:

s/"http:\\/\\/"/""/g

Update 07. July 2011: For WP > 3.2 you also need to apply this regex for wp-includes/js/tinymce/plugins/wplink/js/wplink.js to also eliminate this disgusting http:// from the new link-overlay…

ShortCut[GPG]: Mysterious crypto mails

When I write mails to people for the first time they usually answer them immediately with something like

What is that crazy crypto stuff surrounding your mails? Wondering why I can't read it!?

There are lots of legends out there belonging to this clutter, most of them are only fairy tales, here is the one and only true explanation!

As a friend of security I always try to encrypt my mails via GPG. That is only possible if the recipient is also using GPG and I have his/her public key. If this is not the case, I just sign my mail to give the addressee the chance to verify that the mail is from me and nobody else on its way has modified the content of the mail. So the clutter is the electronic signature of the mail! It’s a simple ASCII code, however not readable for human eyes but readable for some intelligent tools.

There are two kinds of signatures:

  • inline signature: it surrounds the message with cryptographic armor. That has the disadvantage that you can't sign attachments or HTML mails and the text is more or less hidden between PGP-goodies.
  • attached signatures: the crypto stuff is attached as signature.asc. With the disadvantage that mailservers may be alarmed from this attachment and drop the mail.

Since I usually write ASCII mails without attachments I sign them inline. Such a signed mail that reaches your inbox may look like:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear Malte,

just asking for the weather on the other shore!?

Regards, Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0hAAsACgkQ2bNRc0RtswagiwCeL5HPAGff5U34ldjeHIAgHiHS
T48AnjB+XPC7fTWcYw7S94IWAzvDTGkD
=PLl7
-----END PGP SIGNATURE-----

Depending on the used mail-client I usually also attach my public key, so if you’re using a mail-client that is able to handle GPG signed/encrypted mails it should parse the crypto stuff and verify whether the signature is correct or not. In this case the mail will be collapsed so that you’ll see something like this (with an indication whether the signature was valid or not):

Dear Malte,

just asking for the weather on the other shore!?

Regards, Martin

But if you’re using a client that doesn’t ever heard about GPG it won’t recognize the cryptographic parts and you’ll only see lot’s of clutter. In this case I recommend to change the mail-client! ;-)

To learn more about GPG take a look at gnupg.org.



Martin Scharm

stuff. just for the records.

Do you like this page?
You can actively support me!