QEMU and GNOME Boxes

The GNOME people work on improving their DE constantly. We were always curious about their development of GNOME Boxes as it sounds promising to have a frontend for a QEMU instance or even use Boxes for creating that instance. Unfortunately, using Boxes as a replacement for creating a VM in KVM/QEMU via CLI does not work properly yet.

What are we going to do?

  • We are going to create a server on a physical machine for hosting virtual machines.
  • We then install another Ubuntu server on the virtual machine.
  • We will access the VM by using an SSH tunnel for connecting to the VNC server on that machine.
  • By doing so, we will make use of GNOME Boxes for accessing the console of the VM.

Let’s assume our IP-address is 10.0.0.10 on the dedicated VM Host. In this demo, we are working inside an DHCP and DNS network, so the master server can easily handle the DNS records and host names. We simply fire up our server configuration, add the host name vmprovider for our dedicated VM machine and set the IP 10.0.0.10. Thus we can access our server via SSH more comfortably and/or are not bound to using IP addresses in the browser. This is helpful when you e.g. work on a Wordpress setup for instance. Wordpress doesn’t like changing IP addresses.

Why are we going to do this?

There are many reasons for deploying virtual machines on a server. Working on a local machine sometimes just doesn’t cut it, especially when you’re short on RAM or when cooperating with your fellow colleagues on a project.
Also, solutions like VMWare Player or Virtualbox are nice, but they also eat up your resources quickly. Yes, they’re hungry.

Using LXC is quite cool, but what if you don’t want to risk anything and find it to be a hassle to set up the LXC stuff, doing the config and so on? Cloning an LXC container is simple, but still you have to configure the networking and so on.

  1. Do you also find it terribly annoying when the VM instance captures your mouse pointer? GNOME Boxes doesn’t do that.
  2. Do you hate configuring the video settings for not messing up the scaling of your VM window? Simply resize your box.

Good Guy GNOME

What do we need?

Ubuntu 14.04 Server ISO
For the sake of simplicity we are renaming the file to just ‘ubuntu1404.iso’. My suggestion is to do that on your local machine for saving time.

Server

20 GB HD space
1 free CPU
1 GB RAM

reasonable hostname and user names

  • vmprovider for our host machine
  • vmuser

Desktop with a GNOME DE >=3.10
GNOME Boxes

What we’re not going to cover here

bridging your NICs
There are various tutorials across the web. It’s not too difficult to do, so we just take it for granted to work with virbr0 and its IP 192.168.122.1.

the perfect KVM/QEMU configuration
This post is about making use of GNOME Boxes via VNC, not about KVM’s huuuge options library.

the perfect network configuration
Why would we handle the network configuration inside a VM hosting machine while we could easily do that on a machine which’s purpose is to provide our users with a great environment? Nope.

Install the VM Host

Start the installation process on your dedicated machine, but do not just hit the Enter button furiously. Instead, press the ESC button on the language selection screen first, then hit F4 and select ‘Minimal Installation’. Why? Because we want to create a lean and slick server installation. Apart from that, the minimal Installation downloads lots of necessary packages from the web so you save your time for doing a dist-upgrade after you’ve completed the installation procedure.

Partition your hard drives simply with the guided LVM setup and apply the reasonable user and host name, continue the install process. When reaching the tasksel screen, select the Basic Ubuntu server, the SSH server and the VM provider packages. Finish the installation process and reboot your VM host. We now SSH onto our machine and use the terminal rather than the VM’s console.

You’ll need some additional packages for making your life more comfortable. We don’t want to use QEMU, but we will use virsh as it provides us with a selection of simple options.

[email protected]

sudo apt-get install virtinst libvirt-bin

Preparation time

From our local machine we are copying the Ubuntu image to the /home folder of our vmuser on the VM host machine by using scp:

[email protected]

scp ~/Downloads/ubuntu1404.iso [email protected]:/home/vmuser/ubuntu1404.iso

Of course, you could easily browse the vmprovider’s file system by accessing it via Nautilus, so we could go with “connect to server”

[email protected]

ssh://vmprovider #ssh://10.0.0.10

and filling in our credentials.

On the VM Hoster edit the qemu config file for making the output of the VM’s VNC server accessible to VNC clients:
[email protected]

sudo nano /etc/libvirt/qemu.conf

Find the line vnc_listen and uncomment it:

[email protected]

vnc_listen = "0.0.0.0"

By doing so, any client from anywhere can access your VM’s console output, so we strongly suggest you have set up your access rules properly on a master server which handles DNS, DHCP and stuff. (refer to the section ‘What we’re not going to cover here’)

You don’t have to create a virtual file system prior to the installation process, we are going to do that while installing the VM Guest.

Finally start the installation!

SSH onto the vmprovider and fire up virsh in all of its glory:

[email protected]

virt-install —connect qemu:///system -n ubuntu2 -r 1024 —vcpus=1 —arch=x86_64 -c ~/ubuntu1404.img —network=network:default,mac=00:AA:BB:CC:DD:00 —accelerate —vnclisten=0.0.0.0 —disk=/var/lib/libvirt/images/ubuntu2,size=20 —force
ubuntu2 is the name of your environment, call it according to your needs
—vnclisten=0.0.0.0 is not necessary here as already defined in the qemu.conf file
/var/lib/../ubuntu2 is the name of your virtual disk, make sure to keep same name like above
—force means that you force the installation into this folder and file

It can become quite cumbersome to restart installation procedures when receving errors, because you have to delete the environments, remove the MAC addresses and so forth.

[email protected]

virsh destroy ubuntu2
virsh undefine ubuntu2

standard procedure to memorize

Step One start the instance
Step Two SSH tunnel
Step Three start GNOME Boxes
No. It won’t work out if you don’t follow the order of launching the instance and then starting Boxes.

Wait for the install process to begin and then create a tunnel from your local machine to the vmprovider by launching a terminal and typing:

[email protected]

ssh [email protected] -L5900:127.0.0.1:5900

Now you can launch Boxes and create a new box. Well, you could have created the box beforehand but why hurry? You don’t have to specify a port in Boxes since you already have specified the correct port in your tunnel plus you enter the standard port for the VNC protocol by: vnc://127.0.0.1

Your box is ready now. Double click it to access the console and continue the installation. Did you read the section above about not furiously hitting the Enter button? Yes, we like that option, so we’ll do it again and select ‘Minimal Virtual Installation’ now. By doing so, Ubuntu does not install all the kernel modules and drivers which do not come in use in a virtual setup. How cool is that? We love it.

Once you’re done with the installation, your box will become dark. Let it rest for a while until you’re sure the installation process has completed properly. Sometimes it ‘freezes’, but you can easily stop the process by applying the shortcut given in the terminal window.
Close your box for now. Then go to your terminal (not the tunneling one!) and list all your installed machines:

[email protected]

virsh —connect qemu:///system list —all

Now is the time for starting up the machine again:

[email protected]

virsh —connect qemu:///system start ubuntu2

Again, make sure having started the instance before starting your GNOME Box. It won’t connect and your Tunnel Terminal will give you an error output. Voilá, there we go. We now can do what we want to do. Create a Rails application by installing RVM, running GitLab or whatever you like. Testing and wrecking.

Once you’ve had enough, you can shut down your instance by
[email protected]
sudo init 0

in your VM Guest session or on your VM Host

[email protected]

virsh —connect qemu:///system shutdown ubuntu2

Done with playing, now close that tunnel!

Alright, there you go. On your local machine grep for the processes involved with VNC:

[email protected]

ps aux | grep 5900

Then kill them!
[email protected]

kill 1680 #the PID given above

OK, OK. A more reasonable way? Close the Tunnel Terminal by hitting
[email protected]
CTRL + D

Questions and different stuff

Obviously, you can find different configuration options and might be wondering why we do it that way. First of all – why not?

> Why do you place the virtual disk inside /var/…?

Out of a habit. Usually I have my /var directory on a separate partition so that I can easily mount it during a server upgrade process without the need for repartitioning and other hassles which simply consume my time. (refer to the section ‘What we’re not going to cover here’)

> What if I want to run several virtual machines on my vmprovider?

Just make sure not to run out of CPUs and RAM. Simply alter your install command and apply this little neat option to it:

[email protected]

—vnclisten=0.0.0.0,port=5901

Of course you have to change the ports in your tunnels and of GNOME Boxes accordingly:
vnc://127.0.0.1:5901

> I have grepped for 5900 and there are still processes running!

No need to worry. These show up on changing ports and do no harm.

> I am not absolutely sure if my tunnel is closed?

Fire at will!

[email protected]

pkill -x ssh

Still questions? Comments?

Did we make any mistake? Do you find it stupid to fuzz around with QEMU? Tell us why! Suggestions and improvements? Hit the ‘comment’ button or leave a reply on Google+!

Christopher Semmler's picture

Christopher Semmler

Christopher Semmler is our CEO and works in our IT and Finance Division. Apart from Business Development he makes technology decisions, works on platforms and Digital Marketing. He holds a Magister degree in Corporate Finance and Information Systems, loves to play with new tech and is specialised in the low level area.

Comments

  1. David Allen's picture
    David Allen (not verified)

    The framework engineering has the same sum of if not more potential to represent the deciding moment the client encounter. Outline choices made at the least levels as a regulation rise to roll out the most basic improvements to the client meet. Write Me an Essay One basic illustration is the document frame. A low level alter from a progressive non-forming document framework to a level metadata-driven completely formed record skeleton would clearly change the client bump into essentially.

  1. Alex Sam's picture
    Alex Sam (not verified)

    Overwhelming metal doesn't have screamers, metalcore does as most metal kinds vocalists do have the particular capacity to deliver the sound that they need like the demise snarl, video making companies. yelled or melodic. Relies on upon the music. On the off chance that you going the metalcore course there's getting a keyboardist all things considered they aren't generally important unless the individual is okay as they can wind up simply being another instrument playing what the other 3 are doing..

  1. Earl Anderson's picture
    Earl Anderson (not verified)

    QEMU is a machine emulator and virtualizer. As a machine emulator, it can run OSes and programs made for one machine (e.g. an ARM board) on a different machine (e.g. your own PC). As a virtualizer, QEMU achieves near native performance by executing the guest code directly on the host CPU using KVM. KVM (Kernel-based Virtual Machine) is a Linux kernel module that allows a user space program to use the hardware virtualization features of various processors. Clickable Link 

  1. Anonymous's picture
    Anonymous (not verified)

    Yes they are Gnomes do exists however they exists in the soul world or astral plane in truth elves have been outstanding everywhere throughout the world for instance in Hawaii they are Mani Huni's. custom essay help. These spirits are resealed as Elemental creatures since Gnomes compare to the component of earth.

  1. Monroe Alfred's picture
    Monroe Alfred (not verified)

    We could all wear "hanging with the knomies" tee shirts in support. Knomes are little and famously smart and this one is very much voyage. animated video services. Jack is an awesome specialist and we could put little Jack heads on our auto attenaes for support.

  1. Peter Kevin's picture
    Peter Kevin (not verified)

    I essentially need to offer immense thankful for this stunning post of Write my assignment at Assignmentland.com, quality article and will look a more fundamental measure of your assembled captivating substance. Magnificent sharing!

  1. James Anderson's picture
    James Anderson (not verified)

    This is one of the most informative and educational posts of On Time Papers. Actually, I'm searching this kind of material. Thank you so much for sharing this post.

  1. Martin Jam's picture
    Martin Jam (not verified)

    This is a very informative article of Do My Assignment from AssignmentKeen.com. I also agree with your post title and your really well explain your point of view. I am very happy to see this post. Thanks for share with us. Keep it up and share the more most related post.

  1. James Cameron's picture
    James Cameron (not verified)

    Ubuntu is free and open basis programming, which income customers are allowed to run, copy, appropriate, pay to do my homework study, and enhance the product under the terms.

  1. Google's picture
    Google (not verified)
  1. Kristine Stevart's picture
    Kristine Stevart (not verified)

    It’s pleasant to spectator such remarkable writing skills. 9/10 for this write-up. Our corporation is in UK Essays sector and provides best quality essays result at your doorstep.

  1. jennifer nicole's picture
    jennifer nicole (not verified)

    I simply need to express profound gratitude for this awesome post of www.dissertationmill.co.uk, quality article and will look a greater amount of your separate entrancing substance. Brilliant sharing!

  1. Solomon Daniel's picture
    Solomon Daniel (not verified)

    I likewise concur with your post title and your truly well clarify your perspective. I am exceptionally glad to see this post. A debt of gratitude is in order for offer with us. Keep it up and share the all the more most related post. There are not a considerable measure of occasions where things were named as weeds. Helpful links for Homework

  1. Mathew Hayden's picture
    Mathew Hayden (not verified)

    I basically need to offer significant thanks for this marvelous post, I moreover agree with your post title and your really well clear up your point of view. I am astoundingly happy to see this post. An obligation of appreciation is all together for offer with us. Do my Essay for me

  1. Robert's picture
    Robert (not verified)

    This is an exceptionally enlightening article, I am astoundingly glad to see this post. A commitment of gratefulness is all together for offer with us. Much obliged to you such a great amount for sharing this post.Buy Essay

  1. enough's picture
    enough (not verified)

    Nice blog, the article you have shared is good.This article is very useful. My friend suggest me to use this blog.
    Top Management college in chandigarh

  1. jordansaq's picture
    jordansaq (not verified)

    yeezy350find When I saw your article, especially this post you satisfied me amazingly.

  1. susan richard's picture
    susan richard (not verified)

    We hope to release them within the next weeks, buy assignment online as we require taking a shot at our Jenkins arrangement for Continuous addition and Deployment.

  1. 1len jordanss123's picture
    1len jordanss123 (not verified)
  1. buy assignment online's picture
    buy assignment ... (not verified)

    Many thanks for sharing this very diverse opinion post where each expert has no doubt shared his best knowledge on the topic. Have more success in your journey. Buy Assignment online to Get A+ Grades

  1. Amanda Huss's picture
    Amanda Huss (not verified)

    The technology is cumulative and latest gear is getting intended to forecast the earthquake happening earlier only. But, still we can see the destruction producing by these natural disasters. As per they investigation intelligences available in custom dissertation writers blog says that in every quake produced till now there is huge human lose in tremors.

  1. jasie's picture
    jasie (not verified)

    google [url=http://www.google.com/]google[/url]

  1. Peter Kevin's picture
    Peter Kevin (not verified)

    The author has made a stunning article UK Essay Writing Service. You made you show up and neighboring no exchange about. Unmistakably this specific empower that you to can not fight with the truth is not wide, everything has its staggering case. A dedication of gratefulness is all together for this information.

Add comment