Linux – Xen 4.1 host (dom0) with blktap disks (“tap:aio:”) not connecting

block-devicedom0linuxxen

Problem using blktap with xen-4.1 running Ubuntu Precise stock kernel with dom0 xen-4.1.

I get:

[    5.580106] XENBUS: Waiting for devices to initialise: 295s...290s.
...
[  300.580288] XENBUS: Timeout connecting to device: device/vbd/51713 (local state 3, remote state 1)

And some syslog lines:

May 17 13:07:30 localhost logger: /etc/xen/scripts/blktap: add XENBUS_PATH=backend/tap/10/51713
May 17 13:07:31 localhost logger: /etc/xen/scripts/blktap: Writing backend/tap/10/51713/hotplug-status connected to xenstore.

with tap:aio: disk lines. file:/ works.

disk = [
    'tap:aio:/data/root.img,xvda1,w',
]

Problem exists with lucid and precises domU kernels and both guests work in Ubuntu hardy dom0 Host 64bit 2.6.24-28-xen xen-3.3

 3.2.0-24-generic #37-Ubuntu SMP Wed Apr 25 08:43:22 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:        12.04
Codename:       precise

Best Answer

As with all things problematic. Asking for help usually solves it. Even when no-one answers the question.

So the answers two fold. Apparently installing xen* stuff is not enough in Ubuntu. Blktap and stuff is separately packages and tapdisk userspace programs and blktap module is needed.

Install blktap-utils and dependencies... You'll get tapdisk and with dkms package the kernel module blktap.

That was not enough. Apparently Blktap got changed to blktap2 at some point between Ubuntu Hardy and Precise XEN versions (xen-3.3 -> xen-4.1). So the disks are included with 'tap2:tapdisk:aio:' not 'tap:aio:'

# Use this to convert existing files
perl -i.backup -pe 's/tap:aio:/tap2:tapdisk:aio:/g' *.cfg

See Xen blktap2 for tap2 disk options.


If you're still having problems with blktap, these next commands might help to diagnose what is missing.

ls /lib/modules/$(uname -r)/updates/dkms/blktap.ko && echo run: modprobe blktap || echo Missing module 
ls /usr/src/linux-headers-$(uname -r ) || echo MISSING kernel headers
ls /usr/src/blktap-2* || echo MISSING blktap-dkms
ls /var/lib/dkms/blktap/kernel-$(uname -r)* || echo dkms compilation failed

And to activate compile manually for all dkms modules:

sudo dkms autoinstall -k $(uname -r)