Ubuntu guest VM frustrations

I’m trying to set up Ubuntu in a virtual machine. My goal is to recreate locally an environment a little like I might get from Amazon EC2, so I can do rapid testing of deploy scripts. I don’t need an exact Amazon AMI, but a clean Ubuntu image is close enough I can get stuff working before dealing with a remote environment.

I’ve got a VM host running. It’s Ubuntu 14.04 running KVM. Seems to work.

I’ve previously gotten Ubuntu’s new Snappy working as a guest. It boots fine and I can access ports. Unfortunately this environment is a strange Ubuntu 15, which has replaced apt with the “snappy” tool. Not enough like an EC2 host to be useful.

I tried using an Ubuntu Cloud image as a guest. They ship 14.04. But it doesn’t boot cleanly:

2015-05-03 18:25:26,540 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [119/120s]: request error [(<urllib3.connectionpool.HTTPConnectionPool object at 0x7f0f325e58d0>, 'Connection to 169.254.169.254 timed out. (connect timeout=17.0)')]
2015-05-03 18:25:27,542 - DataSourceEc2.py[CRITICAL]: Giving up on md from ['http://169.254.169.254/2009-04-04/meta-data/instance-id'] after 120 seconds
2015-05-03 18:25:27,550 - url_helper.py[WARNING]: Calling 'http://10.0.2.2//latest/meta-data/instance-id' failed [0/120s]: bad status code [404] [404]

The init scripts are waiting on some network resources to load. The IP addresses are on the local network, and I guess it’s some sort of Ubuntu cloud server configuration thing. I don’t want all that! I just want a basic Ubuntu unmanaged instance to boot. Unfortunately ssh is still refusing logins. It does finally give up but it takes about 4 minutes, way too long for the rapid iteration I have in mind. And then I can’t log in. Apparently there is no default password. This image is really not designed for the quick and dirty hackery I want.

I did learn something about how QEMU/KVM’s networking stuff works. The default IP is provided by slirp, which among other limitations does not support ICMP. So that’s why ping doesn’t work! Also it’s outbound connections only, although the “-redir” flag to kvm seems to offer some basic port forwarding.

I found this guide to using libvirt sort of interesting, it’s simple stuff for managing the virtual machine image. Although again way overkill for what I want.

At this point I think I’m going to give up on running my own KVM guests and hope that EC2 gives me a new machine fast enough that testing machine setup scripts using throwaway instances isn’t too annoying.

Update: my friend Jeff says that I should look at ubuntu-vm-builder. It will apparently make me an image. I sure would be glad to just download one someone made already though.

3 thoughts on “Ubuntu guest VM frustrations

  1. Do you get some benefit from rasslin’ with KVM for this sort of use, rather than just running virtualbox or vmware or whatnot? Those install and run straight ubuntu ISOs with (comparatively) little hassle.

  2. My impression is KVM is the host of choice on Ubuntu. I like that it’s designed for command line use. I think it can boot an ISO, too. That doesn’t really solve my problem though, which is I want a working Ubuntu image that comes up already installed and without having to fiddle with allocating disks, etc. That Snappy image is very close to what I want, it’s just not stock Ubuntu.

  3. Ah, I see, I think I misread what you were trying to do, sorry. Virtualbox can do all of those things (which is why vagrant and docker (in the docker case, on os’es that don’t have a lightweight container facility) tend to use it). But I wonder whether vagrant might not be what you want, its level of interaction is ‘give me a vm, just like this other vm, with all of this stuff installed, stat’. While dealing with the annoyances of hypervisors and setting up working networking.

Comments are closed.