From patchwork Tue Nov 30 19:13:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 34884 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E9A6B27BBEA; Tue, 30 Nov 2021 19:14:59 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 183F427BBE9 for ; Tue, 30 Nov 2021 19:14:59 +0000 (GMT) Received: from localhost ([::1]:39812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ms8ab-0002Iz-Iu for patchwork@mira.cbaines.net; Tue, 30 Nov 2021 14:14:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ms8Zm-0002EO-BT for guix-patches@gnu.org; Tue, 30 Nov 2021 14:14:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59223) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ms8Zm-0003mu-31 for guix-patches@gnu.org; Tue, 30 Nov 2021 14:14:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ms8Zl-0007vD-V6 for guix-patches@gnu.org; Tue, 30 Nov 2021 14:14:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52204] [PATCH] guix system vm: Add --no-graphic CLI argument. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 30 Nov 2021 19:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52204 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52204@debbugs.gnu.org Cc: Attila Lendvai X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163829963630431 (code B ref -1); Tue, 30 Nov 2021 19:14:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 Nov 2021 19:13:56 +0000 Received: from localhost ([127.0.0.1]:42536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ms8Zf-0007ul-PG for submit@debbugs.gnu.org; Tue, 30 Nov 2021 14:13:56 -0500 Received: from lists.gnu.org ([209.51.188.17]:40990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ms8ZQ-0007uN-4X for submit@debbugs.gnu.org; Tue, 30 Nov 2021 14:13:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ms8ZP-0001xi-Os for guix-patches@gnu.org; Tue, 30 Nov 2021 14:13:39 -0500 Received: from [2a00:1450:4864:20::331] (port=34677 helo=mail-wm1-x331.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ms8ZN-0003j7-T0 for guix-patches@gnu.org; Tue, 30 Nov 2021 14:13:39 -0500 Received: by mail-wm1-x331.google.com with SMTP id m25-20020a7bcb99000000b0033aa12cdd33so8272686wmi.1 for ; Tue, 30 Nov 2021 11:13:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=P+Y/VGXHK+/CsDWZkprCrsAqfiYGvQQ7q3DexgEJo60=; b=M2wrlRIGScc+noargdPtGGUf9T3us3TyDu6dtZp/2kd5YWSlSW5DreKOVZZydHqPTf cWgyjXorfU+MHhfn9wHxGKLfMLCoCuPEk3IeiRxkR/TtOnDUljNihY7UTmGG4veUon7u SZKNUus2iTpAyAchy5Orrg4U9enHSbYoBU0FEVNQNVdo6bBDtS+ykldN0QKNoIkqVRn7 2UAyXCd9CMDJ52gFQ9mFLYramugu/wt1eNEd/lDJ/BF+4KYMcEw2aAcbDvfUZjBJ3GbV hzFwBt+JTpxx0SQYWUrsSwd6Cjt3957OgGpCT+nm40aRY9urYCJCpBTB+ys9RQC9LACv i5BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=P+Y/VGXHK+/CsDWZkprCrsAqfiYGvQQ7q3DexgEJo60=; b=YWli/987L50eiFDvOCOkhGMsB1LG9i2a/A0biyC/8f2leMBv4IqEyMoQAAT5BZtX4B 0T+r+zwjReD5JYE/7nm9gZtJZM40f9A5TdwofAAo8XHzQkbLAqD5Q6ocZGbl9IRHtV4G 5r8hPQ7q449ECo/3qARzRK5+l5kS0rMqmJ7QSwNxhj5523k1L1/XeMCM0QlmT+u+ZI4q 0ZxMWE0s6Vo2DFoK9ezF9PYqhV6J6vYxPncodZdU4VyGfL1sUBZa+FPiwzXQkj/dIi/i 6TvQL+uz9rutud5kGCrUSL0yxMlP2o4hlY0+zN27VMBFI/MmS2q9No5W6POp873wIlHS AZtQ== X-Gm-Message-State: AOAM53083t9G0feSlr8o4HhKKdhrIfsacAXHxq5UVTzTuIALlwaotOQD ySUQ3fnqngKeHNej7mM5ansDw4FSz8I2Og== X-Google-Smtp-Source: ABdhPJyypnj7pDPxnOByjPi1+3hCJKhzI1Mdq+MC0VAs4Syl6vGzHrq5vz9ankdilsfAO/Rw/R6oWA== X-Received: by 2002:a7b:c844:: with SMTP id c4mr732603wml.148.1638299615960; Tue, 30 Nov 2021 11:13:35 -0800 (PST) Received: from lelap.lan (catv-89-132-208-37.catv.broadband.hu. [89.132.208.37]) by smtp.gmail.com with ESMTPSA id r15sm3108329wmh.13.2021.11.30.11.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 11:13:35 -0800 (PST) From: Attila Lendvai Date: Tue, 30 Nov 2021 20:13:13 +0100 Message-Id: <20211130191312.32131-1-attila@lendvai.name> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::331 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=attila.lendvai@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches It configures qemu to use the tty it was started in for IO (as opposed to opening a separate graphical window). This enables copy-pasting and scrollback. Exit qemu with C-a x. * gnu/system/vm.scm (system-qemu-image/shared-store-script): Also add the '-nographic' qemu argument when called with #:graphic? #false. * guix/scripts/system.scm (system-derivation-for-action): Propagate the #:graphic? keyword arg. (perform-action): Add and propagate the #:graphic? keyword arg. (show-help): Add --no-graphic CLI arg. (%options): Process the new --no-graphic CLI arg. (process-action): Feed in the CLI arg through the #:graphic? keyword arg. --- gnu/system/vm.scm | 2 ++ guix/scripts/system.scm | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 1e2d8b47c2..0a95302584 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -754,6 +754,8 @@ (define kernel-arguments (define qemu-exec #~(list #+(file-append qemu "/bin/" (qemu-command (or target system))) + ;; Tells qemu to use the terminal it was started in for IO. + #$@(if graphic? '() #~("-nographic")) #$@(if full-boot? #~() #~("-kernel" #$(operating-system-kernel-file os) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 7faa92fd7d..1675fccf50 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -689,6 +689,7 @@ (define file-systems (define* (system-derivation-for-action image action #:key full-boot? + (graphic? #t) container-shared-network? mappings) "Return as a monadic value the derivation for IMAGE according to ACTION." @@ -706,6 +707,7 @@ (define* (system-derivation-for-action image action ((vm) (system-qemu-image/shared-store-script os #:full-boot? full-boot? + #:graphic? graphic? #:disk-image-size (if full-boot? image-size @@ -772,6 +774,7 @@ (define* (perform-action action image dry-run? derivations-only? use-substitutes? target full-boot? + (graphic? #t) container-shared-network? (mappings '()) (gc-root #f)) @@ -825,6 +828,7 @@ (define bootcfg (mlet* %store-monad ((sys (system-derivation-for-action image action #:full-boot? full-boot? + #:graphic? graphic? #:container-shared-network? container-shared-network? #:mappings mappings)) @@ -1012,6 +1016,8 @@ (define (show-help) register it as a garbage collector root")) (display (G_ " --full-boot for 'vm', make a full boot sequence")) + (display (G_ " + --no-graphic for 'vm', use the tty that we are started in for IO")) (display (G_ " --skip-checks skip file system and initrd module safety checks")) (display (G_ " @@ -1081,6 +1087,9 @@ (define %options (option '("full-boot") #f #f (lambda (opt name arg result) (alist-cons 'full-boot? #t result))) + (option '("no-graphic") #f #f + (lambda (opt name arg result) + (alist-cons 'no-graphic? #t result))) (option '("save-provenance") #f #f (lambda (opt name arg result) (alist-cons 'save-provenance? #t result))) @@ -1266,6 +1275,7 @@ (define (graph-backend) #:validate-reconfigure (assoc-ref opts 'validate-reconfigure) #:full-boot? (assoc-ref opts 'full-boot?) + #:graphic? (if (assoc-ref opts 'no-graphic?) #f #t) #:container-shared-network? (assoc-ref opts 'container-shared-network?) #:mappings (filter-map (match-lambda From patchwork Thu Dec 2 19:09:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 34933 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9800027BBEA; Thu, 2 Dec 2021 19:18:51 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5754D27BBE9 for ; Thu, 2 Dec 2021 19:18:51 +0000 (GMT) Received: from localhost ([::1]:48242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msrbW-00039u-7A for patchwork@mira.cbaines.net; Thu, 02 Dec 2021 14:18:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msrTy-0000TZ-Aj for guix-patches@gnu.org; Thu, 02 Dec 2021 14:11:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:37742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1msrTy-0006cD-1u for guix-patches@gnu.org; Thu, 02 Dec 2021 14:11:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1msrTx-00078g-To for guix-patches@gnu.org; Thu, 02 Dec 2021 14:11:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52204] [PATCH 2/2] doc: Document guix system --no-graphic. References: <20211130191312.32131-1-attila@lendvai.name> In-Reply-To: <20211130191312.32131-1-attila@lendvai.name> Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 02 Dec 2021 19:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52204 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52204@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 52204-submit@debbugs.gnu.org id=B52204.163847221627393 (code B ref 52204); Thu, 02 Dec 2021 19:11:01 +0000 Received: (at 52204) by debbugs.gnu.org; 2 Dec 2021 19:10:16 +0000 Received: from localhost ([127.0.0.1]:49288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msrTE-00077l-C4 for submit@debbugs.gnu.org; Thu, 02 Dec 2021 14:10:16 -0500 Received: from mail-wm1-f49.google.com ([209.85.128.49]:50753) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msrTC-00077T-Ii for 52204@debbugs.gnu.org; Thu, 02 Dec 2021 14:10:15 -0500 Received: by mail-wm1-f49.google.com with SMTP id 133so614650wme.0 for <52204@debbugs.gnu.org>; Thu, 02 Dec 2021 11:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+9JrFwybFu6UpO7tovxD8ZoYZ1WihZRkPTzzSj7nngc=; b=f+Q9AC63FQHgsJzT0vlIrM1o7LWLWhNIdos3xSthFy/Vgcfzcyy9+hYts+mgacfFYQ 30sGLyFPDcCdvUnbNZzZ3yqH8MbU4Cm6T9uErvw8DAlWi9VxCk8YAVRt9OeIakM+dE9n Equ7jSTGBdsC4kmrWq5iMQyCTfl/SlmtLGQoJIWo6JfwBR6qmY/usebF97gqPApr0ATn vWJEwbeeI5/eYNLZd/zrmoU8o8urs7pH5nIxAqpfTR5vbolBjPcvT/bOYiU9hMjx3li1 1PMAswyWDjiTLSHYydam7oPYy3pdCI/iHDlW9l+18mhmdKBqqWHTLWnJOgNp4xQzQNV7 X4aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=+9JrFwybFu6UpO7tovxD8ZoYZ1WihZRkPTzzSj7nngc=; b=FcUjakpWQdGBDYjYRR6woMUINfVNp5vNyNrdUMTK/TV8tivccimOFPTbc8v9vx+CBP CkMT6RNGpmanTXrYHp8Y0V7aJ2axf7N45hlcvjfd+Y60YIHWeRDPPv3M2X8on4a9UhSG UuFdLdfSPkCSMeSoTR+nkxp8JuOkNm3OE43j3Bhi2D48XPhKISjhWrVZW6e147EKjTHJ MWphmAtRyxUuDBLf1ELo9AnXMwkdbAqJ7r+qj0fEq3+btc47cowFJ6h+zlJ7Vp/RJJXc gPR/CY5qMFk0kdXVlpBNjgnbkeIMDuJpY/LFtbgC/ax6vTv2EuwbGVMNP0N13HSUJCZ5 /eSA== X-Gm-Message-State: AOAM530qQ/vu5cAFYFHmkRqM9Ox7HjSSejlbbdRqhNpaJfLwjx7NUSUR fw8IDcRrwze7JEhJwufkZbdXzqMjlkcOSQ== X-Google-Smtp-Source: ABdhPJyJRA8RUkHzTS8v/fHvTPCG6t8ALvHQBYwoRsKIcKMoIl7x2RDlJ0sJWX9IDE7ayw6R9IrnPg== X-Received: by 2002:a05:600c:1083:: with SMTP id e3mr8507903wmd.167.1638472208553; Thu, 02 Dec 2021 11:10:08 -0800 (PST) Received: from lelap.lan (catv-89-132-208-37.catv.broadband.hu. [89.132.208.37]) by smtp.gmail.com with ESMTPSA id l2sm3092671wmq.42.2021.12.02.11.10.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 11:10:08 -0800 (PST) From: Attila Lendvai Date: Thu, 2 Dec 2021 20:09:42 +0100 Message-Id: <20211202190941.27236-1-attila@lendvai.name> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * doc/guix.texi (Invoking guix system): Add example to combine guix system and invoking the vm start script into one command. Split the description of the various options into separate paragraphs. Adde a paragraph to describe --no-graphic. --- doc/guix.texi | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 2a166e3a89..ca670f8971 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -34500,8 +34500,8 @@ passed. @cindex virtual machine @cindex VM @anchor{guix system vm} -Build a virtual machine that contains the operating system declared in -@var{file}, and return a script to run that virtual machine (VM). +Build a virtual machine (VM) that contains the operating system declared +in @var{file}, and return a script to run that VM. @quotation Note The @code{vm} action and others below @@ -34520,6 +34520,12 @@ emulated machine: $ /gnu/store/@dots{}-run-vm.sh -m 1024 -smp 2 -nic user,model=virtio-net-pci @end example +It's possible to combine the two steps into one: + +@example +$ $(guix system vm my-config.scm) -m 1024 +@end example + The VM shares its store with the host system. Additional file systems can be shared between the host and the VM using @@ -34543,8 +34549,17 @@ store of the host can then be mounted. The @option{--full-boot} option forces a complete boot sequence, starting with the bootloader. This requires more disk space since a root image containing at least the kernel, initrd, and bootloader data files must -be created. The @option{--image-size} option can be used to specify the -size of the image. +be created. + +The @option{--image-size} option can be used to specify the size of the +image. + +The @option{--no-graphic} option will instruct @command{guix system} to +spawn a headless VM that will use the invoking tty for IO. Among other +things, this enables copy-pasting, and scrollback. Use the @kbd{ctrl-a} +prefix to issue QEMU commands; e.g. @kbd{ctrl-a h} prints a help, +@kbd{ctrl-a x} quits the VM, and @kbd{ctrl-a c} switches between the +QEMU monitor and the VM. @cindex System images, creation in various formats @cindex Creating system images in various formats