From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kAA7NKpCHWIwHwEAgWs5BA (envelope-from ) for ; Mon, 28 Feb 2022 22:46:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GKEPLapCHWJTSAAAG6o9tA (envelope-from ) for ; Mon, 28 Feb 2022 22:46:18 +0100 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 47F4C204FD for ; Mon, 28 Feb 2022 22:46:18 +0100 (CET) Received: from localhost ([::1]:37510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOnqS-0002T1-4D for larch@yhetil.org; Mon, 28 Feb 2022 16:46:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOnqG-0002Sr-3k for bug-guix@gnu.org; Mon, 28 Feb 2022 16:46:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:41012) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOnqE-00006d-Mb for bug-guix@gnu.org; Mon, 28 Feb 2022 16:46:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nOnqE-0006Z0-Hx for bug-guix@gnu.org; Mon, 28 Feb 2022 16:46:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#40998: Guix System's initrd doesn't honor rootflags Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 28 Feb 2022 21:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40998 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 40998-submit@debbugs.gnu.org id=B40998.164608474925197 (code B ref 40998); Mon, 28 Feb 2022 21:46:02 +0000 Received: (at 40998) by debbugs.gnu.org; 28 Feb 2022 21:45:49 +0000 Received: from localhost ([127.0.0.1]:34909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOnq0-0006YL-Oi for submit@debbugs.gnu.org; Mon, 28 Feb 2022 16:45:49 -0500 Received: from mail-qv1-f47.google.com ([209.85.219.47]:44698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOnpz-0006Y9-Qr for 40998@debbugs.gnu.org; Mon, 28 Feb 2022 16:45:48 -0500 Received: by mail-qv1-f47.google.com with SMTP id jr3so594782qvb.11 for <40998@debbugs.gnu.org>; Mon, 28 Feb 2022 13:45:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=xPX8bNvLR1OvxYztuvQiv5wblDpJj3KAVGCbu0iBRoc=; b=IRXZHILfUs8VHlkUIvqQVx4GZE/xzYMDmz04LL18rSAEChufaEazkh7XZBV/Cm4a67 gaTiLwQCY1EWEAr99kBpjMJ2Ofnvh+2LQh2oT/WkmOM+VJpQ5CEtZ859gg7IqD1CFZqQ tKSku2dgrqP4NkfL668CXiE1VKSH47uHoI1htO2+vBtH4vTtJThgXA4UTCWAcup6JrHk RnGF6L8k0910Z5jKOxVnFZOE/GQ6hj7gL1sceGzGSG31Ew37a2/bpf142CAxsj/6q3pZ 033ebqvDFUfRYDNFJ29Q6po2fAHVlT29aMGUiHqZZcoVz5ENcIqYBxTgCEVRBh7sWqfr XxVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=xPX8bNvLR1OvxYztuvQiv5wblDpJj3KAVGCbu0iBRoc=; b=2P1w2NH5kxdXAcOwhfERkKQOjabdb42jTFWXaVC4ROToJDgYBVMPkKVRrBXHEtaJOW aGuELwcRyqnCrip7ZaOlLrABOEawIOpptYYwn7inYWNOuWZBU4vrdz4HYz1CwcypbjuX ipYikgTyCQrVKibhmiHu/QnTlK00/0eTes2BtFOkpq2zQOTPgvGgnHtWy9Xtebq4hzfN 7U2cedhpVLsSctCUGaOFNdu43GJcucdE/pAi6AsZ1e/3X1qtFc9ZiCo+npfrU0pHz+bp veDLRLATLeuB2hmjQT4p0Cz/RfVUOjTDkrFPzTeYxFFUCdeRFPKm4SpUVyDXK0nCTExr cQPg== X-Gm-Message-State: AOAM532IDXKvVqMP1kxnUsaVpOUMbvqJFap0sKYH2fH4LeEMM1dE48Xp C3GsDkhwxBiChHYYgeoOzEfTgxrkaHE= X-Google-Smtp-Source: ABdhPJwkXeUeamvo8rczofZ9A4XbMQrgDP0WVLNX+Af78l9laOzgaTJaqJcI8hJ2bw6hQEOkDYl8Dg== X-Received: by 2002:a05:622a:1652:b0:2df:f380:aca0 with SMTP id y18-20020a05622a165200b002dff380aca0mr11195336qtj.195.1646084741908; Mon, 28 Feb 2022 13:45:41 -0800 (PST) Received: from hurd (dsl-141-227.b2b2c.ca. [66.158.141.227]) by smtp.gmail.com with ESMTPSA id w13-20020a05622a190d00b002dd2600afc2sm7896761qtc.62.2022.02.28.13.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 13:45:41 -0800 (PST) From: Maxim Cournoyer References: <87r1w3kbi0.fsf@hurd.i-did-not-set--mail-host-address--so-tickle-me> <20220219070155.1924-1-maxim.cournoyer@gmail.com> <87lexwuj27.fsf_-_@gnu.org> <87bkyqu5co.fsf@gmail.com> <87fso2bsm2.fsf@gnu.org> Date: Mon, 28 Feb 2022 16:45:40 -0500 In-Reply-To: <87fso2bsm2.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 28 Feb 2022 22:15:17 +0100") Message-ID: <87mtiasm0r.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 40998@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1646084778; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=xPX8bNvLR1OvxYztuvQiv5wblDpJj3KAVGCbu0iBRoc=; b=aYpeYXOEsF8kNcyQvbqm62uuRkNqObZO66ecrLCg4n1htxfrJ0wUSpkEwBCjpt2xWpSvCV gneTN8rMjXTLFeCk9NQ6JgoZVhlMUFzMFJa74Tsm0U0kXlozNn4evJ2VCMAmmIHzewhYo6 gp25ukhAzHY8lakNTyUvK6DkpM+aGZMGmL8IFDayuqvs6eEku8ZeJTJwevXVdjwwVkzp40 8jq109+cBTo7gqm4sH7CNIf0r6oy5gHL5kF41xGv7xqFfYLZBreMfT1ZkExPS3sBqj464K qz4eqZ1tgyopZm5qti7heDjTVfPdTCh3bszOBMXFamr7DbHAJjgWClGYYHSC3w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1646084778; a=rsa-sha256; cv=none; b=P0HZnmWFkC7pta5fIVBc5ZrrAWv+XZ5mHBv0OZHY98dE4/J9z3xi8ivhrb+5ZE7Zfe4QJ7 PvX98vxk/c2u6g1MN76GfoiAlL96d7dd93X2t1ysWh1KXm/tOMjxrw62Ra369qW9doDxVF TAwzuXsEqSa6BtYwtJ4L5K84G+JlbPWcahRefC+ElPcREWdKjHpbaH654AK3GcxbSfeJ2V lHPgSKI3ODM17ojQ7AMnBHQaQq1stVrdAV6M2Vl9P4UNIrvwzWuPjZmTqCvtksDrdJomdM RfKUTDmTezjUkrp/TP5Vjs6nh5aqwzpmDuC5/fT6llJUnJHQTGI409mQ0f6DvQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=IRXZHILf; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 5.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=IRXZHILf; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 47F4C204FD X-Spam-Score: 5.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: bVHMuLKBZsu+ Hi Ludovic, Ludovic Court=C3=A8s writes: > Maxim Cournoyer skribis: > >> Ludovic Court=C3=A8s writes: > > [...] > >>> There=E2=80=99s no need to have a =E2=80=98version=E2=80=99 field in li= ve >>> records: have the =E2=80=98version=E2=80=99 field in the serialized for= mat (the sexp) >>> and make sure the deserializer correctly converts to the internal >>> representation. >>> >>> Here, I think you can bump the version number in the serialized form, >>> and have =E2=80=98read-boot-parameters=E2=80=99 automatically augment = =E2=80=98kernel-arguments=E2=80=99 >>> when VERSION is 0 with =E2=80=9C--root=3DXYZ=E2=80=9D. >> >> I initially went that route, as this was the idea you'd given me >> initially. However, 'read-boot-parameters' deals with serializing the >> parameters file only; to add 'root', 'gnu.load' and 'gnu.system', the >> operating-system object as well as the root device are needed. > > already has =E2=80=98root-device=E2=80=99, so that=E2= =80=99s fine. > > But you=E2=80=99re right that the system itself is a problem because that= =E2=80=99s > self-referential=E2=80=94it=E2=80=99s the thing the =E2=80=9Cparameters= =E2=80=9D file is in. Hmm! > > We could add a substitution mechanism where a literal =E2=80=9C$SYSTEM=E2= =80=9D (say) in > the =E2=80=98kernel-arguments=E2=80=99 of would be subs= tituted by the > actual system store file name by =E2=80=98read-boot-parameters=E2=80=99, = but maybe > that=E2=80=99s overkill. > > So long story short: keeping the =E2=80=98version=E2=80=99 field in > sounds reasonable after all. :-) OK, good, thanks for having confirmed that. >> The reason 'gnu.load' and 'gnu.system' aren't written to the >> parameters file to start with is because they would cause the system >> directory to no longer be content-addressable; this is explained in >> the docstring of 'operating-system-boot-parameters-file': >> >> When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments such as = 'root' >> and 'gnu.load' to the returned file (since the returned file is then= usually >> stored into the content-addressed "system" directory, it's usually n= ot a >> good idea to give it because the content hash would change by the co= ntent hash >> being stored into the "parameters" file). > > This comment originates in 40fad1c24ce60076e26f6dc8096e4716d31d90c3. I > find it a bit misleading because nothing=E2=80=99s =E2=80=9Ccontent-addre= ssed=E2=80=9D, but I > guess it refers to the same problem: that this is self-referential. > > (There=E2=80=99s only one use of #:system-kernel-arguments? #t. We can r= emove > that keyword parameter from =E2=80=98operating-system-boot-parameters-fil= e=E2=80=99 > since it=E2=80=99s not used there.) OK, I'll address this confusing comment and extraneous argument in a separate commit. >>> Also, you could write the =E2=80=98match=E2=80=99 pattern like this: >>> >>> ('boot-parameters ('version (and version (or 0 1))) >>> ('label label) =E2=80=A6) >> >> I think this patch's current form is preferable, as it means future >> boot-parameters version bumps won't break older Guices (when >> reconfiguring), as long as the version is an exact, non-negative integer >> (e.g. when going from 1 to 2). > > That=E2=80=99s what we want to avoid: bumping the version number means th= at the > new format is not backwards-compatible, and that older Guix versions > won=E2=80=99t be able to read it. That=E2=80=99s why I think =E2=80=98re= ad-boot-parameters=E2=80=99 > needs to be explicit about the version(s) it expects. (A more complete > example of this pattern is =E2=80=98sexp->manifest=E2=80=99.) > > Breaking backwards compatibility should be avoided when possible, but > it=E2=80=99s not always possible. In =E2=80=98read-boot-parameters=E2=80= =99, =E2=80=98bootloader-name=E2=80=99, > =E2=80=98bootloader-menu-entries=E2=80=99, =E2=80=98kernel=E2=80=99, etc.= are handled somewhat weirdly > to preserve backwards-compatibility; doing this allowed us to not bump > the file format version. Thanks for explaining! I initially thought the choice to break backward compatibility could be left to the implementer of a new version, but now I see this wouldn't work or be brittle. I've modified the first commit like so: --8<---------------cut here---------------start------------->8--- modified gnu/system.scm @@ -365,8 +365,10 @@ (define uuid-sexp->uuid (warning (G_ "unrecognized uuid ~a at '~a'~%") x (port-filename por= t)) #f))) =20 + ;; New versions are not backward-compatible, so only accept past and cur= rent + ;; versions, not future ones. (define (version? n) - (and (exact-integer? n) (not (negative? n)))) + (member n (iota (1+ %boot-parameters-version)))) =20 (match (read port) (('boot-parameters ('version (? version? version)) --8<---------------cut here---------------end--------------->8--- So that there's only one thing to update when we'll bump the version again in the future (%boot-parameters-version). I'll be sending a v3 shortly, thanks again! Maxim