VM detection is broken, leading to prompt to restart for microcode updates
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
needrestart (Ubuntu) | Status tracked in Mantic | |||||
Kinetic |
In Progress
|
Medium
|
Matthew Ruffell | |||
Lunar |
In Progress
|
Medium
|
Matthew Ruffell | |||
Mantic |
In Progress
|
Medium
|
Matthew Ruffell |
Bug Description
[Impact]
VM detection in needrestart was quietly and subtly broken in version 3.6 that ships in kinetic, lunar and mantic, where a spelling mistake had been made that incorrectly called /usr/bin/
This causes needrestart to think we are running in bare metal always, and it spends extra time checking microcode status, and sometimes prompting the user that their microcode is out of date, even know there is no way to apply microcode updates, which can mislead users each time they run apt install commands.
The fix is to correct the spelling mistake.
[Testcase]
Start a VM, I used a m5.large on AWS, with either kinetic, lunar or mantic.
If you run needrestart from your prompt, it checks for microcode. This run is on a system where the microcode package is at its latest, but on systems where it is out of date, you receive a curses prompt.
$ /usr/sbin/
[main] eval /etc/needrestar
[main] needrestart v3.6
[main] running in user mode
[Core] Using UI 'NeedRestart:
[main] systemd detected
[ucode] using NeedRestart:
[ucode] using NeedRestart:
[uCode/AMD] #0 cpu vendor id mismatch
[uCode/Intel] #0 current revision: 0x2006f05
+ + grep -oE [^[:space:]]+$
iucode_tool --scan-system
+ sig=0x00050654
+ [ -r /sys/devices/
+ filter=-S
+ test -r /etc/needrestar
+ . /etc/needrestar
+ type bsdtar
+ IUCODE_
+ test -r /etc/default/
+ . /etc/default/
+ test = no
+ [ -r /usr/share/
+ iucode_tool -l+ -Sgrep 0x00050654
--ignore-broken -tb /lib/firmware/
[uCode/Intel] #0 available revision: 0x2006e05
The processor microcode seems to be up-to-date.
If you install the test packages from the below ppa:
https:/
The expected output is to correctly register that we are running inside a VM and microcode checks can be skipped:
$ /usr/sbin/
[main] eval /etc/needrestar
[main] needrestart v3.6
[main] running in user mode
[Core] Using UI 'NeedRestart:
[main] systemd detected
[main] vm detected
[main] inside container or vm, skipping microcode checks
[Where problems could occur]
We are fixing a spelling mistake made in a previous commit, and not changing any functionality or behaviour. The spelling mistake changes invoking the incorrect /usr/bin/
Beforehand, /usr/bin/
If a regression were to occur, it would cause needrestart to interpret running in a VM or bare metal differently, and may or may not prompt the user at the correct times to restart any services or the system.
One thing to note is that needrestart is called automatically by apt after every install or remove invocation, and a regression could cause apt to return an error code, even when the packages were installed or removed correctly.
[Other Info]
Debian bug: https:/
This was fixed in the below commit, currently not tagged to a release:
commit 27bf4678bb92f68
From: zxyrepf <email address hidden>
Date: Sun, 24 Jul 2022 08:30:19 +0000
Subject: Fix VM detection regression introduced in f54d85c
Link: https:/
This fixes the regression introduced by:
commit f54d85cab33c450
From: Thomas Liske <email address hidden>
Date: Tue, 17 May 2022 15:38:42 +0200
Subject: [Core] Use ImVirt for virtualization detection if not running
on systemd (Debian Bug#984789 by Patrik Schindler <email address hidden>).
Link: https:/
Changed in needrestart (Ubuntu Kinetic): | |
status: | New → In Progress |
Changed in needrestart (Ubuntu Lunar): | |
status: | New → In Progress |
Changed in needrestart (Ubuntu Mantic): | |
status: | New → In Progress |
Changed in needrestart (Ubuntu Kinetic): | |
importance: | Undecided → Medium |
Changed in needrestart (Ubuntu Lunar): | |
importance: | Undecided → Medium |
Changed in needrestart (Ubuntu Mantic): | |
importance: | Undecided → Medium |
Changed in needrestart (Ubuntu Kinetic): | |
assignee: | nobody → Matthew Ruffell (mruffell) |
Changed in needrestart (Ubuntu Lunar): | |
assignee: | nobody → Matthew Ruffell (mruffell) |
Changed in needrestart (Ubuntu Mantic): | |
assignee: | nobody → Matthew Ruffell (mruffell) |
tags: | added: sts |
description: | updated |
summary: |
- typo systemds-detect-virt + VM detection is broken, leading to prompt to restart for microcode + updates |
tags: | added: sts-sponsor |
tags: | added: se-sponsor-halves |
Attached is a debdiff for mantic that solves this issue.