From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 64zeAxrgrF+oGQAA0tVLHw (envelope-from ) for ; Thu, 12 Nov 2020 07:11:22 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id KA/FOhngrF/pcQAA1q6Kng (envelope-from ) for ; Thu, 12 Nov 2020 07:11:21 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4E61C94051F for ; Thu, 12 Nov 2020 07:11:21 +0000 (UTC) Received: from localhost ([::1]:56454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kd6lL-00065c-4S for larch@yhetil.org; Thu, 12 Nov 2020 02:11:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kd6l4-00065R-Jw for bug-guix@gnu.org; Thu, 12 Nov 2020 02:11:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60135) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kd6l4-0003Kw-A9 for bug-guix@gnu.org; Thu, 12 Nov 2020 02:11:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kd6l4-0001zU-41 for bug-guix@gnu.org; Thu, 12 Nov 2020 02:11:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#44353: [PATCH version-1.2.0 v2] guix: system: Add a new '--non-volatile' option for disk-image. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 12 Nov 2020 07:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44353 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: 44353@debbugs.gnu.org Received: via spool by 44353-submit@debbugs.gnu.org id=B44353.16051650307604 (code B ref 44353); Thu, 12 Nov 2020 07:11:02 +0000 Received: (at 44353) by debbugs.gnu.org; 12 Nov 2020 07:10:30 +0000 Received: from localhost ([127.0.0.1]:43448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kd6kX-0001yZ-Ny for submit@debbugs.gnu.org; Thu, 12 Nov 2020 02:10:30 -0500 Received: from mail-io1-f65.google.com ([209.85.166.65]:46022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kd6kW-0001yM-8f for 44353@debbugs.gnu.org; Thu, 12 Nov 2020 02:10:28 -0500 Received: by mail-io1-f65.google.com with SMTP id u21so4936884iol.12 for <44353@debbugs.gnu.org>; Wed, 11 Nov 2020 23:10:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FBvPczlVj+1NC3a/UBE33PrvresG7Vog9JQV5a8BMsg=; b=eloeXqFEASuuf7O8u4n0GEFrfw+SaYq9EcZgAN0S7pxxEHGk4Dc7h6VoaQZ+L+CteG sMHNiUTUtMXXI75483/AQc0MF0aM0JGpD4oED3bBkmHRrInrdN446hC+Kg4MlOVqvDeq XI6+b17uccjqA6tQZ1lSsF/IPde8/0DQbPw0wPgVml/rWWhIAQsRX2ul8nyt/Sc40AU5 FRxOl7eTjeHv3kBt76l0PcHqjWi0O+i1Gk+7YlARKLIdiQedUsXFjGemkITvjM3giAg6 afLrry16DZzf0hLoGRcwDuBa6/makBToz7KpbjzAf3mx/29cHJzFlaX3FX7SxDHl57io H8VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FBvPczlVj+1NC3a/UBE33PrvresG7Vog9JQV5a8BMsg=; b=OMmQNgT5TU9t90vbM+c6a9KiDZEeNUAKnCmM4T+Z/PTpMlohuBmVncFY+4MnUjERJQ C9lri7Pnue5EFJ6jcJ7+VWlvKspuspQ3x5sjfZCXeCfAXHkLALO8Jr4eAieIyNmU4wtR SJnoqn8pcpZrhdjcZHVA6B4xoHSZ+BO70Elhi47PSoaCnAb6mc8IOuLuIOCXUAsTLnpY 1nJqb7nSOCHttORtB7lHzBt5thCgq00/+eWMQvhWXQJZ/gAVq9lPr4yUyx+yd/P5p42N xOgZHpohzS6Nu9VkJzWeqbgBvgE5EAnsd55sumhHfIbQ8UYKWeeOpDZfsS02/qe2bOKy FmYw== X-Gm-Message-State: AOAM531Sm62/KR9Ct/noErGYcmVupwUSgbczM22Q1EkNPOgFG4eoIIgM m9vaeHVMI0Do8SIGIAVbF9o1EpBEGYs= X-Google-Smtp-Source: ABdhPJy1ryo2gxe+3FYtmjeli9dZSAZXjYsrhP+vxH0/Bt1bK7MJ/Fpzfc0lQ2M1ayYwIN2I75xpyg== X-Received: by 2002:a02:5149:: with SMTP id s70mr5941664jaa.121.1605165022139; Wed, 11 Nov 2020 23:10:22 -0800 (PST) Received: from localhost.localdomain (dsl-10-133-153.b2b2c.ca. [72.10.133.153]) by smtp.gmail.com with ESMTPSA id c3sm2550601ila.47.2020.11.11.23.10.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 23:10:21 -0800 (PST) From: Maxim Cournoyer Date: Thu, 12 Nov 2020 02:09:17 -0500 Message-Id: <20201112070917.11794-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <87h7q0cdns.fsf@gnu.org> References: <87h7q0cdns.fsf@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mathieu Othacehe , Jesse Gibbons , Maxim Cournoyer Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=gmail.com header.s=20161025 header.b=eloeXqFE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 5.59 X-TUID: 8Z+KRK8NSjCh * guix/scripts/system.scm (%options)[volatile-root?]: New boolean option. (%default-options): Set its default value to #f. (show-help): Add help doc. * guix/scripts/system.scm (perform-action): Propagate option... (system-derivation-for-action): ...here. Use it to set the volatile-root? field of the image object passed to SYSTEM-IMAGE. * doc/guix.texi (Invoking guix system): Document it. --- doc/guix.texi | 18 ++++++++++++------ guix/scripts/system.scm | 21 +++++++++++++++++---- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index e15ee4092c..30efb7fc97 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -30911,14 +30911,20 @@ the @option{--image-size} option is ignored in the case of @cindex disk-image, creating disk images The @code{disk-image} command can produce various image types. The -image type can be selected using the @command{--image-type} option. It +image type can be selected using the @option{--image-type} option. It defaults to @code{raw}. When its value is @code{iso9660}, the @option{--label} option can be used to specify a volume ID with -@code{disk-image}. When using @code{disk-image}, the bootloader -installed on the generated image is taken from the provided -@code{operating-system} definition. The following example demonstrates -how to generate an image that uses the @code{grub-efi-bootloader} -bootloader and boot it with QEMU: +@code{disk-image}. By default, the root file system of a disk image is +mounted volatile; the @option{--non-volatile} option can be used to make +it persistent instead. The @option{--non-volatile} is useful to make +use of extra disk space that can be obtained by using a larger value for +the @option{--image-size} option; otherwise, the amount of physical +memory available determines the capacity of the volatile file system +overlay used for the root file system. When using @code{disk-image}, +the bootloader installed on the generated image is taken from the +provided @code{operating-system} definition. The following example +demonstrates how to generate an image that uses the +@code{grub-efi-bootloader} bootloader and boot it with QEMU: @example image=$(guix system disk-image --image-type=qcow2 \ diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index ad998156c2..004f1c9739 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -674,7 +674,8 @@ checking this by themselves in their 'check' procedure." (define* (system-derivation-for-action os action #:key image-size image-type full-boot? container-shared-network? - mappings label) + mappings label + volatile-root?) "Return as a monadic value the derivation for OS according to ACTION." (mlet %store-monad ((target (current-target-system))) (case action @@ -706,7 +707,8 @@ checking this by themselves in their 'check' procedure." base-image)) (target (or base-target target)) (size image-size) - (operating-system os)))))) + (operating-system os) + (volatile-root? volatile-root?)))))) ((docker-image) (system-docker-image os #:shared-network? container-shared-network?))))) @@ -761,6 +763,7 @@ and TARGET arguments." dry-run? derivations-only? use-substitutes? bootloader-target target image-size image-type + volatile-root? full-boot? label container-shared-network? (mappings '()) (gc-root #f)) @@ -768,7 +771,8 @@ and TARGET arguments." bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the target root directory; IMAGE-SIZE is the size of the image to be built, for the 'vm-image' and 'disk-image' actions. IMAGE-TYPE is the type of image to -be built. +be built. When VOLATILE-ROOT? is #t, the root file system is mounted +volatile. FULL-BOOT? is used for the 'vm' action; it determines whether to boot directly to the kernel or to the bootloader. CONTAINER-SHARED-NETWORK? @@ -816,6 +820,7 @@ static checks." #:label label #:image-type image-type #:image-size image-size + #:volatile-root? volatile-root? #:full-boot? full-boot? #:container-shared-network? container-shared-network? #:mappings mappings)) @@ -974,6 +979,8 @@ Some ACTIONS support additional ARGS.\n")) --image-size=SIZE for 'vm-image', produce an image of SIZE")) (display (G_ " --no-bootloader for 'init', do not install a bootloader")) + (display (G_ " + --non-volatile for 'disk-image', persist root file system changes")) (display (G_ " --label=LABEL for 'disk-image', label disk image with LABEL")) (display (G_ " @@ -1048,6 +1055,9 @@ Some ACTIONS support additional ARGS.\n")) (option '("no-bootloader" "no-grub") #f #f (lambda (opt name arg result) (alist-cons 'install-bootloader? #f result))) + (option '("non-volatile") #f #f + (lambda (opt name arg result) + (alist-cons 'volatile-root? #f result))) (option '("label") #t #f (lambda (opt name arg result) (alist-cons 'label arg result))) @@ -1109,7 +1119,8 @@ Some ACTIONS support additional ARGS.\n")) (image-type . raw) (image-size . guess) (install-bootloader? . #t) - (label . #f))) + (label . #f) + (volatile-root? . #t))) (define (verbosity-level opts) "Return the verbosity level based on OPTS, the alist of parsed options." @@ -1206,6 +1217,8 @@ resulting from command-line parsing." #:image-type (lookup-image-type-by-name (assoc-ref opts 'image-type)) #:image-size (assoc-ref opts 'image-size) + #:volatile-root? + (assoc-ref opts 'volatile-root?) #:full-boot? (assoc-ref opts 'full-boot?) #:container-shared-network? (assoc-ref opts 'container-shared-network?) -- 2.28.0