From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oksF0-00011B-DR for mharc-grub-devel@gnu.org; Tue, 18 Oct 2022 15:27:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oksEw-0000xO-R4 for grub-devel@gnu.org; Tue, 18 Oct 2022 15:27:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40090) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oksEv-00044i-51 for grub-devel@gnu.org; Tue, 18 Oct 2022 15:27:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666121217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1yvXYLba9yG6GHJiLy+yPWWLso7+WeObOYxLTPmu0CY=; b=CKa/GNnuahzrsI+RqES3k3NoFDRz+/uzgVMqgtQALjYeKpHA1dRP3XSD87lpna/ztqgHfG b5IimEGBCEPc2nJdopIpDGSFsebd3LjHlCTxSV2FalWb6XIWNfTo058l/VJL6ekNkjhNgM iUlGkC7FsEmD5VckzDrtOTHS2Jo4ziU= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-661-oX_8N6quOcaoGHFfHfnUNQ-1; Tue, 18 Oct 2022 15:26:56 -0400 X-MC-Unique: oX_8N6quOcaoGHFfHfnUNQ-1 Received: by mail-qv1-f72.google.com with SMTP id q17-20020a056214019100b004b1d3c9f3acso9240857qvr.0 for ; Tue, 18 Oct 2022 12:26:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1yvXYLba9yG6GHJiLy+yPWWLso7+WeObOYxLTPmu0CY=; b=kb9EAiRGoIqBfhvq74BKpKg87+3DwfNXUL5Hyj8hSJZ3A7w38BWT8fZ8p4CuuI2fNe nj3SPlrN6IUG+nxBpcmB4L7tPuU4PDm0K0JzZLJpf09Bs6ht/Y+D2MaNOeZijs1qzy2K tuIYQI24THp/x1FOtBHolNy/DSpJ+S/m1uxmq5xO4S54RgHmYUjHmyGAtVTPfXuqHK4H Jx2BqoSVnJ3gAaXSrjDKhqirB8iTrvJzNieGweKARWO2iR6HP9nES1qnOuCwX3GViBzq P0LxwZqRwSe894kvBBy7+3IRM6CB3ndUOoR8v7EqqKwlGZ5vKCSHpi21eLokQ3xTH8O5 DBcQ== X-Gm-Message-State: ACrzQf3Mhjhyg0Ujzm6cKQ1U4hFuhl4585fyqnTzv7LSMfKp9fPGvivk muYiiueEvO+vR/A7M3fchZltLF+3HrE6+fhGYhFJS9VUvWi/JR+xJypZ218qtZxF8NQl7hpNAWm ajuFLHnGALW4= X-Received: by 2002:a0c:f589:0:b0:4b3:d58a:b1f1 with SMTP id k9-20020a0cf589000000b004b3d58ab1f1mr3694891qvm.89.1666121215499; Tue, 18 Oct 2022 12:26:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7iukK8545VB14mX81TFM5ST3nK1e5Hu7oo3xILQrEIPhp+kkNjpDeC63FEsxv8AKCYiK+DvA== X-Received: by 2002:a0c:f589:0:b0:4b3:d58a:b1f1 with SMTP id k9-20020a0cf589000000b004b3d58ab1f1mr3694874qvm.89.1666121215171; Tue, 18 Oct 2022 12:26:55 -0700 (PDT) Received: from localhost ([2600:4040:520a:8800:7d1c:f0a7:5c44:ed0e]) by smtp.gmail.com with ESMTPSA id ge27-20020a05622a5c9b00b0039c9d0dcaf8sm2387410qtb.85.2022.10.18.12.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 12:26:54 -0700 (PDT) From: Robbie Harwood To: Oskari Pirhonen , The development of GNU GRUB Cc: Raymund Will , dkiper@net-space.pl, rw@suse.de, John Jolly , Javier Martinez Canillas , base-system@gentoo.org Subject: Re: [PATCH v4 1/1] Add support for grub-emu to kexec Linux menu entries In-Reply-To: References: <20221004191648.77723-1-rharwood@redhat.com> <20221004191648.77723-2-rharwood@redhat.com> Date: Tue, 18 Oct 2022 15:26:45 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=170.10.129.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.256, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2022 19:27:03 -0000 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Oskari Pirhonen writes: > On Tue, Oct 04, 2022 at 15:16:48 -0400, Robbie Harwood wrote: >> From: Raymund Will >>=20 >> The GRUB emulator is used as a debugging utility but it could also be >> used as a user-space bootloader if there is support to boot an operating >> system. >>=20 >> The Linux kernel is already able to (re)boot another kernel via the >> kexec boot mechanism. So the grub-emu tool could rely on this feature >> and have linux and initrd commands that are used to pass a kernel, >> initramfs image and command line parameters to kexec for booting a >> selected menu entry. >>=20 >> By default the systemctl kexec option is used so systemd can shutdown >> all of the running services before doing a reboot using kexec. But if >> this is not present, it can fall back to executing the kexec user-space >> tool directly. The ability to force a kexec-reboot when systemctl kexec >> fails must only be used in controlled environments to avoid possible >> filesystem corruption and data loss. >>=20 > > Can the existence of systemd/systemctl be checked at configure-time? No - think about how binary distros work. Only on locally built environments like gentoo is configure time guaranteed to look like runtime. Consider Debian, for instance, which can run with multiple init systems (including openrc, if memory serves): for them, a configure-time check could make things worse. > I run OpenRC where systemctl is unavailable, so it looks like it would > always hit the error case unless I pass the arg twice. It could also > cause confusion to users if they notice it fails to call systemctl > when on non-systemd systems. I don't think this has the impact you're suggesting. This is new code - you can't kexec from grub2-emu today. It's also working as documented ("use kexec to boot Linux kernels via systemctl (pass twice to enable dangerous fallback to non-systemctl)."). I don't think a user reading that documentation would expect a system without systemctl functionality to support this feature. (Whether users expect their system to have systemctl functionality is better asked of initsystem developers than of me.) I want to be clear here that I support people working on other init systems, but if there's not an equivalent for this functionality, there's very little I can do here. > The simplest/safest solution would be to just disable this if the > configure check fails until `systemctl kexec`-equivalent code paths are > added. Careful with langauge, please. There is nothing unsafe about attempting to exec systemctl when it doesn't exist. And I don't think adding configuration checks makes code simpler. > I've CC-ed the Gentoo Base System project [1] in case some of them can > provide additional input, such as how to get the safe path working > with other init systems. Okay. Any input here is fine, but I think it will be easier for everyone if it's in the form of separate, follow-up patches. (I'm happy to review them once posted, if that's helpful; just CC me.) Be well, =2D-Robbie --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEA5qc6hnelQjDaHWqJTL5F2qVpEIFAmNO/fUUHHJoYXJ3b29k QHJlZGhhdC5jb20ACgkQJTL5F2qVpELwKxAArRsrJa2qibpa2tkGQJ/W+bLklPDL GO9dHhW7X3Po4UZYjTDf5uNoDbU2LvAz52estuIJvvGvScEauMoa1TTbEuXOFqrd j8T023f2iD28Qc3jvjb6ctaavtBYPM2N/TeH1euALJs9a4QNRNbfN6q26xT11amy q11Ij/t2IXvhYpy8wfrFizj1u13zqFi+YUchQAAxP1Kq6JEeWAL4kczPuhJbz5bf uOx1IOyiJl01TRePV8SFqkPUaFi6Rz+BjB+VODiFZ9NQAx3A9lOxdggRds9T9yUQ XOzkKQ1I7fZn0yyRk6IseFC0yQ+qkn9zPwMnXYY2fQ3PyX0PnBX1DyGH6ZvM1G06 K+fqIfP1juqDcwdwypc6XgeJ+3KmhjH/On5I+dlxXn6TOt/YrxwCYm992ckWV6D/ 2HLy9RPBGfrHFjSnB/PNg7GJHs4GhebTOYQRBwTMT3uPt1nxoZLQbhN6ioVaWvB2 2Wnne5TuaAYiIsYe45cPkU/RJQ2Onw7nbZ878eGckmCRcivnTLGdxyyRZbRSVxEU 7F7jMw2tYdvigaokXzcboPQGi9/dkPFORHq8sSBxi0LRszFvroKKB7/AyvUnTbry Kg/XXLgvNXiYEImvbRC3rNKiKfi3uuYle9OnvFnN6g2NedzIB/Z6Wqw4jVje7Jsh HO6xWw7KHle5ZRs= =oTcV -----END PGP SIGNATURE----- --=-=-=--