Jira (FACT-2081) Facter virtual and is_virtual are wrong

6 views
Skip to first unread message

Kenyon Ralph (Jira)

unread,
Dec 5, 2020, 3:41:04 PM12/5/20
to puppe...@googlegroups.com
Kenyon Ralph updated an issue
 
Facter / Bug FACT-2081
Facter virtual and is_virtual are wrong
Change By: Kenyon Ralph
Summary: Facter virtual and is_virtual are worng wrong
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Kenyon Ralph (Jira)

unread,
Dec 5, 2020, 4:14:02 PM12/5/20
to puppe...@googlegroups.com
Kenyon Ralph updated an issue
Change By: Kenyon Ralph
Priority: Normal Critical

Kenyon Ralph (Jira)

unread,
Dec 5, 2020, 4:15:04 PM12/5/20
to puppe...@googlegroups.com
Kenyon Ralph updated an issue
Change By: Kenyon Ralph
Affects Version/s: FACT 4.0.46

Kenyon Ralph (Jira)

unread,
Dec 5, 2020, 4:25:03 PM12/5/20
to puppe...@googlegroups.com
Kenyon Ralph commented on Bug FACT-2081
 
Re: Facter virtual and is_virtual are wrong

Here is the problem: in https://github.com/puppetlabs/facter/blob/master/lib/src/facts/linux/virtualization_resolver.cc it uses lspci to detect virtualization. On my VMs, I do not have lspci (from the pciutils package on Debian) installed by default. Installing pciutils fixes the facts:

kenyon@alpha ~ % sudo aptitude install pciutils
The following NEW packages will be installed:
  libpci3{a} [1:3.5.2-1]  pciutils [1:3.5.2-1]
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 336 kB of archives. After unpacking 1,354 kB will be used.
Do you want to continue? [Y/n/?]
Get: 1 https://deb.debian.org/debian buster/main amd64 libpci3 amd64 1:3.5.2-1 [56.5 kB]
Get: 2 https://deb.debian.org/debian buster/main amd64 pciutils amd64 1:3.5.2-1 [279 kB]
Fetched 336 kB in 0s (3,876 kB/s)
Retrieving bug reports... Done
Parsing Found/Fixed information... Done
Selecting previously unselected package libpci3:amd64.
(Reading database ... 81974 files and directories currently installed.)
Preparing to unpack .../libpci3_1%3a3.5.2-1_amd64.deb ...
Unpacking libpci3:amd64 (1:3.5.2-1) ...
Preparing to unpack .../pciutils_1%3a3.5.2-1_amd64.deb ...
Unpacking pciutils (1:3.5.2-1) ...
Setting up libpci3:amd64 (1:3.5.2-1) ...
Setting up pciutils (1:3.5.2-1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10) ...
 
kenyon@alpha ~ % sudo facter is_virtual virtual
is_virtual => true
virtual => kvm

If you must use lspci to detect virtualization, then your packages need to depend on the pciutils package. However, pciutils is not a required package, and certainly there is no need for pciutils on virtual machines, and as my previous comment shows, there are other, better ways to detect virtualization (see how lscpu or systemd-detect-virt do it).

Reply all
Reply to author
Forward
0 new messages