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.

  • {i} lguest was tested on DebianSqueeze, using kernel 2.6.30-2-686. Other releases (like 2.6.31, 2.6.32) and kernel seems to have problems. You are welcome to test and report your success/failures.

    {i} lguest module (lg) is not compiled since Debian linux package 3.2.21-2 (so since wheezy).

FAQ/Notes:

  • 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

The error lguest: Failed to open /dev/lguest: Permission denied means that the user doesn't have appropriate permission.

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...)

Here's a script to create raw disk images lguest-create-img-0.02.sh, using debootstrap. The script generate a launcher script, which basically runs:

  • 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

Frequent errors

We've listed some known/frequent errors.

unhandled trap

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
    lguest: unhandled trap 13 at 0x4d0490 (0x0)

  • Running lguest when kvm module is loaded
    lguest: unhandled trap 13 at 0xc010b2a3 (0xd8)

Failed to open /dev/lguest

  • Module "lg" isn't loaded, or /dev/lguest isn't created (if you don't use udev!)
    lguest: Failed to open /dev/lguest: No such file or directory

Attaching eventfd: Invalid argument

  • Using lguest shipped with kernel 2.6.31, using a kernel 2.6.30
    lguest: Attaching eventfd: Invalid argument

lguest: bad syscall vector

  • Humm??? Wrong kernel or is it just that 2.6.31 doesn't work at all?/*
    lguest: bad syscall vector*/

Documentation

See also

important information

removed in kernel version 4.14 (November 2017). see lguest wikipedia page. see also Closing the curtain on lguest (and this mailing list!)


CategorySoftware CategoryVirtualization

AltStyle によって変換されたページ (->オリジナル) /