Difference between revisions of "Talk:QEMU"

From ArchWiki
Jump to: navigation, search
(Removed "QEMU acceleration" section because it is *years* out of date)
(Preparing an (Arch) Linux guest: linux-lts is now on 3.10.x)
(34 intermediate revisions by 11 users not shown)
Line 1: Line 1:
== Lots of changes ==
+
== Linear RAID ==
  
I've made a lot of reorganizations, updates, and additions to the article.  Feel free to fix anything that doesn't look right.
+
When I was updating the article yesterday, I had tried to fit the section about linear raid (boot a VM from a partition by prepending a MBR to it) into the article betterBut I'm not sure the technique described is the right one at all. It looks like it works, but wouldn't it be easier to install a bootloader directly to the partition (e.g. syslinux)?  Then the VM could be booted directly from the partition simply by using it as its virtual disk.
 +
--[[User:Synchronicity|Synchronicity]] ([[User talk:Synchronicity|talk]]) 19:23, 9 May 2012 (UTC)
  
--[[User:Synchronicity|Synchronicity]] ([[User talk:Synchronicity|talk]]) 18:23, 8 May 2012 (UTC)
+
== Creating bridge manually ==
  
== starting qemu using a real partition ==
+
I really don't know what to do with this section. I'd say it has been superseded by [[QEMU#Creating bridge using qemu-bridge-helper]] (available since qemu-1.1, we now have qemu-1.5) - or is someone still using this method? Perhaps link to https://en.wikibooks.org/wiki/QEMU/Networking#TAP_interfaces or http://wiki.qemu.org/Documentation/Networking/NAT is sufficient. What do you think? -- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 20:42, 22 July 2013 (UTC)
  
I made the description more detailed
+
:Actually, I've become a happy user of this method. I've written some scripts to easily create bridge interface, TAP interface, and combined with Xyne's [http://xyne.archlinux.ca/notes/network/dhcp_with_dns.html excellent scripts] to set up NAT and launch DHCP server, I have complete solution to easily manage multiple VMs on one (or even more) bridge.
 +
:My scripts are available on github: [https://github.com/lahwaacz/archlinux-dotfiles/blob/master/Scripts/qemu-launcher.sh], [https://github.com/lahwaacz/archlinux-dotfiles/blob/master/Scripts/qemu-tap-helper.sh], [https://github.com/lahwaacz/archlinux-dotfiles/blob/master/Scripts/qemu-mac-hasher.py] but I won't probably integrate them into the wiki, I'l just leave a note when I do some more testing.
 +
:The thing is, what to do with the current content? Personally I think that links to [https://en.wikibooks.org/wiki/QEMU/Networking#TAP_interfaces], [http://wiki.qemu.org/Documentation/Networking/NAT] and my scripts are sufficient (of course others are welcome). I'd also leave the note at the end to ''disable the firewall on the bridge'', I find it extremely useful.
 +
:-- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 18:24, 5 September 2013 (UTC)
  
Yurac 29/1/08
+
==  Preparing an (Arch) Linux guest  ==
  
== thoughts / suggestions on networking nitty gritty section ==
+
adding the virtio modules to use virtual devices doesn't appear to be necessary as of the VM I built this week(Jul 26, 2013). Kernel 3.9.9-1
 +
[[User:Surlyjake|Surlyjake]] ([[User talk:Surlyjake|talk]]) 03:42, 27 July 2013 (UTC)
  
I followed the beginner's guide to installing Arch and setting up rc.conf. I have also installed 'dnsmasq'. When following the QEMU/KVM how-to I was unable to get my bridge interface to see the dhcp server of my modem until I amended my rc.conf to include and bring up the loopback interface i.e.
+
:In newer kernel versions (I think since 3.4) the kernel modules are loaded automatically. I'd still keep the section as it is for now, linux-lts is still at 3.0. -- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 21:09, 20 August 2013 (UTC)
<pre>lo="lo up"
+
eth0="eth0 up"
+
br0="dhcp"
+
INTERFACES=(lo eth0 br0)
+
gateway="default gw 192.168.0.1"
+
ROUTES=(gateway)
+
</pre>
+
  
As this is not part of the beginners rc.conf it might help others that have got stuck with this part to read this and maybe considered, if correct, a useful addition to the how-to. It would be good to get confirmation from those-that-know if this is the best foot forward, so to speak.
+
::{{Pkg|linux-lts}} is now on the 3.10 series.
 +
::-- [[User:Jstjohn|Jstjohn]] ([[User talk:Jstjohn|talk]]) 16:51, 23 September 2013 (UTC)
  
Ed 17/05/10
+
==  Starting QEMU virtual machines with Systemd  ==
 +
The custom systemd service script does not work. It always fails with {{ic|Failed at step EXEC spawning /usr/bin/qemu-{type}: No such file or directory}}. To Fix this modify the ExecStart command {{bc|1=ExecStart=/usr/bin/sh -c "/usr/bin/qemu-${type} -name %i -nographic ${args}"}}
 +
Also {{ic|echo 'system_powerdown' &#124; nc localhost 7101}} kills the VM immediatly. To fix this change the stop script. It simply checks each second if the main process is still running. {{bc|1=ExecStop=/usr/bin/sh -c "${haltcmd} && while [[ `pidof qemu-${type} | grep $MAINPID` ]]; do sleep 1; done"}}
 +
{{ic|gnu-netcat}} does not work to connect to the monitor. You need to use {{ic|openbsd-netcat}}. -- [[User:Ant32|Ant32]] ([[User talk:Ant32|talk]]) 17:48, 5 September 2013 (UTC)
  
== vde networking ==
+
:The first problem related to starting the service seems rather strange - didn't you have typo error in your local {{ic|qemu@.service}} file (missing the dollar sign {{ic|$}} in {{ic|${type} }})?
 +
:The second problem is valid, systemd kills the main process when the ExecStop command exits (see {{ic|systemd.service(5)}}). If your workaround really works, it could be added to the wiki with a proper description.
 +
:-- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 21:17, 7 September 2013 (UTC)
  
The instructions provided for vde networking did not work. Instead I did the following which ''did'' work:
+
::Relevant thread on systemd-devel mailing list: [http://lists.freedesktop.org/archives/systemd-devel/2013-September/012982.html] -- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 00:00, 15 September 2013 (UTC)
 
+
<code>
+
vde_switch -daemon
+
 
+
slirpvde --dhcp --daemon
+
</code>
+
 
+
Then to start the vm with a connection to the network of the host:
+
 
+
<code>
+
kvm -net nic,macaddr=52:54:00:00:EE:03 -net vde whatever.qcow
+
</code>
+
 
+
The above method is also less invasive. Any support/objections to replacing the vde networking instructions in the article with these? If the current instructions bring attention to features that the above method does not, how can they integrated?
+
--[[User:AndreasBWagner|AndreasBWagner]] 22:02, 17 April 2011 (EDT)
+
 
+
:I'm not very acquainted with QEMU nor VDE, anyway I would suggest to add your code as an "Alternative method", so that people will be able to choose what they like best, and if the current code doesn't work any longer for anybody (maybe due to version upgrades?) it will be removed altogether. -- [[User:Kynikos|Kynikos]] 10:01, 18 April 2011 (EDT)
+

Revision as of 16:51, 23 September 2013

Linear RAID

When I was updating the article yesterday, I had tried to fit the section about linear raid (boot a VM from a partition by prepending a MBR to it) into the article better. But I'm not sure the technique described is the right one at all. It looks like it works, but wouldn't it be easier to install a bootloader directly to the partition (e.g. syslinux)? Then the VM could be booted directly from the partition simply by using it as its virtual disk. --Synchronicity (talk) 19:23, 9 May 2012 (UTC)

Creating bridge manually

I really don't know what to do with this section. I'd say it has been superseded by QEMU#Creating bridge using qemu-bridge-helper (available since qemu-1.1, we now have qemu-1.5) - or is someone still using this method? Perhaps link to https://en.wikibooks.org/wiki/QEMU/Networking#TAP_interfaces or http://wiki.qemu.org/Documentation/Networking/NAT is sufficient. What do you think? -- Lahwaacz (talk) 20:42, 22 July 2013 (UTC)

Actually, I've become a happy user of this method. I've written some scripts to easily create bridge interface, TAP interface, and combined with Xyne's excellent scripts to set up NAT and launch DHCP server, I have complete solution to easily manage multiple VMs on one (or even more) bridge.
My scripts are available on github: [1], [2], [3] but I won't probably integrate them into the wiki, I'l just leave a note when I do some more testing.
The thing is, what to do with the current content? Personally I think that links to [4], [5] and my scripts are sufficient (of course others are welcome). I'd also leave the note at the end to disable the firewall on the bridge, I find it extremely useful.
-- Lahwaacz (talk) 18:24, 5 September 2013 (UTC)

Preparing an (Arch) Linux guest

adding the virtio modules to use virtual devices doesn't appear to be necessary as of the VM I built this week(Jul 26, 2013). Kernel 3.9.9-1 Surlyjake (talk) 03:42, 27 July 2013 (UTC)

In newer kernel versions (I think since 3.4) the kernel modules are loaded automatically. I'd still keep the section as it is for now, linux-lts is still at 3.0. -- Lahwaacz (talk) 21:09, 20 August 2013 (UTC)
linux-lts is now on the 3.10 series.
-- Jstjohn (talk) 16:51, 23 September 2013 (UTC)

Starting QEMU virtual machines with Systemd

The custom systemd service script does not work. It always fails with Failed at step EXEC spawning /usr/bin/qemu-{type}: No such file or directory. To Fix this modify the ExecStart command
ExecStart=/usr/bin/sh -c "/usr/bin/qemu-${type} -name %i -nographic ${args}"
Also echo 'system_powerdown' | nc localhost 7101 kills the VM immediatly. To fix this change the stop script. It simply checks each second if the main process is still running.
ExecStop=/usr/bin/sh -c "${haltcmd} && while [[ `pidof qemu-${type} | grep $MAINPID` ]]; do sleep 1; done"

gnu-netcat does not work to connect to the monitor. You need to use openbsd-netcat. -- Ant32 (talk) 17:48, 5 September 2013 (UTC)

The first problem related to starting the service seems rather strange - didn't you have typo error in your local qemu@.service file (missing the dollar sign $ in ${type} )?
The second problem is valid, systemd kills the main process when the ExecStop command exits (see systemd.service(5)). If your workaround really works, it could be added to the wiki with a proper description.
-- Lahwaacz (talk) 21:17, 7 September 2013 (UTC)
Relevant thread on systemd-devel mailing list: [6] -- Lahwaacz (talk) 00:00, 15 September 2013 (UTC)