fixed #1026927 3.6-1
thanks
Am 14.01.2023 um 19:21 schrieb George Robbert:
Hey,
I think I found why you still get the error after applying the patch.
The same thing happened to me on another of my systems. The
difference was whether the package amd64-microcode was installed or
not. I think I have a patch (attached) for both. Here's what I found.
It looks like there are actually 2 related bugs here. The first one
(which my original patch for line 182 addresses) applies when there is
microcode available. The second, when there is not. Here's what I've
found:
Both of these are exposed on line 904 of /usr/sbin/needrestart
print "NEEDRESTART-UCEXP: $ucode_vars{AVAIL}\n";
when $ucode_vars{AVAIL} never gets set. There are 2 ways this can
happen. The second (which I just found), comes when AMD.pm finds an
AMD cpu, but does not find microcode for it (namely _scan_ucodes does
not find a matching file in /lib/firmware/amd-ucode/microcode_*.bin).
This will, under -v, print
"$LOGPREF #$info->{processor} no ucode updates available\n"
and return NRM_CURRENT (indicating no reboot for microcode needed),
but still leave $ucode_vars{AVAIL} unset. The fix is to make sure
that it is set even when there are no microcode updates available (on
line 176).
The first (original patch) bug comes when needrestart finds a matching
microcode. There, on line 182 of /usr/share/perl5/NeedRestart/uCode/AMD.pm
the line ends with a comma (,) instead of a semicolon (;), which means
that the assignment to $ucode_vars{AVAIL} is subsumed under the if ($debug)
condoling the printing of microcode version under. Thus,
$ucode_vars{AVAIL} is only set under needrestart -v.
The attached patch fixes both of these cases.
Thanks,
George
--- /tmp/AMD.pm 2023-01-14 09:09:28.324414456 -0700
+++ /usr/share/perl5/NeedRestart/uCode/AMD.pm 2023-01-14 09:11:39.210705528
-0700
@@ -173,13 +173,13 @@
_scan_ucodes();
}
-my %vars = ( CURRENT => sprintf( "0x%08x", $ucode ), );
+my %vars = ( CURRENT => sprintf( "0x%08x", $ucode ), AVAIL =>
"unavailable");
# check for microcode updates
if ( exists( $_ucodes->{cpuid}->{$cpuid} ) ) {
my $prid = $_ucodes->{cpuid}->{$cpuid};
if ( exists( $_ucodes->{prid}->{$prid} ) ) {
-$vars{AVAIL} = sprintf( "0x%08x", $_ucodes->{prid}->{$prid} ),
+$vars{AVAIL} = sprintf( "0x%08x", $_ucodes->{prid}->{$prid} );
print STDERR "$LOGPREF #$info->{processor} found ucode $vars{AVAIL}\n" if ($debug);
if ( $_ucodes->{prid}->{$prid} > $ucode ) {
Thanks for your new investigation, you were faster than me :)
I verified your patch, working also on my system now. I have filled
#1029147 and will upload a fixed package to stable after I have got the
approve from -release
Thanks for it!