From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 3F9051FF138 for ; Wed, 18 Feb 2026 17:23:51 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B3159599; Wed, 18 Feb 2026 17:24:49 +0100 (CET) Date: Wed, 18 Feb 2026 17:24:14 +0100 From: Stoiko Ivanov To: Manuel Federanko Subject: Re: [PATCH qemu-server] fix #5578: smbios: set serial number Message-ID: <20260218172414.79f1cc01@rosa.proxmox.com> In-Reply-To: <20260218142935.99693-1-m.federanko@proxmox.com> References: <20260218142935.99693-1-m.federanko@proxmox.com> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1771431846594 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.068 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 53LIU44SV2VM6J5V6HHTQTVRQXKOOXIR X-Message-ID-Hash: 53LIU44SV2VM6J5V6HHTQTVRQXKOOXIR X-MailFrom: s.ivanov@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Thanks for tackling this! comments/questions inline: On Wed, 18 Feb 2026 15:29:35 +0100 Manuel Federanko wrote: > If no smbios options are given on creation, default to generate a serial > number. This is required for Windows Autopilot to identify a user > device. The commit message could include a few more details - explaining some choices - e.g. - the bugzilla request suggest to use a (substring of) the smbios UUID (which should be unique and thus maybe a ok choice for a machine-serial number) as serial number - why did you chose to generate another random string? (if possible re-using parts of the uuid would sound elegant to me) > > Signed-off-by: Manuel Federanko > --- > src/PVE/API2/Qemu.pm | 5 ++++- > src/PVE/CLI/qm.pm | 5 ++++- > src/PVE/QemuServer.pm | 6 ++++++ > 3 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm > index c2e185a6..8d1e3ec0 100644 > --- a/src/PVE/API2/Qemu.pm > +++ b/src/PVE/API2/Qemu.pm > @@ -1471,7 +1471,10 @@ __PACKAGE__->register_method({ > > # auto generate uuid if user did not specify smbios1 option > if (!$conf->{smbios1}) { > - $conf->{smbios1} = PVE::QemuServer::generate_smbios1_uuid(); > + $conf->{smbios1} = > + PVE::QemuServer::generate_smbios1_uuid() . "," > + . PVE::QemuServer::generate_smbios1_serial() > + . ",base64=1"; why add the base64 here - the commit introducing it mentions embedded nul-bytes: > } > > if ( > diff --git a/src/PVE/CLI/qm.pm b/src/PVE/CLI/qm.pm > index bdae9641..44c74eed 100755 > --- a/src/PVE/CLI/qm.pm > +++ b/src/PVE/CLI/qm.pm > @@ -912,7 +912,10 @@ __PACKAGE__->register_method({ > eval { > # order matters, as do_import() will load_config() internally > $conf->{vmgenid} = PVE::QemuServer::generate_uuid(); > - $conf->{smbios1} = PVE::QemuServer::generate_smbios1_uuid(); > + $conf->{smbios1} = > + PVE::QemuServer::generate_smbios1_uuid() . "," > + . PVE::QemuServer::generate_smbios1_serial() > + . ",base64=1"; > PVE::QemuConfig->write_config($vmid, $conf); > > foreach my $disk (@{ $parsed->{disks} }) { > diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm > index 545758dc..a8cc7d85 100644 > --- a/src/PVE/QemuServer.pm > +++ b/src/PVE/QemuServer.pm > @@ -8086,6 +8086,12 @@ sub generate_smbios1_uuid { > return "uuid=" . generate_uuid(); > } > > +sub generate_smbios1_serial { > + my @population = ('0' .. '9', 'A' .. 'Z', 'a' .. 'z'); > + my $serial = join('', map($population[rand(@population)], 1 .. 12)); > + return "serial=" . encode_base64($serial, ""); > +} > + > sub create_reboot_request { > my ($vmid) = @_; > open(my $fh, '>', "/run/qemu-server/$vmid.reboot")