From unknown Sat Jun 14 08:59:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#42252: Not possible to reliably port forward with "guix system vm" anymore Resent-From: Christopher Lemmer Webber Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 07 Jul 2020 20:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 42252 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 42252@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.159415442931032 (code B ref -1); Tue, 07 Jul 2020 20:41:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Jul 2020 20:40:29 +0000 Received: from localhost ([127.0.0.1]:36758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jsuOC-00084S-UV for submit@debbugs.gnu.org; Tue, 07 Jul 2020 16:40:29 -0400 Received: from lists.gnu.org ([209.51.188.17]:37444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jsuO9-00084G-9y for submit@debbugs.gnu.org; Tue, 07 Jul 2020 16:40:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsuO9-000825-2U for bug-guix@gnu.org; Tue, 07 Jul 2020 16:40:25 -0400 Received: from dustycloud.org ([50.116.34.160]:35100) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsuO7-0007mt-BW for bug-guix@gnu.org; Tue, 07 Jul 2020 16:40:24 -0400 Received: from twig (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 42C7B26617 for ; Tue, 7 Jul 2020 16:40:22 -0400 (EDT) User-agent: mu4e 1.4.9; emacs 26.3 From: Christopher Lemmer Webber Date: Tue, 07 Jul 2020 16:40:21 -0400 Message-ID: <87r1tnf496.fsf@dustycloud.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=50.116.34.160; envelope-from=cwebber@dustycloud.org; helo=dustycloud.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/07 16:18:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) In commit 5379392731b52eef22b4936637eb592b93e04318, the following change was introduced: modified gnu/system/vm.scm @@ -941,6 +941,7 @@ with '-virtfs' options for the host file systems listed in SHARED-FS." '()) "-no-reboot" + "-nic" "user,model=virtio-net-pci" "-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng" "-device" "virtio-rng-pci,rng=guixsd-vm-rng" Unfortunately, this means that in our docs where we suggest doing the following: `guix system vm config.scm` -nic user,model=virtio-net-pci,hostfwd=tcp::10022-:22 Since we now provide our own similar "-nic" field this creates a *second* network interface at the same address and there is a race as in terms of which handles connections. Depending on the race result, connections to the forwarded port may hang indefinitely. Ironically, this regression was introduced to solve another regression! >From the commit message: This fixes a regression introduced in 8e53fe2b91d2776bc1529e7b34967c8f1d9edc32 where 'guix system vm' would no longer be using virtio. What's the right solution? One could be that "guix system vm" itself could take an argument that sets up port forwarding in the generated shell script. Eg: guix system vm config.scm --hostfwd=tcp::10022-:22 --hostfwd=tcp::8888-:80 kind of ugly, but it could work. WDYT? - Chris From unknown Sat Jun 14 08:59:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#42252: Not possible to reliably port forward with "guix system vm" anymore Resent-From: Christopher Lemmer Webber Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 07 Jul 2020 21:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42252 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 42252@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1594155607646 (code B ref -1); Tue, 07 Jul 2020 21:01:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Jul 2020 21:00:07 +0000 Received: from localhost ([127.0.0.1]:36834 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jsuhD-00009n-GX for submit@debbugs.gnu.org; Tue, 07 Jul 2020 17:00:07 -0400 Received: from lists.gnu.org ([209.51.188.17]:55294) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jsuhB-00009G-SG for submit@debbugs.gnu.org; Tue, 07 Jul 2020 17:00:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsuhB-0000Nd-Jw for bug-guix@gnu.org; Tue, 07 Jul 2020 17:00:05 -0400 Received: from dustycloud.org ([50.116.34.160]:35114) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsuhA-000411-16 for bug-guix@gnu.org; Tue, 07 Jul 2020 17:00:05 -0400 Received: from twig (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 76E2826617 for ; Tue, 7 Jul 2020 17:00:02 -0400 (EDT) References: <87r1tnf496.fsf@dustycloud.org> User-agent: mu4e 1.4.9; emacs 26.3 From: Christopher Lemmer Webber In-reply-to: <87r1tnf496.fsf@dustycloud.org> Date: Tue, 07 Jul 2020 17:00:02 -0400 Message-ID: <87o8orf3cd.fsf@dustycloud.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=50.116.34.160; envelope-from=cwebber@dustycloud.org; helo=dustycloud.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/07 16:18:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Christopher Lemmer Webber writes: > guix system vm config.scm --hostfwd=tcp::10022-:22 --hostfwd=tcp::8888-:80 > > kind of ugly, but it could work. WDYT? Kind of uglier, but more versatile: guix system vm config.scm --nic=user,model=virtio-net-pci,hostfwd=tcp::10022-:22,hostfwd=tcp::8888-:80 From unknown Sat Jun 14 08:59:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#42252: Not possible to reliably port forward with "guix system vm" anymore Resent-From: Christopher Lemmer Webber Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 07 Jul 2020 22:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42252 X-GNU-PR-Package: guix X-GNU-PR-Keywords: Cc: 42252@debbugs.gnu.org X-Debbugs-Original-Cc: 42252@debbugs.gnu.org, bug-guix@gnu.org Received: via spool by 42252-submit@debbugs.gnu.org id=B42252.15941604818256 (code B ref 42252); Tue, 07 Jul 2020 22:22:02 +0000 Received: (at 42252) by debbugs.gnu.org; 7 Jul 2020 22:21:21 +0000 Received: from localhost ([127.0.0.1]:36900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jsvxp-000295-9U for submit@debbugs.gnu.org; Tue, 07 Jul 2020 18:21:21 -0400 Received: from dustycloud.org ([50.116.34.160]:33550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jsvxl-00028w-Pn for 42252@debbugs.gnu.org; Tue, 07 Jul 2020 18:21:19 -0400 Received: from twig (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 091EF26617; Tue, 7 Jul 2020 18:21:16 -0400 (EDT) References: <87r1tnf496.fsf@dustycloud.org> <87o8orf3cd.fsf@dustycloud.org> User-agent: mu4e 1.4.9; emacs 26.3 From: Christopher Lemmer Webber In-reply-to: <87o8orf3cd.fsf@dustycloud.org> Date: Tue, 07 Jul 2020 18:21:16 -0400 Message-ID: <87lfjvezkz.fsf@dustycloud.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Christopher Lemmer Webber writes: > Christopher Lemmer Webber writes: > >> guix system vm config.scm --hostfwd=tcp::10022-:22 --hostfwd=tcp::8888-:80 >> >> kind of ugly, but it could work. WDYT? > > Kind of uglier, but more versatile: [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.2 MISSING_HEADERS Missing To: header -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain Christopher Lemmer Webber writes: > Christopher Lemmer Webber writes: > >> guix system vm config.scm --hostfwd=tcp::10022-:22 --hostfwd=tcp::8888-:80 >> >> kind of ugly, but it could work. WDYT? > > Kind of uglier, but more versatile: > > guix system vm config.scm --nic=user,model=virtio-net-pci,hostfwd=tcp::10022-:22,hostfwd=tcp::8888-:80 Here's a patch that implements just that. Seems to work fine here! --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-guix-system-Add-nic-option-for-vm-subcommand.patch >From b008aad5d00fb6a87eb5a03d1849d6f52fb2307d Mon Sep 17 00:00:00 2001 From: Christopher Lemmer Webber Date: Tue, 7 Jul 2020 18:13:29 -0400 Subject: [PATCH] guix system: Add --nic option for 'vm' subcommand. This allows passing in explicit options for the qemu -nic keyword argument for use in port forwarding, etc. * (show-help, %options, process-action): Add and use command line argument of --nic for `guix system vm' and pass along appropriately. guix/scripts/system.scm (system-derivation-for-action): (perform-action): Define and use #:nic-options keyword. * gnu/system/vm.scm (common-qemu-options) (system-qemu-image/shared-store-script): Likewise. (default-nic-options): New variable. * doc/guix.texi (Running Guix in a VM): Use --nic argument in system vm port forwarding example. --- doc/guix.texi | 2 +- gnu/system/vm.scm | 16 ++++++++++++---- guix/scripts/system.scm | 18 ++++++++++++++---- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 992bc303bb..4e76eb832a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -28315,7 +28315,7 @@ To enable SSH inside a VM you need to add an SSH server like 22 by default, to the host. You can do this with @example -`guix system vm config.scm` -nic user,model=virtio-net-pci,hostfwd=tcp::10022-:22 +`guix system vm config.scm --nic=user,model=virtio-net-pci,hostfwd=tcp::10022-:22` @end example To connect to the VM you can run diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index f2b6b71b4d..78f89f6568 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -803,7 +803,11 @@ bootloader refers to: OS kernel, initrd, bootloader data, etc." #:register-closures? #f #:copy-inputs? full-boot?)) -(define* (common-qemu-options image shared-fs) +(define default-nic-options + "user,model=virtio-net-pci") + +(define* (common-qemu-options image shared-fs + #:key nic-options) "Return the a string-value gexp with the common QEMU options to boot IMAGE, with '-virtfs' options for the host file systems listed in SHARED-FS." @@ -819,7 +823,9 @@ with '-virtfs' options for the host file systems listed in SHARED-FS." '()) "-no-reboot" - "-nic" "user,model=virtio-net-pci" + + ;; Construct -nic while forwarding all --hostfwd=... options + "-nic" #$(or nic-options default-nic-options) "-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng" "-device" "virtio-rng-pci,rng=guixsd-vm-rng" @@ -840,7 +846,8 @@ with '-virtfs' options for the host file systems listed in SHARED-FS." (disk-image-size (* (if full-boot? 500 70) (expt 2 20))) - (options '())) + (options '()) + (nic-options #f)) "Return a derivation that builds a script to run a virtual machine image of OS that shares its store with the host. The virtual machine runs with MEMORY-SIZE MiB of memory. @@ -874,7 +881,8 @@ it is mostly useful when FULL-BOOT? is true." (string-join #$kernel-arguments " ")))) #$@(common-qemu-options image (map file-system-mapping-source - (cons %store-mapping mappings))) + (cons %store-mapping mappings)) + #:nic-options nic-options) "-m " (number->string #$memory-size) #$@options)) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 61eeec622b..32cea9b184 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -684,7 +684,7 @@ checking this by themselves in their 'check' procedure." (define* (system-derivation-for-action os base-image action #:key image-size file-system-type full-boot? container-shared-network? - mappings) + mappings nic-options) "Return as a monadic value the derivation for OS according to ACTION." (case action ((build init reconfigure) @@ -703,7 +703,8 @@ checking this by themselves in their 'check' procedure." (if full-boot? image-size (* 70 (expt 2 20))) - #:mappings mappings)) + #:mappings mappings + #:nic-options nic-options)) ((disk-image) (lower-object (system-image @@ -764,6 +765,7 @@ and TARGET arguments." use-substitutes? bootloader-target target image-size file-system-type full-boot? container-shared-network? + nic-options (mappings '()) (gc-root #f)) "Perform ACTION for OS. INSTALL-BOOTLOADER? specifies whether to install @@ -819,7 +821,8 @@ static checks." #:image-size image-size #:full-boot? full-boot? #:container-shared-network? container-shared-network? - #:mappings mappings)) + #:mappings mappings + #:nic-options nic-options)) ;; For 'init' and 'reconfigure', always build BOOTCFG, even if ;; --no-bootloader is passed, because we then use it as a GC root. @@ -965,6 +968,8 @@ Some ACTIONS support additional ARGS.\n")) --share=SPEC for 'vm', share host file system according to SPEC")) (display (G_ " --expose=SPEC for 'vm', expose host file system according to SPEC")) + (display (G_ " + --nic=NIC-OPTIONS for 'fm', set the value passed to qemu's -nic option")) (display (G_ " -N, --network for 'container', allow containers to access the network")) (display (G_ " @@ -1014,6 +1019,10 @@ Some ACTIONS support additional ARGS.\n")) (lambda (opt name arg result) (alist-cons 'image-size (size->number arg) result))) + (option '("nic") #t #f + (lambda (opt name arg result) + (alist-cons 'nic-options arg + result))) (option '(#\N "network") #f #f (lambda (opt name arg result) (alist-cons 'container-shared-network? #t result))) @@ -1172,7 +1181,8 @@ resulting from command-line parsing." #:install-bootloader? bootloader? #:target target-file #:bootloader-target bootloader-target - #:gc-root (assoc-ref opts 'gc-root))))) + #:gc-root (assoc-ref opts 'gc-root) + #:nic-options (assoc-ref opts 'nic-options))))) #:target target #:system system))) (warn-about-disk-space))) -- 2.26.2 --=-=-=-- From unknown Sat Jun 14 08:59:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#42252: Not possible to reliably port forward with "guix system vm" anymore Resent-From: Bengt Richter Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 08 Jul 2020 09:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42252 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Christopher Lemmer Webber Cc: 42252@debbugs.gnu.org Reply-To: Bengt Richter Received: via spool by 42252-submit@debbugs.gnu.org id=B42252.15942016068336 (code B ref 42252); Wed, 08 Jul 2020 09:47:01 +0000 Received: (at 42252) by debbugs.gnu.org; 8 Jul 2020 09:46:46 +0000 Received: from localhost ([127.0.0.1]:37416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jt6f8-0002AO-6t for submit@debbugs.gnu.org; Wed, 08 Jul 2020 05:46:46 -0400 Received: from imta-38.everyone.net ([216.200.145.38]:45954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jt6f5-0002AE-6h for 42252@debbugs.gnu.org; Wed, 08 Jul 2020 05:46:44 -0400 Received: from pps.filterd (omta003.sj2.proofpoint.com [127.0.0.1]) by imta-38.everyone.net (8.16.0.27/8.16.0.27) with SMTP id 0689fPn8002390; Wed, 8 Jul 2020 02:46:41 -0700 X-Eon-Originating-Account: 3n4lEhwOdPwlqumsaTqiGA9Z-o2Vx0G_X6BTTs1FyDE X-Eon-Dm: m0116953.ppops.net Received: by m0116953.mta.everyone.net (EON-AUTHRELAY2 - 5a81cab6) id m0116953.5ef25221.192aaf; Wed, 8 Jul 2020 02:46:38 -0700 X-Eon-Sig: AQMHrIJfBZX+sALbUAIAAAAC,654530c4d1280b51f475c69518ca732f X-Eip: j470cjgYZ_tYjuwH4-6MLccKWGU8kO01ILyGgbEHEoM Date: Wed, 8 Jul 2020 11:46:28 +0200 From: Bengt Richter Message-ID: <20200708094628.GA9946@LionPure> References: <87r1tnf496.fsf@dustycloud.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87r1tnf496.fsf@dustycloud.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-08_07:2020-07-08, 2020-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2004280000 definitions=main-2007080070 X-Spam-Score: -0.4 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Hi On +2020-07-07 16:40:21 -0400, Christopher Lemmer Webber wrote: > In commit 5379392731b52eef22b4936637eb592b93e04318, the following change > was introduced: > > modified gnu/system/vm.scm > @@ -941,6 +941,7 @@ with '-virtfs' options for the host file systems listed in SHARED-FS." > '()) > > "-no-reboot" > + "-nic" "user,model=virtio-net-pci" > "-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng" > "-device" "virtio-rng-pci,rng=guixsd-vm-rng" > > Unfortunately, this means that in our docs where we suggest doing the > following: > > `guix system vm config.scm` -nic user,model=virtio-net-pci,hostfwd=tcp::10022-:22 > > Since we now provide our own similar "-nic" field this creates a > *second* network interface at the same address and there is a race as in > terms of which handles connections. Depending on the race result, > connections to the forwarded port may hang indefinitely. > > Ironically, this regression was introduced to solve another regression! > From the commit message: > > This fixes a regression introduced in 8e53fe2b91d2776bc1529e7b34967c8f1d9edc32 > where 'guix system vm' would no longer be using virtio. > This reminds a bit of doctors prescribing powerful medicine with side-effect so bad that they have to prescribe a medicine for that, which in turn has side-effects, in what I think is called prescription cascading, and people wind up on 25 pills a day. "First, do no harm." :) I wouldn't say anything, except ISTM your fix on top of a fix is not the first to remind me of cascading :) > What's the right solution? One could be that "guix system vm" itself > could take an argument that sets up port forwarding in the generated > shell script. Eg: > > guix system vm config.scm --hostfwd=tcp::10022-:22 --hostfwd=tcp::8888-:80 > > kind of ugly, but it could work. WDYT? > > - Chris > > > I'm not saying your solution is bad, I'm just saying cascading fixes may be a symptom to diagnose, in case it indicates something like bad mutations involving bad genes that will compromise the health of the guix ecology. How is a "fix" judged with respect to the big picture? Is there a higher level layered[1] design for the use of guix, like e.g. [2] which a proposed fix might violate and therefore should be rejected, even though it makes something "work"? Well, it's probably in an old paper by Ludo in some form, but I wonder what concepts of layering guix developers are consciously using when putting stuff between the declarations at the top and the images at the bottom. [1] https://en.wikipedia.org/wiki/Abstraction_layer [2] https://en.wikipedia.org/wiki/OSI_model -- Regards, Bengt Richter From unknown Sat Jun 14 08:59:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#42252: Not possible to reliably port forward with "guix system vm" anymore Resent-From: Christopher Lemmer Webber Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 11 Jul 2020 19:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42252 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Bengt Richter Cc: 42252@debbugs.gnu.org, Marius Bakke Received: via spool by 42252-submit@debbugs.gnu.org id=B42252.15944969703313 (code B ref 42252); Sat, 11 Jul 2020 19:50:01 +0000 Received: (at 42252) by debbugs.gnu.org; 11 Jul 2020 19:49:30 +0000 Received: from localhost ([127.0.0.1]:44926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1juLV4-0000rN-Ao for submit@debbugs.gnu.org; Sat, 11 Jul 2020 15:49:30 -0400 Received: from dustycloud.org ([50.116.34.160]:47072) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1juLV1-0000rC-5u for 42252@debbugs.gnu.org; Sat, 11 Jul 2020 15:49:28 -0400 Received: from twig (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 70EF326617; Sat, 11 Jul 2020 15:49:26 -0400 (EDT) References: <87r1tnf496.fsf@dustycloud.org> <20200708094628.GA9946@LionPure> User-agent: mu4e 1.4.9; emacs 26.3 From: Christopher Lemmer Webber In-reply-to: <20200708094628.GA9946@LionPure> Date: Sat, 11 Jul 2020 15:49:26 -0400 Message-ID: <87tuyd96ih.fsf@dustycloud.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) [+ Cc: Marius Bakke] because I don't have enough info to respond fully myself. Bengt Richter writes: > Hi > > On +2020-07-07 16:40:21 -0400, Christopher Lemmer Webber wrote: >> In commit 5379392731b52eef22b4936637eb592b93e04318, the following change >> was introduced: >> >> modified gnu/system/vm.scm >> @@ -941,6 +941,7 @@ with '-virtfs' options for the host file systems listed in SHARED-FS." >> '()) >> >> "-no-reboot" >> + "-nic" "user,model=virtio-net-pci" >> "-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng" >> "-device" "virtio-rng-pci,rng=guixsd-vm-rng" >> >> Unfortunately, this means that in our docs where we suggest doing the >> following: >> >> `guix system vm config.scm` -nic user,model=virtio-net-pci,hostfwd=tcp::10022-:22 >> >> Since we now provide our own similar "-nic" field this creates a >> *second* network interface at the same address and there is a race as in >> terms of which handles connections. Depending on the race result, >> connections to the forwarded port may hang indefinitely. >> >> Ironically, this regression was introduced to solve another regression! >> From the commit message: >> >> This fixes a regression introduced in 8e53fe2b91d2776bc1529e7b34967c8f1d9edc32 >> where 'guix system vm' would no longer be using virtio. >> > > This reminds a bit of doctors prescribing powerful medicine with side-effect so bad > that they have to prescribe a medicine for that, which in turn has side-effects, > in what I think is called prescription cascading, and people wind up on 25 pills a day. > > "First, do no harm." :) Well, I'm definitely not actively trying to harm ;) > I wouldn't say anything, except ISTM your fix on top of a fix > is not the first to remind me of cascading :) > >> What's the right solution? One could be that "guix system vm" itself >> could take an argument that sets up port forwarding in the generated >> shell script. Eg: >> >> guix system vm config.scm --hostfwd=tcp::10022-:22 --hostfwd=tcp::8888-:80 >> >> kind of ugly, but it could work. WDYT? >> >> - Chris > > I'm not saying your solution is bad, I'm just saying cascading fixes may be a symptom > to diagnose, in case it indicates something like bad mutations involving bad genes > that will compromise the health of the guix ecology. > > How is a "fix" judged with respect to the big picture? You raise a point in that my "fix to a fix" was a solution when I don't fully understand the problem that was being fixed. Of course, this isn't uncommon in software development, but that doesn't make it great. I only understood as much context as I could to make my workaround to the problem. Is it the right long-term solution? I'm not sure, but I think Marius Bakke has more context to be able to reply than I do. What I do know is that the present instructions we have for port forwarding are now effectively broken, and this at least provides a way to get back there. It might not be the right one. For the rest of your email, I do think Guix is well layered... but even well layered systems sometimes have intermediate proposed solutions to bugs. Sometimes the right design is found along the way. But part of the goal of submitting such a patch is to get code review and provoke discussion of what the right thing is. I *did* make it clear that I thought it was ugly, but workable. :) It might not be the totally wrong thing either though... if there are enough modifications that users might make to the -nic flag, but we don't know how to nicely abstract over all of them yet, but for now we do need to supply a default, this can be an escape hatch at least for now. This wouldn't be uncommon; that's very similar to how Guix system configuration tends to go (we supply configuration builders for the most common options but sometimes provide a way to just slot in a manual config file when need be). - Chris From unknown Sat Jun 14 08:59:56 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Christopher Lemmer Webber Subject: bug#42252: closed (Re: bug#42252: Not possible to reliably port forward with "guix system vm" anymore) Message-ID: References: <87lfjpd965.fsf@gnu.org> <87r1tnf496.fsf@dustycloud.org> X-Gnu-PR-Message: they-closed 42252 X-Gnu-PR-Package: guix Reply-To: 42252@debbugs.gnu.org Date: Sat, 11 Jul 2020 21:39:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1594503542-13550-1" This is a multi-part message in MIME format... ------------=_1594503542-13550-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #42252: Not possible to reliably port forward with "guix system vm" anymore which was filed against the guix package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 42252@debbugs.gnu.org. --=20 42252: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D42252 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1594503542-13550-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 42252-done) by debbugs.gnu.org; 11 Jul 2020 21:38:44 +0000 Received: from localhost ([127.0.0.1]:44982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1juNCm-0003W2-GM for submit@debbugs.gnu.org; Sat, 11 Jul 2020 17:38:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1juNCj-0003Vm-MG for 42252-done@debbugs.gnu.org; Sat, 11 Jul 2020 17:38:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60326) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juNCe-00037Z-5o; Sat, 11 Jul 2020 17:38:36 -0400 Received: from 84-52-226.102.3p.ntebredband.no ([84.52.226.102]:49462 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1juNCd-0005P3-OK; Sat, 11 Jul 2020 17:38:35 -0400 From: Marius Bakke To: Christopher Lemmer Webber , 42252-done@debbugs.gnu.org Subject: Re: bug#42252: Not possible to reliably port forward with "guix system vm" anymore In-Reply-To: <87r1tnf496.fsf@dustycloud.org> References: <87r1tnf496.fsf@dustycloud.org> Date: Sat, 11 Jul 2020 23:38:26 +0200 Message-ID: <87lfjpd965.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 42252-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hello! Sorry for this breakage, and thanks for the analysis! Christopher Lemmer Webber writes: > In commit 5379392731b52eef22b4936637eb592b93e04318, the following change > was introduced: > > modified gnu/system/vm.scm > @@ -941,6 +941,7 @@ with '-virtfs' options for the host file systems li= sted in SHARED-FS." > '()) >=20=20=20=20 > "-no-reboot" > + "-nic" "user,model=3Dvirtio-net-pci" > "-object" "rng-random,filename=3D/dev/urandom,id=3Dguixsd-vm-rng" > "-device" "virtio-rng-pci,rng=3Dguixsd-vm-rng" > > Unfortunately, this means that in our docs where we suggest doing the > following: > > `guix system vm config.scm` -nic user,model=3Dvirtio-net-pci,hostfwd=3D= tcp::10022-:22 > > Since we now provide our own similar "-nic" field this creates a > *second* network interface at the same address and there is a race as in > terms of which handles connections. Depending on the race result, > connections to the forwarded port may hang indefinitely. > > Ironically, this regression was introduced to solve another regression! >>>From the commit message: > > This fixes a regression introduced in 8e53fe2b91d2776bc1529e7b34967c8f1= d9edc32 > where 'guix system vm' would no longer be using virtio. > > What's the right solution? One could be that "guix system vm" itself > could take an argument that sets up port forwarding in the generated > shell script. Eg: > > guix system vm config.scm --hostfwd=3Dtcp::10022-:22 --hostfwd=3Dtcp::8= 888-:80 > > kind of ugly, but it could work. WDYT? My motivation for the breaking commit was just that 'guix system vm' and system tests would use virtio by default. Without it, system tests with forwarded ports used a different driver than those without forwardings. It's a very minor issue and can be solved in other ways. :-) If no -nic parameter is specified on the QEMU command line, QEMU will create one, emulating an Intel NIC. I did not consider the discrepancy this caused with the documentation when we unconditionally pass a -nic parameter! I think we should revert the commit, so that '`guix system vm` -nic foo' works as expected for end users. In fact I just did so. :-) Fixed in 1abf205d11c8b941d7d89855cb55a9cfde078838, thanks! --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl8KMVIACgkQoqBt8qM6 VPqYngf+KupcZWHqayN+HYOBw9nxfh5e08NR05ZY0TZIIXg6wgObVZqKZ/KBiOOP QP3BWtVMrNNBVySi9HzQqI1V1j2tCcAWgD8luxoSqbTjX5+zUCZ4R/xzB8A++BLF g29wqjAKmqzb46TQZXQIzJluCKVFeQvfLdGtI+dRR5zu/M6Yk8xVAqdet6dQ931k LZiOkL/ryPhNexEYyAy0CKcFaSZg6AMS/7J/CV2JOrpL0WntsELQmIEoWFiMijxU CYg0Zem1SZoieAU+8qygStqKEo0gVZLLG9/p+xMGF/ief0FHFhJ/+M7+fRtSajKo YVwnTuD5utR2Y6DozZsLKVELIFeOLg== =wuhF -----END PGP SIGNATURE----- --=-=-=-- ------------=_1594503542-13550-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Jul 2020 20:40:29 +0000 Received: from localhost ([127.0.0.1]:36758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jsuOC-00084S-UV for submit@debbugs.gnu.org; Tue, 07 Jul 2020 16:40:29 -0400 Received: from lists.gnu.org ([209.51.188.17]:37444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jsuO9-00084G-9y for submit@debbugs.gnu.org; Tue, 07 Jul 2020 16:40:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsuO9-000825-2U for bug-guix@gnu.org; Tue, 07 Jul 2020 16:40:25 -0400 Received: from dustycloud.org ([50.116.34.160]:35100) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsuO7-0007mt-BW for bug-guix@gnu.org; Tue, 07 Jul 2020 16:40:24 -0400 Received: from twig (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 42C7B26617 for ; Tue, 7 Jul 2020 16:40:22 -0400 (EDT) User-agent: mu4e 1.4.9; emacs 26.3 From: Christopher Lemmer Webber To: bug-guix@gnu.org Subject: Not possible to reliably port forward with "guix system vm" anymore Date: Tue, 07 Jul 2020 16:40:21 -0400 Message-ID: <87r1tnf496.fsf@dustycloud.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=50.116.34.160; envelope-from=cwebber@dustycloud.org; helo=dustycloud.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/07 16:18:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) In commit 5379392731b52eef22b4936637eb592b93e04318, the following change was introduced: modified gnu/system/vm.scm @@ -941,6 +941,7 @@ with '-virtfs' options for the host file systems listed in SHARED-FS." '()) "-no-reboot" + "-nic" "user,model=virtio-net-pci" "-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng" "-device" "virtio-rng-pci,rng=guixsd-vm-rng" Unfortunately, this means that in our docs where we suggest doing the following: `guix system vm config.scm` -nic user,model=virtio-net-pci,hostfwd=tcp::10022-:22 Since we now provide our own similar "-nic" field this creates a *second* network interface at the same address and there is a race as in terms of which handles connections. Depending on the race result, connections to the forwarded port may hang indefinitely. Ironically, this regression was introduced to solve another regression! >From the commit message: This fixes a regression introduced in 8e53fe2b91d2776bc1529e7b34967c8f1d9edc32 where 'guix system vm' would no longer be using virtio. What's the right solution? One could be that "guix system vm" itself could take an argument that sets up port forwarding in the generated shell script. Eg: guix system vm config.scm --hostfwd=tcp::10022-:22 --hostfwd=tcp::8888-:80 kind of ugly, but it could work. WDYT? - Chris ------------=_1594503542-13550-1--