Lguest is designed to be a minimal 32-bit x86 hypervisor for the Linux kernel, for Linux developers and users to experiment with virtualization with the minimum of complexity. Nonetheless, it should have sufficient features to make it useful for specific tasks, and, of course, you are encouraged to fork and enhance it (see drivers/lguest/README). Lguest was introduced in Linux 2.6.23.
lguest was tested on DebianSqueeze, using kernel 2.6.30-2-686. Other releases and kernel seems to have problems. You are welcome to test and report your success/failures.
- Lguest is not a full virtualization solution; instead it operates the Linux kernel with lguest support.
- Lguest is not meant for production
- Lguest is incompatible with other virtualization solution (AFAIK).
- Lguest user-land tool is specific to a kernel version
Lguest host and client should use the same kernel version or built from the same source.
Lguest userland tool in Debian
Don't look for a lguest package or ITP, lguest is a simple/sample user land tool, which source code is provided with Linux kernel documentation.
You can easily create it using this script: lguest-pkg-builder-0.4.sh The generated package is named like lguest-2.6.30-2-686_0.02_i386.deb, and it includes a wrapper that makes a few sanity checks.
The user land is specific to a kernel version. You need to compile lguest each time you change your kernel.
Using lguest as non-root user
lguest can be used by non-root user, assuming that (read/write) permissions are granted, typically by running:
modprobe lg chown jdoe /dev/lguest
Alternatively, you can use this method (which survives reboot):
# Create a group lguest groupadd lguest # Add you user to this group addgroup john lguest
Then copy this file in /etc/udev/rules.d/ 91_permissions_lguest.rules, so the permission are applied each time you insert the module.
Creating a Debian Image
lguest images must use lguest virtual devices:
The console device are /dev/hvc0 (char Major=229 Minor=0, etc...), in /etc/inittab.
The disk (and cdrom) devices are /dev/vda, /dev/vda1, /dev/vdb... (char Major=254 Minor=0,1,16, etc...)
lguest --block=./dsk.raw --initrd=./initrd.img-$(uname -r) 64m /boot/vmlinuz-$(uname -r) root=/dev/vda
Side note: The same image can be used with qemu-system-i386 (assuming that inittab still has one tty on a /dev/tty* entry). Also root= needs to be updated on the command line vda)
qemu-system-i386 -initrd ./initrd.img-$(uname -r) -kernel /boot/vmlinuz-$(uname -r) -hda dsk.raw -append root=/dev/hda
We've listed some known/frequent errors.
For unhandled trap you might want to have a look at the function lguest_arch_handle_trap in http://git.kernel.org/...../drivers/lguest/x86/core.c.
The trap 13 are General Protection Fault. There are lots of reason why it can occur...
Running kernel 2.6.31 on 2.6.30 host
Running lguest when kvm module is loaded
Failed to open /dev/lguest
Module "lg" isn't loaded, or /dev/lguest isn't created (if you don't use udev!)
Attaching eventfd: Invalid argument
Using lguest shipped with kernel 2.6.31, using a kernel 2.6.30
lguest: bad syscall vector
Humm??? Wrong kernel or is it just that 2.6.31 doesn't work at all?/*
lguest: bad syscall vector*/
Doc on lguest internals http://git.kernel.org/....../drivers/lguest/README
Lguest Git history - drivers/lguest