From nobody Sat Aug 13 22:58:28 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M4wv91WQcz4Z2nm; Sat, 13 Aug 2022 22:58:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M4wv90kdtz3KV7; Sat, 13 Aug 2022 22:58:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660431509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LrlawxTSxg6663LPoHRM/z9aR5QFY9Tx/KXgCGLihRE=; b=gSGcDpxi5n5cmyRSl8Jrh5M0BQfV6z/hZ05CVJhH1yylqjb8RadGWH7NiRLNvJTwq2WMdn eOCOwxL0ZPGUzogxkYSY7w0IleJLmhHThdckbtfYWwoUrufxC2bSmfNF8PUT+byS2Piqw3 n0PXQdiZqwgVgXsLL4dkleqUwABwAYoS952ICP35rGWot2UHVPCr49T6IiAOeWCovBM8XR /lR97KCfHTVoRCrK8nEnxFl7P9GI7EsnMfUDVdbwRfQGRFvM9x0G4P5QckM1DLvEStc+Ug 1B+YPwnT6oxZXZIdg//B2XQGvPX2Gg8KurgUZW0XXdpOBE9MsvTbeaFfcGK7bQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M4wv86f6GzT06; Sat, 13 Aug 2022 22:58:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27DMwSn9012475; Sat, 13 Aug 2022 22:58:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27DMwSXv012474; Sat, 13 Aug 2022 22:58:28 GMT (envelope-from git) Date: Sat, 13 Aug 2022 22:58:28 GMT Message-Id: <202208132258.27DMwSXv012474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: cc495d3b679d - main - rc.d/hostid: Skip warning on systems w/o smbios List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc495d3b679d32324d8914adb10e293e7deae82b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660431509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LrlawxTSxg6663LPoHRM/z9aR5QFY9Tx/KXgCGLihRE=; b=ZgBuJGol8SgFZaLkd3ylY2q7PWn/vnjoh1s9UlV7wFB2BfN6jjbWeux4FCzHVTieyI20ag jlmrKkH/WgKsZ0q7qgweEf/XjT2YJqcYGCc5JakjJpAXaXU2803w2qBpevuZzMysWRMlI3 anJhYHfPlRYf3YAvxPJgtnW2UaZdNQPoHt74jzDca9L8tw+Be4CakfPT6SiulKw0mFnYv7 1nJ2+ckFRM2lUiDHDh3BOVvMDwDY/19bXhmAyE1X7k/QYS5AuWdVOjfESc8bHj+lXWLic2 PPhjZ0tNk7p5+3FER5lwVQszkrDXvuduNdaJWZfBliaOX7/aIIezpCUp4dV2bQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660431509; a=rsa-sha256; cv=none; b=SbKquoZlhfT3PB0LslMNTwy8VLA2kj+Z0550IF2OSMhO7+qUgE9wPHdCIwltPDtM5HvvnE nANWhOQGVAOPQUUYVINJjjHUzzWz2dqEgFJf8MhDJpAW7wNMg07Ra4vutm2dZTbnoZecBg tpi9x08/BEl6zMiom/Jmlr4ZRPKFbikBWj3sCYKD8W8z54UMPUOTuaPwdZwLFfLZwAznt+ 3RwqJxcsCeIOBTzhxnohtKRBhmQGRbqpSMl873ioRj9DrpYpsG60iAT964jZcNNYuXJJJV CnpHKQswLTFkJdR6IC9BVw86YM89IMZWSP0JiEC7WhR14B59uhe3sEeI8N/gTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=cc495d3b679d32324d8914adb10e293e7deae82b commit cc495d3b679d32324d8914adb10e293e7deae82b Author: Colin Percival AuthorDate: 2022-08-12 23:48:26 +0000 Commit: Colin Percival CommitDate: 2022-08-13 22:58:16 +0000 rc.d/hostid: Skip warning on systems w/o smbios The first time a FreeBSD system boots, it obtains a hostuuid and hostid from the smbios.system.uuid kernel environment variable. If this value is found to be invalid, a warning is printed and the boot pauses for two seconds to give the user a chance to read it. If the FreeBSD kernel is launched directly in a virtual machine rather than via the FreeBSD boot loader, the smbios.system.uuid environment variable might not be set; in this case, there's no need to alert the user and delay the boot process since the lack of a "hardware" uuid is entirely expected. Distinguish between the cases of "invalid UUID" and "no UUID", warning and delaying the boot only in the former case. In both cases we still generate a random UUID in software. Reviewed by: delphij Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D36185 --- libexec/rc/rc.d/hostid | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/hostid b/libexec/rc/rc.d/hostid index 39a0f4acb498..494e4aba84e1 100755 --- a/libexec/rc/rc.d/hostid +++ b/libexec/rc/rc.d/hostid @@ -106,6 +106,8 @@ hostid_hardware() if valid_hostid $uuid; then echo "${uuid}" + elif [ "$uuid" ]; then + echo "INVALID" fi } @@ -113,9 +115,16 @@ hostid_generate() { # First look for UUID in hardware. uuid=`hostid_hardware` - if [ -z "${uuid}" ]; then + + # Warn about invalid UUIDs + if [ "${uuid}" = "INVALID" ]; then warn "hostid: unable to figure out a UUID from DMI data, generating a new one" sleep 2 + uuid="" + fi + + # Generate a random UUID if invalid or not found + if [ -z "${uuid}" ]; then # If not found, fall back to software-generated UUID. uuid=`uuidgen` fi