In creating a bootable virtual machine image, the user often needs to do several things that require root access. These may include:
In a securely configured system, these things are not able to be done without root access.
The goal of vvpc is to provide the user with an easy way to do these things and others, without requiring root access. vvpc uses ready-to-boot images that provide a “virtual victim pc” for the user to perform these actions in. From the user perspective, it appears that a new machine has been booted with user-supplied hard disk images connected and has been given full root access to the machine
EXAMPLES: ./vvpc The simplest invocation. This will create a virtual machine and put you inside it. a 1G hda will be set up to play with. on exit from the shell, the vm will be destroyed. qemu-img create -f qcow myhda.img 100M ./vvpc -hda myhda.img create an hard drive image myhda.img and then connect to it. # create a qemu image for hda hard drive qemu-img create -f qcow myhda.img 500M # create a vm, and save its reconnect id to var 'r' r=$(./vvpc --create --multi -hda hda.img) # partition the new /dev/hda with sfdisk ./vvpc -r $r "printf '0,100,L,*\n,,S\n' | sfdisk /dev/hda" # make a filesystem on the disk and mount it ./vvpc -r $r "mke2fs /dev/hda1 && mount /dev/hda1 /mnt" # extract a root tarball in /mnt from local file myroot.tar ./vvpc -r $r "cd /mnt && tar xvf -" < myroot.tar # unmount /mnt and poweroff the vm ./vvpc -r $r "umount /mnt && poweroff" # cleanup the pc in $r ./vvpc -r $r --teardown
gitweb source can be viewed at http://smoser.brickies.net/git/?p=vvpc.git;a=summary. Obtain source code with git using the following
git-clone http://smoser.brickies.net/git/vvpc.git
$ vvpc --reconnect --attach-drive my-disk:my-disk.img $ vvpc 'mkdir /mnt/my-disk1 && mount /dev/my-disk1 /mnt/my-disk1 && rm /mnt/my-disk1/etc/fstab && umount /mnt/my-disk1' $ vvpc --detach-drive my-disk
host os | qemu/kvm | guest kernel | result |
---|---|---|---|
jaunty i386 | qemu | linux-generic | modprobe acpiphp results in 'No such device'. tried both with stock qemu and qemu source 4/25 git. I suspect it is a bios issue. |
jaunty i386 | kvm | linux-generic | |
jaunty i386 | kvm-x | linux-generic | random segfaults prior to any hotplug activity (dmesg shows 'no vm86_info: BAD', but hotplug and remove does work |
jaunty x86_64 | qemu | linux-generic | |
jaunty x86_64 | kvm | linux-generic | |
jaunty x86_64 | kvm-x | linux-generic |