GNU bug report logs - #38513
[PATCH] gnu: Remove uses of deprecated Qemu "-nic, model=foo" invokations.

Previous Next

Package: guix-patches;

Reported by: Marius Bakke <mbakke <at> fastmail.com>

Date: Fri, 6 Dec 2019 21:14:02 UTC

Severity: normal

Tags: patch

Done: Marius Bakke <mbakke <at> fastmail.com>

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 38513 in the body.
You can then email your comments to 38513 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 guix-patches <at> gnu.org:
bug#38513; Package guix-patches. (Fri, 06 Dec 2019 21:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Marius Bakke <mbakke <at> fastmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 06 Dec 2019 21:14:02 GMT) Full text and rfc822 format available.

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

From: Marius Bakke <mbakke <at> fastmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Remove uses of deprecated Qemu "-nic,
 model=foo" invokations.
Date: Fri,  6 Dec 2019 22:13:04 +0100
* gnu/build/vm.scm (load-in-linux-vm): Move Qemu network configuration from
ARCH-SPECIFIC-FLAGS to the Qemu command line.  Use the "-nic" option of Qemu
instead of "-device" and "-net".
* gnu/system/vm.scm (common-qemu-options): Change "-net nic ..." to "-nic user ...".
* doc/guix.texi (Installing Guix in a VM, Running Guix in a VM): Adjust
examples accordingly.
---
 doc/guix.texi     | 16 +++++++---------
 gnu/build/vm.scm  | 10 ++--------
 gnu/system/vm.scm |  2 +-
 3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 7d50f31d20..31f26694fd 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -46,7 +46,7 @@ Copyright @copyright{} 2017, 2018 Carlo Zancanaro@*
 Copyright @copyright{} 2017 Thomas Danckaert@*
 Copyright @copyright{} 2017 humanitiesNerd@*
 Copyright @copyright{} 2017 Christopher Allan Webber@*
-Copyright @copyright{} 2017, 2018 Marius Bakke@*
+Copyright @copyright{} 2017, 2018, 2019 Marius Bakke@*
 Copyright @copyright{} 2017, 2019 Hartmut Goebel@*
 Copyright @copyright{} 2017, 2019 Maxim Cournoyer@*
 Copyright @copyright{} 2017, 2018, 2019 Tobias Geerinckx-Rice@*
@@ -2472,7 +2472,7 @@ Boot the USB installation image in an VM:
 
 @example
 qemu-system-x86_64 -m 1024 -smp 1 -enable-kvm \
-  -net user -net nic,model=virtio -boot menu=on,order=d \
+  -nic user,model=virtio-net-pci -boot menu=on,order=d \
   -drive file=guix-system.img \
   -drive media=cdrom,file=guix-system-install-@value{VERSION}.@var{system}.iso
 @end example
@@ -26514,7 +26514,7 @@ vm-image} on x86_64 hardware:
 
 @example
 $ qemu-system-x86_64 \
-   -net user -net nic,model=virtio \
+   -nic user,model=virtio-net-pci \
    -enable-kvm -m 1024 \
    -device virtio-blk,drive=myhd \
    -drive if=none,file=/tmp/qemu-image,id=myhd
@@ -26527,14 +26527,12 @@ Here is what each of these options means:
 This specifies the hardware platform to emulate.  This should match the
 host.
 
-@item -net user
+@item -nic user,model=virtio-net-pci
 Enable the unprivileged user-mode network stack.  The guest OS can
 access the host but not vice versa.  This is the simplest way to get the
-guest OS online.
-
-@item -net nic,model=virtio
-You must create a network interface of a given model.  If you do not
-create a NIC, the boot will fail.  Assuming your hardware platform is
+guest OS online.  @code{model} specifies which network device to emulate:
+@code{virtio-net-pci} is a special device made for virtualized operating
+systems and recommended for most uses.  Assuming your hardware platform is
 x86_64, you can get a list of available NIC models by running
 @command{qemu-system-x86_64 -net nic,model=help}.
 
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 89d685b352..9a9e5bd001 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -131,14 +131,7 @@ the #:references-graphs parameter of 'derivation'."
                       ;; The serial port name differs between emulated
                       ;; architectures/machines.
                       " console="
-                      (if target-arm? "ttyAMA0" "ttyS0"))
-
-      ;; NIC is not supported on ARM "virt" machine, so use a user mode
-      ;; network stack instead.
-      ,@(if target-arm?
-            '("-device" "virtio-net-pci,netdev=mynet"
-              "-netdev" "user,id=mynet")
-            '("-net" "nic,model=virtio"))))
+                      (if target-arm? "ttyAMA0" "ttyS0"))))
 
   (when make-disk-image?
     (format #t "creating ~a image of ~,2f MiB...~%"
@@ -163,6 +156,7 @@ the #:references-graphs parameter of 'derivation'."
          ;; CPU with the maximum possible feature set otherwise.
          "-cpu" "max"
          "-m" (number->string memory-size)
+         "-nic" "user,model=virtio-net-pci"
          "-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng"
          "-device" "virtio-rng-pci,rng=guixsd-vm-rng"
          "-virtfs"
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 8609bd2ace..5ee9855ae5 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -927,7 +927,7 @@ with '-virtfs' options for the host file systems listed in SHARED-FS."
             '())
 
      "-no-reboot"
-     "-net nic,model=virtio"
+     "-nic" "user,model=virtio-net-pci"
      "-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng"
      "-device" "virtio-rng-pci,rng=guixsd-vm-rng"
 
-- 
2.24.0





Information forwarded to guix-patches <at> gnu.org:
bug#38513; Package guix-patches. (Sun, 08 Dec 2019 02:32:02 GMT) Full text and rfc822 format available.

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

From: Leo Famulari <leo <at> famulari.name>
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 38513 <at> debbugs.gnu.org
Subject: Re: [bug#38513] [PATCH] gnu: Remove uses of deprecated Qemu "-nic,
 model=foo" invokations.
Date: Sat, 7 Dec 2019 12:52:40 -0500
Nit-pck: It should be "invocation".




Information forwarded to guix-patches <at> gnu.org:
bug#38513; Package guix-patches. (Sat, 14 Dec 2019 23:31:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 38513 <at> debbugs.gnu.org
Subject: Re: [bug#38513] [PATCH] gnu: Remove uses of deprecated Qemu "-nic,
 model=foo" invokations.
Date: Sun, 15 Dec 2019 00:30:16 +0100
Hi!

Marius Bakke <mbakke <at> fastmail.com> skribis:

> * gnu/build/vm.scm (load-in-linux-vm): Move Qemu network configuration from
> ARCH-SPECIFIC-FLAGS to the Qemu command line.  Use the "-nic" option of Qemu
> instead of "-device" and "-net".
> * gnu/system/vm.scm (common-qemu-options): Change "-net nic ..." to "-nic user ...".
> * doc/guix.texi (Installing Guix in a VM, Running Guix in a VM): Adjust
> examples accordingly.

Apart from the typo Leo noted, it LGTM!  :-)

Thanks,
Ludo’.




Reply sent to Marius Bakke <mbakke <at> fastmail.com>:
You have taken responsibility. (Wed, 18 Dec 2019 21:13:02 GMT) Full text and rfc822 format available.

Notification sent to Marius Bakke <mbakke <at> fastmail.com>:
bug acknowledged by developer. (Wed, 18 Dec 2019 21:13:02 GMT) Full text and rfc822 format available.

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

From: Marius Bakke <mbakke <at> fastmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 38513-done <at> debbugs.gnu.org
Subject: Re: [bug#38513] [PATCH] gnu: Remove uses of deprecated Qemu "-nic,
 model=foo" invokations.
Date: Wed, 18 Dec 2019 22:12:08 +0100
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi!
>
> Marius Bakke <mbakke <at> fastmail.com> skribis:
>
>> * gnu/build/vm.scm (load-in-linux-vm): Move Qemu network configuration from
>> ARCH-SPECIFIC-FLAGS to the Qemu command line.  Use the "-nic" option of Qemu
>> instead of "-device" and "-net".
>> * gnu/system/vm.scm (common-qemu-options): Change "-net nic ..." to "-nic user ...".
>> * doc/guix.texi (Installing Guix in a VM, Running Guix in a VM): Adjust
>> examples accordingly.
>
> Apart from the typo Leo noted, it LGTM!  :-)

I discovered a problem with our documentation when researching this
patch.  Qemu nowadays, with no "-nic" or related arguments, acts the
same as "-nic,model=e1000e".  So a full network is available by default,
unless one adds "-nic none".

The "Running Guix in a VM" section of the manual mentions Qemu
networking twice, and both are inaccurate or wrong.  It would be good to
reword that section.  Any takers?  :-)

In any case this patch will be pushed shortly.
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 16 Jan 2020 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 214 days ago.

Previous Next


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