3

Every now and then I'd like to play with a fresh minimal install of Ubuntu (to test sysadminish scripts, application install instructions, package dependency lists etc.).

I'd like to have a tool as simple to use as testdrive: pick a version (say, 'maverick'), run a command, get a shell in a new virtual machine.

I'd like that shell to be in the current terminal, rather than a new GUI window that testdrive uses. Setting up the new VM to accept SSH logins with my ssh public key is fine.

I'd like the VM to have network access out of the box; NAT to a virtual network interface is fine.

Why a VM? Chroots don't really cut it: installing, say, Apache in a chroot would fail because it would try to listen on port 80, which is already taken. Containers might work, though, if there are any that are supported by standard Ubuntu kernels.

3
  • vagrant looked like a promising tool, but (1) it's not packaged for Ubuntu, and (2) it requires non-free software (VirtualBox non-OSE) to function. Dec 12, 2010 at 20:13
  • vmbuilder is promising: vmbuilder kvm ubuntu gives me a new vm image and a run script in ./ubuntu-kvm/run.sh in 5 minutes; the only problem is that I've no idea what to do with the VM. The run script spawns a QEMU GUI window which says "Starting up...", eats 100% CPU, and never shows a login prompt. Dec 12, 2010 at 20:31
  • Entering the GRUB menu in the VM and choosing recovery mode doesn't help either... Dec 12, 2010 at 20:33

3 Answers 3

2

First, I think this is an excellent suggestion, and definitely something that TestDrive could/should support!

In the meantime, you can grab a UEC image, untar it, and launch it in KVM:

wget http://uec-images.ubuntu.com/natty/current/natty-server-uec-amd64.tar.gz
tar zxvf *.tar.gz
kvm -boot a -fda natty-server-uec-amd64-floppy -drive file=natty-server-uec-amd64.img,if=virtio -curses

Enjoy!

3
  • This worked great for me on my natty machine. +1
    – SpamapS
    Jan 10, 2011 at 22:40
  • I can't tell if it works or not -- I got the grub menu, chose ubuntu:ubuntu, and now kvm has been spinning for 10 minutes eating one full CPU core with no output on the console. Ping scans on the virbr interface don't show any reachable machines either. Should I wait more? Should I hit some magic key sequence? Should I fiddle with the kvm command line to enable networking? Jan 16, 2011 at 14:57
  • I should've mentioned that I tried this with maverick-server-uec-i386.tar.gz on a maverick machine. Jan 16, 2011 at 15:19
2

You can also use TestDrive to launch a UEc Server Image. The way you can use it is:

testdrive -p uec-daily -l uec-server

When launching, it will show you grub, where you should select:

"uec-image with ubuntu:ubuntu"

You could also use TestDrive as follows, to specify the release. By default it will use natty:

testdrive -p uec-daily -l uec-server -r maverick
8
  • Presumably I would need a newer version of testdrive than the one available in Maverick, since that one complains: testdrive: error: no such option: -p Jan 16, 2011 at 14:42
  • Marius, I'll make available the new package in testdrive PPA by tomorrow so you can take a use of it. Cheers! Jan 17, 2011 at 5:08
  • 1
    Uploaded to PPA for Maverick at: sudo apt-get install python-software-properties sudo add-apt-repository ppa:testdrive/ppa sudo apt-get update sudo apt-get install testdrive Jan 17, 2011 at 5:17
  • I'm sorry it took so long for me to find the time to try this again. I've added the testdrive PPA, upgraded testdrive to 3.13-0ubuntu1~ppa4, and tried testdrive -p uec-daily -l uec-server. The command failed: qemu-img: Could not open '/home/mg/.cache/testdrive/iso/uec-server_natty-server-uec-i386.img'. ls confirms that the file is actually named natty-server-uec-i386.img, Mar 12, 2011 at 19:20
  • Natty's native testdrive 3.13-0ubuntu1 fails "testdrive -p uec-daily -l uec-server -r natty" in the same way (No such file or directory). May 9, 2011 at 14:30
1

Vagrant, while still not present in the standard Ubuntu repositories, now has a ready-to-use .deb and now works with virtualbox-ose.

Installation is as simple as

Usage is as simple as

  • vagrant box add lucid32 http://files.vagrantup.com/lucid32.box (once)
  • mkdir sandbox && cd sandbox && vagrant init lucid32 (creates a ./Vagrantfile you can customize if you want)
  • vagrant up && vagrant ssh (you're now in a shell session inside a new VM)
  • vagrant suspend (or halt, or destroy) when you're done.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .