Install and configure Qemu-KVM on Arch Linux [Updated]

Virtual Manager

With a previous article we saw how to install Qemu-KVM en debian wheezy thanks to the collaboration of Fico and this time, I will show you how to do it but in Arch Linux.

Compared to DebianWhat I show you next is a little heavier, but come on, it's really easy to get to the final result. Let's get started:

Installing the necessary packages

We are going to install the packages we need to make it work Qemu-KVM and being able to manage our virtual machines.

$ sudo pacman -S qemu dmidecode ebtables dnsmasq libvirt bridge-utils openbsd-netcat radvd urlgrabber virtviewer virtinst virt-manager ifplugd ifenslave tcl

Previously the package was called qemu-sq.m, for me no more, now it is only whoa. The rest of the packages are those necessary for the network options and so on to work.

The package boil It is no longer in the repositories or has been renamed. Now only packages are needed virt-manager, libvirt-glib, libvirt, vde2 y whoa

Once these packages are installed, we add our user to the groups sq y polkitd:

$ sudo gpasswd -a your_kvm user $ sudo gpasswd -a your_polkitd user

Then we raise the necessary modules, which may vary depending on our video card:

$ sudo modprobe kvm-intel $ sudo modprobe kvm

If you have AMD, you should use kvm-amd, and I assume kvm-nvidia for NVidia users. I'm honestly not sure about the latter.

Now we activate the service:

$ sudo systemctl enable libvirtd.service

And if we want to start it, you already know:

systemctl start libvirtd.service

We only have to create or edit a rule for Policykit that allows us to manage virtual machines with our user. For this we edit or create the file:

$ sudo nano /etc/polkit-1/rules.d/50-org.libvirt.unix.manage.rules

And we insert the following lines inside:

polkit.addRule (function (action, subject) {if (action.id == "org.libvirt.unix.manage" && subject.user == "your_user") {return polkit.Result.YES;}});

We must replace your user by our user, of course. What would we have left? Well, restart the computer and try to make a new virtual machine.

In my particular case, when trying to create a new virtual machine with an existing image, it gave me a permission error when I finished the wizard. I just had to give read / write permissions to the .img file

References: QM Factor.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Federico A. Valdes Toujague said

    Greetings Elav !!! I really don't see it as more complicated than in Debian. Maybe different commands. It is always Worthwhile to execute a few commands to have installed this Powerful tool to make virtual machines. Even if I don't use Arch, Thanks for letting us know how it is installed in that distro.

    1.    elav said

      You have to take a few extra steps ... that's what I mean by the complicated. In Debian there is no need to do anything other than install the packages and add our user to the corresponding group.

  2.   ozkar said

    A question elav: Arch already uses systemd, is it necessary to put the .service to the service? Not recognized yet by systemctl 'action' kdm, for example?

    1.    elav said

      Yes, Arch uses Systemd. I do not know if it can be done without the .service, and as it is in the Wiki, well I did it

    2.    they carry said

      If you recognize it, it is not necessary to put it.

  3.   pandev92 said

    very nice the osx ... OHH WAIT XD

    1.    elav said

      xDD I would like OSX to be my KDE 😛

      1.    pandev92 said

        morning.

        1.    eliotime3000 said

          I agree with @elav, since the Aqua interface of OSX consumes 256 MB of video, compared to KDE which is around 96 MB (the minimum supported), and 128 MB (the minimum recommended).

          In Slackware, KDE runs with 96 MB of video, just as if it had 128 MB. Anyway, between tastes and colors ...

          1.    pandev92 said

            I don't care about the consumption, I buy another 4 gb module and that's it XDD

          2.    pandev92 said

            in video, any card from the last 4 years comes with 1 gb ddr2 or ddr3 xD .., up to a nvidia gt610 of 40 euros.

          3.    eliotime3000 said

            @ pandev92:

            I live in a Latin American country where the purchasing power limits the possibility of acquiring a good video card for the average person, but I would like to use a Gigabyte with an Intel chipset (in itself, it is the best brand of mainboards that I have used so far ).

          4.    Javier said

            Obviously, the purchasing power does not matter to pandev92, not to mention XD

  4.   Leo said

    Arch is not complicated, you just have to have a little more time to read the wiki.

    1.    eliotime3000 said

      Arch itself is KISS and RTFM at the same time (you always depend on wiki updates to avoid any modifications made to the update process).

  5.   pandev92 said

    It's not that it's complicated or not, it's just not suitable for the end user.

    1.    eliotime3000 said

      If you don't want to be in this RTFM (Read The Fucking Manual) mode, better use Mint.

    2.    Javier said

      that is not for the end user, I would not care XD

  6.   berny said

    You should leave the policykit like this, so check if it is in the group or not and that's it,
    so if you have more than one user it would give access if it is in the group, although I only use the machine for myself I have several users for different projects, if you put it as a user it will only go with that user

    all the best

    polkit.addRule (function (action, subject) {
    if (action.id == "org.libvirt.unix.manage" &&
    subject.isInGroup ("libvirt")) {
    return polkit.Result.YES;
    }
    });

    1.    berny said

      I put the group libvirt but you can put the group you want, in your case kvm or polkitd

  7.   xoslorg said

    Hi, does anyone know why kvm gives this error:

    Unable to complete installation: 'internal error: process ended while connecting to monitor: char device redirected to / dev / pts / 0 (label charserial0)
    qemu-system-x86_64: -drive file = / home / zpabuin / Downloads / Fedora-Live-LXDE-x86_64-19-1.iso, if = none, id = drive-ide0-1-0, readonly = on, format = raw: could not open disk image /home/zpabuin/Descargas/Fedora-Live-LXDE-x86_64-19-1.iso: Permission denied
    '

    Traceback (most recent call last):
    File "/usr/share/virt-manager/virtManager/asyncjob.py", line 100, in cb_wrapper
    callback (asyncjob, * args, ** kwargs)
    File "/usr/share/virt-manager/virtManager/create.py", line 1920, in do_install
    guest.start_install (False, meter = meter)
    File "/usr/share/virt-manager/virtinst/Guest.py", line 1134, in start_install
    noboot)
    File "/usr/share/virt-manager/virtinst/Guest.py", line 1202, in _create_guest
    dom = self.conn.createLinux (start_xml or final_xml, 0)
    File "/usr/lib/python2.7/site-packages/libvirt.py", line 2892, in createLinux
    if ret is None: raise libvirtError ('virDomainCreateLinux () failed', conn = self)
    libvirtError: internal error: process ended while connecting to monitor: char device redirected to / dev / pts / 0 (label charserial0)
    qemu-system-x86_64: -drive file = / home / zpabuin / Downloads / Fedora-Live-LXDE-x86_64-19-1.iso, if = none, id = drive-ide0-1-0, readonly = on, format = raw: could not open disk image /home/zpabuin/Descargas/Fedora-Live-LXDE-x86_64-19-1.iso: Permission denied

    Thanks, by the way virtinst is an outdated package on arch since May and not required.

  8.   Javier said

    Ask ...

    when I try to lift the kvm-intel kernel module (which is the processor that I have), it tells me:

    modprobe: ERROR: could not insert 'kvm_intel': Operation not supported

    Looking in my system I notice that the kvm-intel module exists in
    /usr/lib/modules/3.10.10-1-ARCH/kernel/arch/x86/kvm/kvm-intel.ko.gz

    (and yes, running egrep -c "(svm | vmx)" / proc / cpuinfo is certain that it should support virtualization here)

    My question is twofold:

    -I won't need to enable / enable something in my kernel to support this?
    -My system is 64 bits and I see that the module lives in x86, is it because of this? In which case I ask, are there 64-bit modules that I can install and stop nagging at me?

    thanks in advance!

    1.    Javier said

      Problem solved, I need to enable virtualization in the BIOS of my system ... 🙂

      thanks!

  9.   leonardopc1991 said

    I get that it cannot find this file «virtinst»

    1.    maykel535 said

      The virtinst package I have not installed, because it is no longer in the repos.

      I get the same error as Xorlogs:

      Unable to complete installation: 'Internal error: process ended while connecting to monitor: qemu-system-x86_64: -drive file = / home / maykel / archlinux-2013.10.01-dual.iso, if = none, id = drive-ide0-1-0, readonly = on, format = raw: could not open disk image /home/maykel/archlinux-2013.10.01-dual.iso: Permission denied
      '

      Traceback (most recent call last):
      File "/usr/share/virt-manager/virtManager/asyncjob.py", line 100, in cb_wrapper
      callback (asyncjob, * args, ** kwargs)
      File "/usr/share/virt-manager/virtManager/create.py", line 1920, in do_install
      guest.start_install (False, meter = meter)
      File "/usr/share/virt-manager/virtinst/Guest.py", line 1134, in start_install
      noboot)
      File "/usr/share/virt-manager/virtinst/Guest.py", line 1202, in _create_guest
      dom = self.conn.createLinux (start_xml or final_xml, 0)
      File "/usr/lib/python2.7/site-packages/libvirt.py", line 2897, in createLinux
      if ret is None: raise libvirtError ('virDomainCreateLinux () failed', conn = self)
      libvirtError: Internal error: the process ended while connecting to the monitor: qemu-system-x86_64: -drive file = / home / maykel / archlinux-2013.10.01-dual.iso, if = none, id = drive-ide0 -1-0, readonly = on, format = raw: could not open disk image /home/maykel/archlinux-2013.10.01-dual.iso: Permission denied

      1.    elav said

        Right now what I have installed is:

        - libvirt
        - libvirt-glib
        - virt-manager
        - virtviewer

        Check 😉

        1.    maykel535 said

          Have you updated arch ?? You have seen the nice bug in virt-manager with the update virt-manager 0.10.0-4

          Error: 'NoneType' object has no attribute '__getitem__'

          https://bugs.archlinux.org/task/37990

  10.   Sound Alchemist said

    Your tutorial is fine, and thanks to the virt-manager it works almost without problems, in your note you do not explain what .img permissions are added to, and I have not been able to create a virtual machine

  11.   edo said

    The virtinst package does not exist, it also tells me “openbsd-netcat and gnu-netcat are in conflict. Remove gnu-netcat? [y / n] ', so I can't leave gnu-netcat?

  12.   Manuel said

    hello oie I have a samsung chromebook the model I think is Snow Clear, I want to know if Qemu can be installed on an ARM base, I know how to install ubuntu, in fact I uninstalled it for the simple fact that I could not run exe files, wine does not run on this base only with intel, but that seems to be yes, but I don't know how to install it: / hope you give me an answer soon, thanks, good job.

  13.   tau said

    If I remember correctly, KVM serves to speed up qemu. Since qemu emulates the entire processor it is slower than virtual machines like virtualbox. So from what I know KVM makes qemu behave like a virtual machine when the architecture of the guest is the same as the host. No ?. Anyway interesting the article.

    Qemu rox!!

    Greetings.

  14.   Roberto said

    Good afternoon, thanks for the tutorial I was looking for it, but I need you to please give me a hand, on how to install a virtual machine on an external disk, not use the host physical space, thanks

  15.   Page Asgardius said

    In the part where the kernel modules are activated with modprobe, those corresponding to the cpu are actually activated, since kvm uses the virtualization instructions of the cpu to work. I have a pc with intel cpu and amd gpu and it worked this way for me