Archive for the ‘work’ Category

Using virtio console with KVM

Tuesday, October 23rd, 2012

Yesterday I finally figured out how to use the virtio console on KVM, which is very easy once you know what to do.

A short explanation of what a “virtio console” is:
On paravirtualized environments like Xen the VM (guest) has no direct hardware access, but also no emulated hardware but instead needs special drivers that know it is running on a hypervisor. The advantage of this approach is that you don’t need to emulate hardware and that the driver for the guest is often much simpler (it does not need to probe hardware, for example, as it talks to the hypervisor via a special interface). This makes for a very convenient default Xen setup where you can just do “xm console ” on the hypervisor and get a functional console without any fiddling.
On fully virtualized environments, usually an emulated serial port is used for that, which is harder to set up. It is not impossible, but definitely not that easy and there is quite some stuff to configure to get it working.
Nowadays even fully virtualized systems often have some paravirtualized drivers available, mostly for performance reasons. One of those paravirtualized drivers available with KVM is the virtio console driver.

So back on topic: how to set up the virtio console driver for a KVM guest
First, edit the configuration of your guest, in my case with “virsh edit factorytest” (factorytest is the name of my guest). Add the following snippet of configuration before the closing “</devices>” tag:

    <console type='pty'>
      <target type='virtio' port='0'/>
    </console>

Then a few things need to be done on the KVM guest. In my case of an openSUSE 12.2 guest, the virtio_console module was loaded automatically. However, it surely won’t hurt to put it into INITRD_MODULES in /etc/sysconfig/kernel.
The second thing is “console=hvc0″ needs to go onto the Kernel command line.
The easiest way to accomplish this is to use the YaST bootloader module and add it in the “Boot Loader Options” tab. You need to actually make sure there is “console=tty console=hvc0″ there, because without the “console=tty” the system did not boot up cleanly for me. I guess that the kernel is not happy with only a console that gets added later via a module, but I need to investigate that.

All the rest was handled by systemd and friends just fine, after rebooting the VM guest, I was immedately able to do “virsh console factorytest”, hit “Enter”, get the login prompt and log in.

Kdump Talk / Paper

Thursday, May 24th, 2012

This time in english :-)
Tomorrow I’m holding the kdump talk at LinuxTag in Berlin, and since I had submitted it in english, I had to translate my short paper anyway, so here it is. It is a rather short “beginner’s guide” but it should get you started. And it’s much better than the slides as there is almost no technical details in them due to the short timeslot (30 minutes) I got.

Kdump Vortrag / Paper

Sunday, March 18th, 2012

(German only, the paper is also only available in german right now).

Zur Zeit halte ich Vorträge über kdump, unter anderem auf dem GUUG Frühjahrsfachgespräch 2012 und den Chemnitzer Linuxtagen 2012.

Da die Dauer der Vorträge meist auf ca. 45 Minuten begrenzt ist, enthalten die Vortragsfolien nur wenig technische Details. Für den Tagungsband des FFG 2012 habe ich jedoch einen Artikel geschrieben, der als Einstieg in das Thema besser geeignet ist. Diesen Artikel gibt es hier.

Viel Erfolg!

If you don’t want to fight package maintainers…

Friday, December 23rd, 2011

…then work around the bug.

One example is bug 699400: hwclock is never set correctly when NTP is used (unless it was almost correct before…).

I reported the bug, I argued with the maintainer, it did lead to nothing, the bug was “RESOLVED INVALID” (interesting notion: either it is resolved or it is invalid, then there is nothing to resolve…)

What’s my workaround? I exploit the fact that old SysV init uses bash scripts. The init script which sets the clock does source /etc/sysconfig/clock. Internally, it uses a variable ELEVENMIN_MODE.
So what did I do? Simply add

readonly ELEVENMIN_MODE=no

at the end of /etc/sysconfig/clock.
The script will throw some errors on boot and shutdown due to its inability to change a readonly shell variable, but I can live much better with a harmless warning than with a totally wrong system time at each reboot :-)

Update: Werner has pointed out in the bug that this is totally wrong and will make a mess of your time settings, so use this at your own risk. OTOH I have more than 2000 productive systems here running with this. We had lots of problems before and have no problems anymore after doing it like described here. So at least for me the wrong solution works good.

openSUSE 32bit to 64bit live conversion

Friday, February 25th, 2011

Kids, don’t try this at home.
Anyway, here is what worked for me:

  • add arch = x86_64 to /etc/zypp/zypp.conf
  • zypper ref -f
  • rpm -qa kernel*
  • zypper in -f kernel-default kernel-default-base (the kernel packages found by the step above)
  • mkinitrd
  • reboot
  • zypper in -f glibc
  • zypper in -f rpm Attention: don’t install, just resolve everything and get the list of -32bit packages that would get installed
  • zypper in -f file-32bit libbz2-1-32bit… Install all the -32bit packages that were selected in the previous step
  • zypper in -f rpm
  • zypper dup --no-recommends --download-in-advance
  • mkinitrd
  • reboot

Whenever zypper asks you for conflict resolution (which will be every single case), select the option that involves “change architecture”, never select “break …” or “do not install …”. There should be no “uninstall…” proposal in the summary before confirming, only architecture changes and newly installed -32bit packgages.

There were some failing postinstalls for glib and other libraries, which could probably have been avoided by more carefully updating in intermediate steps, or by installing some -32bit library packages before the “dup” step, but the resulting system seems to work just fine.

Making Windows Usable

Saturday, February 5th, 2011

If you ever have to use Windows, and are accustomed to “focus follows mouse” as I am, you might find this description useful.

I’m citing the important part here, to let me find it more easily:

Believe it or not, Windows does support focus-follows-mouse, though there is no GUI configuration exposing it. Instead you must edit a registry key and then log out and back in for the change to become effective. You can use regedit to edit the key.
[...]
you need to change a binary-valued registry key:
HKEY_CURRENT_USER\Control Panel\Desktop\UserPreferencesMask
This is a little-endian bitmask. For focus-follows-mouse, add the flag 0x1.
For example, my XP SP2 laptop originally had a value of 9E 3E 05 80, which is 0x80053E9E. To activate focus-follows-mouse I changed to 0x80053E9F, or 9F 3E 05 80 in regedit.

Helped me a lot on a Vista machine yesterday. Don’t forget to log out and back in again after the change.

OpenStack “bexar” packages for openSUSE and SLES11SP1 are ready

Thursday, February 3rd, 2011

Shortly after the OpenStack “bexar” (spoken “bear”) release was ready, my packages finished building and are available at the isv:B1-Systems:OpenStack Build Service repo.

Grab them, while they are still hot!

The ride might still be a bit bumpy as the whole OpenStack development is very Ubuntu centric, and thus some of the dependencies, especially to old versions of python stuff are tricky to find. However, first results look promising.

I’ll update here soon with some short hints on how to configure and use the whole lot.

Thanks go to my colleagues Christian Berendt and Andre Nähring at B1 Systems GmbH who have been tireless in testing packages and reporting packaging bugs and other problems. Thanks also to Gregory Haskins with whom I started the packaging effort early in december.

Load average

Friday, January 28th, 2011

No comment:

  2:05pm  up 79 days  6:40,  5 users,  load average: 2948.98, 2948.04, 2945.49

(Later we found out that the load was actually “fake”, the kernel had somehow died and everything accessing /proc/$pid/* was hanging in state D)

Don’t Ask

Wednesday, January 26th, 2011

(No, it was not me who made this necessary. Yes, we did reinstall the machine anyway.)

#!/bin/bash
while read p; do
  rpm -V $p > /dev/null && continue
  echo "fixing $p's file ownership..."
  while read x x u g x x x x n x; do
    chown -h $u:$g $n
  done < <(rpm -qlv $p)
done < <(rpm -qa)

Nifty dnsmasq Trick: Reverse Lookup using a specific Server

Tuesday, June 22nd, 2010

With dnsmasq, it’s easy to look up a whole domain using a special dns server. The option is

   --server=/foo.corp/10.11.12.13

This will look up everything “*.foo.corp” using nameserver 10.11.12.13. So far, so good. But today I also needed the reverse lookup for a specific IP adress zone to be done via a specific nameserver. Reading the manpage, I found no option for that, but then I remembered stuff that I had learnt in a distant past: that reverse lookups are actually a name lookup of the in-addr.arpa zone, with the “reversed” IP address. So I tried

  --server=/10.in-addr.arpa/10.11.12.13

and that one works fine, looking up everything 10.x.x.x using 10.11.12.13.

And it still was much easier than using ugly bind. That’s why I prefer dnsmasq in daily use over bind, dhcpd and all the other crap. It just works ;)