GNU bug report logs - #22633
Provide a kvm-less qemu / guix system vm

Previous Next

Package: guix;

Reported by: Christopher Allan Webber <cwebber <at> dustycloud.org>

Date: Thu, 11 Feb 2016 17:27:02 UTC

Severity: normal

Done: Christopher Allan Webber <cwebber <at> dustycloud.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22633 in the body.
You can then email your comments to 22633 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Thu, 11 Feb 2016 17:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Allan Webber <cwebber <at> dustycloud.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Thu, 11 Feb 2016 17:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: bug-guix <at> gnu.org
Subject: Provide a kvm-less qemu / guix system vm
Date: Thu, 11 Feb 2016 09:26:12 -0800
So on my Libreboot-enabled machine, KVM does not work.  In fact, even
starting qemu with KVM enabled on it appears to crash my whole system.
Not only does "guix system vm" not work, even "guix system vm-image" can
take the whole machine down!

It would be nice to have a --no-kvm switch, because I'd really like to
make use of Guix's nice VM features!

PS: Apparently in future revisions of Libreboot, this will be fixed.
  For now though...




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Thu, 11 Feb 2016 22:54:02 GMT) Full text and rfc822 format available.

Message #8 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Jookia <166291 <at> gmail.com>
To: Christopher Allan Webber <cwebber <at> dustycloud.org>
Cc: 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Fri, 12 Feb 2016 09:50:09 +1100
On Thu, Feb 11, 2016 at 09:26:12AM -0800, Christopher Allan Webber wrote:
> So on my Libreboot-enabled machine, KVM does not work.  In fact, even
> starting qemu with KVM enabled on it appears to crash my whole system.
> Not only does "guix system vm" not work, even "guix system vm-image" can
> take the whole machine down!

Currently the 'solution' I've found is to edit Guix to remove the two instances
of '--enable-kvm' which works somewhat, though it's slower as there's absolutely
no acceleration.

> It would be nice to have a --no-kvm switch, because I'd really like to
> make use of Guix's nice VM features!

We should probably also blacklist kvm on Libreboot machines too somehow, though
this could also break it on non-Libreboot machines. I wonder if there's a way to
query the BIOS to see if Libreboot is enabled?

> PS: Apparently in future revisions of Libreboot, this will be fixed.
>   For now though...

Oh really? I was under the impression this was broken due to microcode issues.

Jookia.




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Fri, 12 Feb 2016 00:50:01 GMT) Full text and rfc822 format available.

Message #11 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Jookia <166291 <at> gmail.com>
Cc: Christopher Allan Webber <cwebber <at> dustycloud.org>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Thu, 11 Feb 2016 19:49:19 -0500
[Message part 1 (text/plain, inline)]
On Fri, Feb 12, 2016 at 09:50:09AM +1100, Jookia wrote:
> On Thu, Feb 11, 2016 at 09:26:12AM -0800, Christopher Allan Webber wrote:
> > So on my Libreboot-enabled machine, KVM does not work.  In fact, even
> > starting qemu with KVM enabled on it appears to crash my whole system.
> > Not only does "guix system vm" not work, even "guix system vm-image" can
> > take the whole machine down!
> 
> Currently the 'solution' I've found is to edit Guix to remove the two instances
> of '--enable-kvm' which works somewhat, though it's slower as there's absolutely
> no acceleration.
> 
> > It would be nice to have a --no-kvm switch, because I'd really like to
> > make use of Guix's nice VM features!

It's not a proper fix, but this patch achieves that on my non-Libreboot
machine. Can you see if it works for you?

[...]
[disable-kvm.patch (text/x-diff, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Fri, 12 Feb 2016 09:03:02 GMT) Full text and rfc822 format available.

Message #14 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Jookia <166291 <at> gmail.com>
Cc: Christopher Allan Webber <cwebber <at> dustycloud.org>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Fri, 12 Feb 2016 10:02:01 +0100
Jookia <166291 <at> gmail.com> skribis:

> We should probably also blacklist kvm on Libreboot machines too somehow,

A simple way to achieve this is with:

  (operating-system
    ;; …
    (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm")))

But I guess ‘guix system vm’ will now fail.

We could change the two occurrences of ‘-enable-kvm’ to use this flag if
and only if /dev/kvm exists (I think it doesn’t exist when the kvm
modules are not loaded.)

Thoughts?

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Fri, 12 Feb 2016 17:48:02 GMT) Full text and rfc822 format available.

Message #17 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Jookia <166291 <at> gmail.com>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Fri, 12 Feb 2016 09:47:44 -0800
Ludovic Courtès writes:

> Jookia <166291 <at> gmail.com> skribis:
>
>> We should probably also blacklist kvm on Libreboot machines too somehow,
>
> A simple way to achieve this is with:
>
>   (operating-system
>     ;; …
>     (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm")))

I tried this:

  (operating-system
    (kernel linux-libre-4.1)
    (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm"))
    ...)

The generated Grub configuration looks right:

  menuentry "GNU with Linux-Libre 4.1.17 (alpha)" {
    search --label --set guix
    linux /gnu/store/k3l4g22vypwniy0k3f8xha9l8p1s716d-linux-libre-4.1.17/bzImage --root=guix --system=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system --load=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/boot modprobe.blacklist=kvm-intel,kvm
    initrd /gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/initrd
  }

Unfortunately, after rebooting into it:

  cwebber <at> oolong:~$ lsmod | grep kvm
  kvm_intel             155648  0
  kvm                   491520  1 kvm_intel
  cwebber <at> oolong:~$ ls /dev/kvm
  /dev/kvm

Not sure why it didn't seem to do anything...

> But I guess ‘guix system vm’ will now fail.
>
> We could change the two occurrences of ‘-enable-kvm’ to use this flag if
> and only if /dev/kvm exists (I think it doesn’t exist when the kvm
> modules are not loaded.)

If we could really get kvm blocked, I could write this patch.

> Thoughts?
>
> Ludo’.





Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Fri, 12 Feb 2016 18:05:01 GMT) Full text and rfc822 format available.

Message #20 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: Leo Famulari <leo <at> famulari.name>
Cc: Jookia <166291 <at> gmail.com>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Fri, 12 Feb 2016 10:04:47 -0800
Leo Famulari writes:

> On Fri, Feb 12, 2016 at 09:50:09AM +1100, Jookia wrote:
>> On Thu, Feb 11, 2016 at 09:26:12AM -0800, Christopher Allan Webber wrote:
>> > So on my Libreboot-enabled machine, KVM does not work.  In fact, even
>> > starting qemu with KVM enabled on it appears to crash my whole system.
>> > Not only does "guix system vm" not work, even "guix system vm-image" can
>> > take the whole machine down!
>> 
>> Currently the 'solution' I've found is to edit Guix to remove the two instances
>> of '--enable-kvm' which works somewhat, though it's slower as there's absolutely
>> no acceleration.
>> 
>> > It would be nice to have a --no-kvm switch, because I'd really like to
>> > make use of Guix's nice VM features!
>
> It's not a proper fix, but this patch achieves that on my non-Libreboot
> machine. Can you see if it works for you?
>
> [...]

Good news there, that does work and I am able to boot a VM through that
route!

I would really like to be able to protect myself from accidentally
crashing my system by making sure that if /dev/kvm is not there that we
don't do --enable-kvm, so maybe I could do that if we can figure out how
to make blacklisting actually work.  In the meanwhile, maybe I should
add a --no-kvm flag to "guix system vm"?




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Sat, 13 Feb 2016 00:48:01 GMT) Full text and rfc822 format available.

Message #23 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Christopher Allan Webber <cwebber <at> dustycloud.org>
Cc: Jookia <166291 <at> gmail.com>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Fri, 12 Feb 2016 19:47:14 -0500
On Fri, Feb 12, 2016 at 10:04:47AM -0800, Christopher Allan Webber wrote:
> Leo Famulari writes:
> 
> > On Fri, Feb 12, 2016 at 09:50:09AM +1100, Jookia wrote:
> >> On Thu, Feb 11, 2016 at 09:26:12AM -0800, Christopher Allan Webber wrote:
> >> > So on my Libreboot-enabled machine, KVM does not work.  In fact, even
> >> > starting qemu with KVM enabled on it appears to crash my whole system.
> >> > Not only does "guix system vm" not work, even "guix system vm-image" can
> >> > take the whole machine down!
> >> 
> >> Currently the 'solution' I've found is to edit Guix to remove the two instances
> >> of '--enable-kvm' which works somewhat, though it's slower as there's absolutely
> >> no acceleration.
> >> 
> >> > It would be nice to have a --no-kvm switch, because I'd really like to
> >> > make use of Guix's nice VM features!
> >
> > It's not a proper fix, but this patch achieves that on my non-Libreboot
> > machine. Can you see if it works for you?
> >
> > [...]
> 
> Good news there, that does work and I am able to boot a VM through that
> route!
> 
> I would really like to be able to protect myself from accidentally
> crashing my system by making sure that if /dev/kvm is not there that we
> don't do --enable-kvm, so maybe I could do that if we can figure out how
> to make blacklisting actually work.  In the meanwhile, maybe I should
> add a --no-kvm flag to "guix system vm"?

We definitely want to automatically disable KVM if it's not available.
But I think it would also be useful to have a --no-kvm option.




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Sat, 13 Feb 2016 19:11:01 GMT) Full text and rfc822 format available.

Message #26 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Alex Kost <alezost <at> gmail.com>
To: Christopher Allan Webber <cwebber <at> dustycloud.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Sat, 13 Feb 2016 22:10:19 +0300
Christopher Allan Webber (2016-02-12 20:47 +0300) wrote:

> Ludovic Courtès writes:
>
>> Jookia <166291 <at> gmail.com> skribis:
>>
>>> We should probably also blacklist kvm on Libreboot machines too somehow,
>>
>> A simple way to achieve this is with:
>>
>>   (operating-system
>>     ;; …
>>     (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm")))
>
> I tried this:
>
>   (operating-system
>     (kernel linux-libre-4.1)
>     (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm"))
>     ...)
>
> The generated Grub configuration looks right:
>
>   menuentry "GNU with Linux-Libre 4.1.17 (alpha)" {
>     search --label --set guix
>     linux /gnu/store/k3l4g22vypwniy0k3f8xha9l8p1s716d-linux-libre-4.1.17/bzImage --root=guix --system=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system --load=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/boot modprobe.blacklist=kvm-intel,kvm
>     initrd /gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/initrd
>   }
>
> Unfortunately, after rebooting into it:
>
>   cwebber <at> oolong:~$ lsmod | grep kvm
>   kvm_intel             155648  0
>   kvm                   491520  1 kvm_intel
>   cwebber <at> oolong:~$ ls /dev/kvm
>   /dev/kvm
>
> Not sure why it didn't seem to do anything...

I had the same issue.  Some time ago I tried:

  (kernel-arguments '("modprobe.blacklist=pcspkr"))

but "pcspkr" was also listed in lsmod.

-- 
Alex




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Sun, 21 Feb 2016 12:08:01 GMT) Full text and rfc822 format available.

Message #29 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Christopher Allan Webber <cwebber <at> dustycloud.org>
Cc: Jookia <166291 <at> gmail.com>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Sun, 21 Feb 2016 13:06:51 +0100
Christopher Allan Webber <cwebber <at> dustycloud.org> skribis:

> I tried this:
>
>   (operating-system
>     (kernel linux-libre-4.1)
>     (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm"))
>     ...)
>
> The generated Grub configuration looks right:
>
>   menuentry "GNU with Linux-Libre 4.1.17 (alpha)" {
>     search --label --set guix
>     linux /gnu/store/k3l4g22vypwniy0k3f8xha9l8p1s716d-linux-libre-4.1.17/bzImage --root=guix --system=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system --load=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/boot modprobe.blacklist=kvm-intel,kvm
>     initrd /gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/initrd
>   }
>
> Unfortunately, after rebooting into it:
>
>   cwebber <at> oolong:~$ lsmod | grep kvm
>   kvm_intel             155648  0
>   kvm                   491520  1 kvm_intel
>   cwebber <at> oolong:~$ ls /dev/kvm
>   /dev/kvm
>
> Not sure why it didn't seem to do anything...

Libkmod honors ‘modprobe.blacklist’ (in ‘kcmdline_parse_result’ in
libkmod-config.c) and eudev passes KMOD_PROBE_APPLY_BLACKLIST
unconditionally in udev-builtin-kmod.c (meaning it honors it too.)

However, there’s a hyphen-vs-underscore issue, I think.  Namely, the
file is called ‘kvm-intel.ko’, but the normalized module name is
‘kvm_intel’, and this is what libkmod expects (commit 5c7dd5a changes
our code to normalize module names similarly.)

Could you try with “modprobe.blacklist=kvm_intel”?

TIA,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Sun, 21 Feb 2016 12:10:02 GMT) Full text and rfc822 format available.

Message #32 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Alex Kost <alezost <at> gmail.com>
Cc: Christopher Allan Webber <cwebber <at> dustycloud.org>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Sun, 21 Feb 2016 13:09:34 +0100
Alex Kost <alezost <at> gmail.com> skribis:

> I had the same issue.  Some time ago I tried:
>
>   (kernel-arguments '("modprobe.blacklist=pcspkr"))
>
> but "pcspkr" was also listed in lsmod.

I can’t reproduce it.  Do you have a system config that exhibits this in
‘guix system vm’?

Note that the ‘modprobe pcspkr’ will load the module; you have to use
‘modprobe --use-blacklist pcspkr’ if you want it to honor the black list
(which is a questionable default IMO.)

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Mon, 22 Feb 2016 18:57:02 GMT) Full text and rfc822 format available.

Message #35 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Jookia <166291 <at> gmail.com>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Mon, 22 Feb 2016 10:56:02 -0800
Ludovic Courtès writes:

> Libkmod honors ‘modprobe.blacklist’ (in ‘kcmdline_parse_result’ in
> libkmod-config.c) and eudev passes KMOD_PROBE_APPLY_BLACKLIST
> unconditionally in udev-builtin-kmod.c (meaning it honors it too.)
>
> However, there’s a hyphen-vs-underscore issue, I think.  Namely, the
> file is called ‘kvm-intel.ko’, but the normalized module name is
> ‘kvm_intel’, and this is what libkmod expects (commit 5c7dd5a changes
> our code to normalize module names similarly.)
>
> Could you try with “modprobe.blacklist=kvm_intel”?

I tried it, and it works!  This does mean that /dev/kvm doesn't exist,
so I should be able to write a patch to Guix that disables kvm for qemu
when /dev/kvm is absent.  Great! :)




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Mon, 22 Feb 2016 19:36:01 GMT) Full text and rfc822 format available.

Message #38 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Mon, 22 Feb 2016 11:35:30 -0800
[Message part 1 (text/plain, inline)]
Christopher Allan Webber writes:

> Ludovic Courtès writes:
>
>> Libkmod honors ‘modprobe.blacklist’ (in ‘kcmdline_parse_result’ in
>> libkmod-config.c) and eudev passes KMOD_PROBE_APPLY_BLACKLIST
>> unconditionally in udev-builtin-kmod.c (meaning it honors it too.)
>>
>> However, there’s a hyphen-vs-underscore issue, I think.  Namely, the
>> file is called ‘kvm-intel.ko’, but the normalized module name is
>> ‘kvm_intel’, and this is what libkmod expects (commit 5c7dd5a changes
>> our code to normalize module names similarly.)
>>
>> Could you try with “modprobe.blacklist=kvm_intel”?
>
> I tried it, and it works!  This does mean that /dev/kvm doesn't exist,
> so I should be able to write a patch to Guix that disables kvm for qemu
> when /dev/kvm is absent.  Great! :)

This is slightly based off of Leo's preliminary patch, so I included him
in the copyright headers.  I've tested and it works (in terms of
disabling kvm if no /dev/kvm is present) here.

Let me know if I need to fix something or if I should push...

[0001-vm-Only-pass-enable-kvm-to-qemu-if-dev-kvm-is-presen.patch (text/x-patch, inline)]
From 852e0049213a0a80cacdcad4aba13ab242c3fbd8 Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber <cwebber <at> dustycloud.org>
Date: Mon, 22 Feb 2016 11:23:14 -0800
Subject: [PATCH] vm: Only pass "-enable-kvm" to qemu if /dev/kvm is present.

* gnu/build/vm.scm (load-in-linux-vm): Only pass "-enable-kvm" flag to qemu
  if "/dev/kvm" is present.
* gnu/system/vm.scm (common-kvm-options): Same as above.
---
 gnu/build/vm.scm  | 19 ++++++++++++++-----
 gnu/system/vm.scm | 10 +++++++++-
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index a095f9d..823156d 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -1,5 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2016 Christopher Allan Webber <cwebber <at> dustycloud.org>
+;;; Copyright © 2016 Leo Famulari <leo <at> famulari.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -97,7 +99,7 @@ the #:references-graphs parameter of 'derivation'."
     (_ #f))
 
   (unless (zero?
-           (apply system* qemu "-enable-kvm" "-nographic" "-no-reboot"
+           (apply system* qemu "-nographic" "-no-reboot"
                   "-m" (number->string memory-size)
                   "-net" "nic,model=virtio"
                   "-virtfs"
@@ -111,10 +113,17 @@ the #:references-graphs parameter of 'derivation'."
                   "-initrd" initrd
                   "-append" (string-append "console=ttyS0 --load="
                                            builder)
-                  (if make-disk-image?
-                      `("-drive" ,(string-append "file=" image-file
-                                                 ",if=virtio"))
-                      '())))
+                  (append
+                   (if make-disk-image?
+                       `("-drive" ,(string-append "file=" image-file
+                                                  ",if=virtio"))
+                       '())
+                   ;; Only enable kvm if we see /dev/kvm exists.
+                   ;; This allows uers without hardware virtualization to still use these
+                   ;; commands.
+                   (if (file-exists? "/dev/kvm")
+                       '("-enable-kvm")
+                       '()))))
     (error "qemu failed" qemu))
 
   (if make-disk-image?
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index a7c03bd..5235ee3 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -1,5 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2016 Christopher Allan Webber <cwebber <at> dustycloud.org>
+;;; Copyright © 2016 Leo Famulari <leo <at> famulari.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -457,7 +459,13 @@ with '-virtfs' options for the host file systems listed in SHARED-FS."
                      "\" "))
 
   #~(string-append
-     " -enable-kvm -no-reboot -net nic,model=virtio \
+     ;; Only enable kvm if we see /dev/kvm exists.
+     ;; This allows uers without hardware virtualization to still use these
+     ;; commands.
+     #$(if (file-exists? "/dev/kvm")
+           " -enable-kvm "
+           "")
+     " -no-reboot -net nic,model=virtio \
   " #$@(map virtfs-option shared-fs) " \
   -net user \
   -serial stdio -vga std \
-- 
2.6.3


Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Mon, 22 Feb 2016 19:46:02 GMT) Full text and rfc822 format available.

Message #41 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Jookia <166291 <at> gmail.com>
To: Christopher Allan Webber <cwebber <at> dustycloud.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Tue, 23 Feb 2016 06:43:02 +1100
On Mon, Feb 22, 2016 at 11:35:30AM -0800, Christopher Allan Webber wrote:
>    #~(string-append
> -     " -enable-kvm -no-reboot -net nic,model=virtio \
> +     ;; Only enable kvm if we see /dev/kvm exists.
> +     ;; This allows uers without hardware virtualization to still use these
> +     ;; commands.
> +     #$(if (file-exists? "/dev/kvm")
> +           " -enable-kvm "
> +           "")
> +     " -no-reboot -net nic,model=virtio \
>    " #$@(map virtfs-option shared-fs) " \
>    -net user \
>    -serial stdio -vga std \
> -- 
> 2.6.3

What if I enable KVM then run the script?

Jookia.




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Mon, 22 Feb 2016 21:10:01 GMT) Full text and rfc822 format available.

Message #44 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Christopher Allan Webber <cwebber <at> dustycloud.org>
Cc: 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Mon, 22 Feb 2016 22:09:36 +0100
Christopher Allan Webber <cwebber <at> dustycloud.org> skribis:

> Christopher Allan Webber writes:
>
>> Ludovic Courtès writes:
>>
>>> Libkmod honors ‘modprobe.blacklist’ (in ‘kcmdline_parse_result’ in
>>> libkmod-config.c) and eudev passes KMOD_PROBE_APPLY_BLACKLIST
>>> unconditionally in udev-builtin-kmod.c (meaning it honors it too.)
>>>
>>> However, there’s a hyphen-vs-underscore issue, I think.  Namely, the
>>> file is called ‘kvm-intel.ko’, but the normalized module name is
>>> ‘kvm_intel’, and this is what libkmod expects (commit 5c7dd5a changes
>>> our code to normalize module names similarly.)
>>>
>>> Could you try with “modprobe.blacklist=kvm_intel”?
>>
>> I tried it, and it works!  This does mean that /dev/kvm doesn't exist,
>> so I should be able to write a patch to Guix that disables kvm for qemu
>> when /dev/kvm is absent.  Great! :)
>
> This is slightly based off of Leo's preliminary patch, so I included him
> in the copyright headers.  I've tested and it works (in terms of
> disabling kvm if no /dev/kvm is present) here.

Cool!  Can you just double-check whether -enable-kvm has any effect when
/dev/kvm is missing?  If it has no effect when /dev/kvm is missing, then
we don’t even need a patch.

> Let me know if I need to fix something or if I should push...
>
> From 852e0049213a0a80cacdcad4aba13ab242c3fbd8 Mon Sep 17 00:00:00 2001
> From: Christopher Allan Webber <cwebber <at> dustycloud.org>
> Date: Mon, 22 Feb 2016 11:23:14 -0800
> Subject: [PATCH] vm: Only pass "-enable-kvm" to qemu if /dev/kvm is present.
>
> * gnu/build/vm.scm (load-in-linux-vm): Only pass "-enable-kvm" flag to qemu
>   if "/dev/kvm" is present.
> * gnu/system/vm.scm (common-kvm-options): Same as above.

[...]

> +                   ;; Only enable kvm if we see /dev/kvm exists.
> +                   ;; This allows uers without hardware virtualization to still use these
                                     ^^
Typo.

[...]

> +     ;; Only enable kvm if we see /dev/kvm exists.
> +     ;; This allows uers without hardware virtualization to still use these

Ditto.

Otherwise the patch LGTM.  Make sure to mention:

  Fixes <http://bugs.gnu.org/22633>.

in the commit log.

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Mon, 22 Feb 2016 21:28:02 GMT) Full text and rfc822 format available.

Message #47 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: Jookia <166291 <at> gmail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Mon, 22 Feb 2016 13:27:11 -0800
Jookia writes:

> On Mon, Feb 22, 2016 at 11:35:30AM -0800, Christopher Allan Webber wrote:
>>    #~(string-append
>> -     " -enable-kvm -no-reboot -net nic,model=virtio \
>> +     ;; Only enable kvm if we see /dev/kvm exists.
>> +     ;; This allows uers without hardware virtualization to still use these
>> +     ;; commands.
>> +     #$(if (file-exists? "/dev/kvm")
>> +           " -enable-kvm "
>> +           "")
>> +     " -no-reboot -net nic,model=virtio \
>>    " #$@(map virtfs-option shared-fs) " \
>>    -net user \
>>    -serial stdio -vga std \
>> -- 
>> 2.6.3
>
> What if I enable KVM then run the script?
>
> Jookia.

Then it should use KVM.




Reply sent to Christopher Allan Webber <cwebber <at> dustycloud.org>:
You have taken responsibility. (Mon, 22 Feb 2016 21:31:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Allan Webber <cwebber <at> dustycloud.org>:
bug acknowledged by developer. (Mon, 22 Feb 2016 21:31:02 GMT) Full text and rfc822 format available.

Message #52 received at 22633-done <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 22633-done <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Mon, 22 Feb 2016 13:30:21 -0800
Ludovic Courtès writes:

> Christopher Allan Webber <cwebber <at> dustycloud.org> skribis:
>
>> Christopher Allan Webber writes:
>>
>>> Ludovic Courtès writes:
>>>
>>>> Libkmod honors ‘modprobe.blacklist’ (in ‘kcmdline_parse_result’ in
>>>> libkmod-config.c) and eudev passes KMOD_PROBE_APPLY_BLACKLIST
>>>> unconditionally in udev-builtin-kmod.c (meaning it honors it too.)
>>>>
>>>> However, there’s a hyphen-vs-underscore issue, I think.  Namely, the
>>>> file is called ‘kvm-intel.ko’, but the normalized module name is
>>>> ‘kvm_intel’, and this is what libkmod expects (commit 5c7dd5a changes
>>>> our code to normalize module names similarly.)
>>>>
>>>> Could you try with “modprobe.blacklist=kvm_intel”?
>>>
>>> I tried it, and it works!  This does mean that /dev/kvm doesn't exist,
>>> so I should be able to write a patch to Guix that disables kvm for qemu
>>> when /dev/kvm is absent.  Great! :)
>>
>> This is slightly based off of Leo's preliminary patch, so I included him
>> in the copyright headers.  I've tested and it works (in terms of
>> disabling kvm if no /dev/kvm is present) here.
>
> Cool!  Can you just double-check whether -enable-kvm has any effect when
> /dev/kvm is missing?  If it has no effect when /dev/kvm is missing, then
> we don’t even need a patch.

I checked yes; qemu fails.

>> Let me know if I need to fix something or if I should push...
>>
>> From 852e0049213a0a80cacdcad4aba13ab242c3fbd8 Mon Sep 17 00:00:00 2001
>> From: Christopher Allan Webber <cwebber <at> dustycloud.org>
>> Date: Mon, 22 Feb 2016 11:23:14 -0800
>> Subject: [PATCH] vm: Only pass "-enable-kvm" to qemu if /dev/kvm is present.
>>
>> * gnu/build/vm.scm (load-in-linux-vm): Only pass "-enable-kvm" flag to qemu
>>   if "/dev/kvm" is present.
>> * gnu/system/vm.scm (common-kvm-options): Same as above.
>
> [...]
>
>> +                   ;; Only enable kvm if we see /dev/kvm exists.
>> +                   ;; This allows uers without hardware virtualization to still use these
>                                      ^^
> Typo.
>
> [...]
>
>> +     ;; Only enable kvm if we see /dev/kvm exists.
>> +     ;; This allows uers without hardware virtualization to still use these
>
> Ditto.

Okay, fixed those.

> Otherwise the patch LGTM.  Make sure to mention:
>
>   Fixes <http://bugs.gnu.org/22633>.
>
> in the commit log.

Mentioned, committed, pushed!




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Tue, 23 Feb 2016 08:10:02 GMT) Full text and rfc822 format available.

Message #55 received at 22633 <at> debbugs.gnu.org (full text, mbox):

From: Alex Kost <alezost <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 22633 <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Tue, 23 Feb 2016 11:08:59 +0300
Ludovic Courtès (2016-02-21 15:09 +0300) wrote:

> Alex Kost <alezost <at> gmail.com> skribis:
>
>> I had the same issue.  Some time ago I tried:
>>
>>   (kernel-arguments '("modprobe.blacklist=pcspkr"))
>>
>> but "pcspkr" was also listed in lsmod.
>
> I can’t reproduce it.  Do you have a system config that exhibits this in
> ‘guix system vm’?

Oops, my bad.  Since I use my own "grub.cfg", obviously it wasn't
updated :-)

Now I confirm that adding "modprobe.blacklist=pcspkr" argument to
'linux' line works.  Sorry for the noize.

-- 
Alex




Information forwarded to bug-guix <at> gnu.org:
bug#22633; Package guix. (Tue, 23 Feb 2016 16:15:02 GMT) Full text and rfc822 format available.

Message #58 received at 22633-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Christopher Allan Webber <cwebber <at> dustycloud.org>
Cc: 22633-done <at> debbugs.gnu.org
Subject: Re: bug#22633: Provide a kvm-less qemu / guix system vm
Date: Tue, 23 Feb 2016 17:13:54 +0100
Christopher Allan Webber <cwebber <at> dustycloud.org> skribis:

> Mentioned, committed, pushed!

Thanks!

Ludo'.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Mar 2016 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.