[FACT-697] If NetworkManager is installed but not used facter throws a warning. Created: 2014/09/02  Updated: 2015/05/20  Resolved: 2015/05/20

Status: Closed
Project: Facter
Component/s: Community
Affects Version/s: FACT 2.1.0, FACT 2.2.0
Fix Version/s: FACT 2.4.0, FACT 2.4.4

Type: Bug Priority: Normal
Reporter: Sean Edge Assignee: Unassigned
Resolution: Done Votes: 5
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Story Points: 1
Sprint: Client 2015-04-29
QA Contact: Eric Thompson

 Description   

If the NetworkManager package is installed, but not used, facter throws a warning.

[sedge@bi ~]$ facter
 
** (process:29822): WARNING **: nm_client_get_devices: error getting devices: The name org.freedesktop.NetworkManager was not provided by any .service files
 
architecture => x86_64
augeasversion => 1.0.0
... etc ...

It appears to be happening when facter runs "nmcli d" to get all the devices:

[sedge@bi ~]$ nmcli d
 
** (process:30182): WARNING **: nm_client_get_devices: error getting devices: The name org.freedesktop.NetworkManager was not provided by any .service files
 
DEVICE     TYPE              STATE
[sedge@bi ~]$



 Comments   
Comment by Niels Abspoel [ 2014/09/04 ]

I can confirm that facter requires NetworkManager managing the network

On my archlinux box facter it will give the following error:
Error: NetworkManager is not running.

and on the commandline:

[root]# nmcli d
Error: NetworkManager is not running.

I'm using systemd-networkd for my networks.

Comment by Trevor Vaughan [ 2014/11/02 ]

This is still an issue.

Adding the following confine to dhcp_servers.rb works a charm:

confine do
  Facter::Core::Execution.exec("nmcli -t -f STATE g").strip != 'unknown'
end

Comment by Trevor Vaughan [ 2014/11/10 ]

Added a PR for this issue.

Comment by Peter Huene [ 2014/12/01 ]

Follow up merge to fix failing acceptance test: https://github.com/puppetlabs/facter/commit/560da58cbc5461c2cbefdc5c0e6bcb0b1ab8241d

Comment by Eric Thompson [ 2014/12/16 ]

verified on rhel7 at SHA 7e32ab6 with:

[root@e7u2fbqxqoxur75 ~]# systemctl status NetworkManager.service
NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled)
   Active: active (running) since Tue 2014-12-16 16:30:10 PST; 20min ago
 Main PID: 1957 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           ├─1957 /usr/sbin/NetworkManager --no-daemon
           └─1987 /sbin/dhclient -d -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-ens192.pid -lf /var/lib/NetworkManager/dhclient-fd724390-94d5-4fd7-917c-4b273b739426-ens...
 
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info> (ens192): DHCPv4 state changed renew -> renew
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   address 10.32.122.42
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   plen 20 (255.255.240.0)
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   gateway 10.32.112.1
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   server identifier 10.32.44.10
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   lease time 900
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   nameserver '10.240.0.10'
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   nameserver '10.240.1.10'
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   domain name 'delivery.puppetlabs.net'
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: bound to 10.32.122.42 -- renewal in 341 seconds.
[root@e7u2fbqxqoxur75 ~]# facter dhcp_servers
{"system"=>"10.32.44.10", "ens192"=>"10.32.44.10"}
[root@e7u2fbqxqoxur75 ~]# systemctl stop NetworkManager.service
[root@e7u2fbqxqoxur75 ~]# systemctl status NetworkManager.service
NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled)
   Active: inactive (dead) since Tue 2014-12-16 16:50:39 PST; 2s ago
 Main PID: 1957 (code=exited, status=0/SUCCESS)
 
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   server identifier 10.32.44.10
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   lease time 900
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   nameserver '10.240.0.10'
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   nameserver '10.240.1.10'
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: <info>   domain name 'delivery.puppetlabs.net'
Dec 16 16:49:59 e7u2fbqxqoxur75 NetworkManager[1957]: bound to 10.32.122.42 -- renewal in 341 seconds.
Dec 16 16:50:31 e7u2fbqxqoxur75 NetworkManager[1957]: <info> NetworkManager state is now CONNECTED_GLOBAL
Dec 16 16:50:39 e7u2fbqxqoxur75 systemd[1]: Stopping Network Manager...
Dec 16 16:50:39 e7u2fbqxqoxur75 NetworkManager[1957]: <info> caught signal 15, shutting down normally.
Dec 16 16:50:39 e7u2fbqxqoxur75 systemd[1]: Stopped Network Manager.
[root@e7u2fbqxqoxur75 ~]# facter dhcp_servers
Error: NetworkManager is not running.
 
[root@e7u2fbqxqoxur75 ~]# facter
Error: NetworkManager is not running.
architecture => x86_64
bios_release_date => 07/30/2013

Comment by William Hopper [ 2015/01/22 ]

Released in Facter 2.4.0.

Comment by Dj Merrill [ 2015/03/30 ]

Looks like updates from Centos 7.0 to 7.1 (CR repo) has caused this to appear again using facter 2.4.1.

Centos 7.0, fully patched without 7.1 CR updates:

  1. systemctl status NetworkManager.service
    NetworkManager.service - Network Manager
    Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled)
    Active: inactive (dead) since Mon 2015-03-30 10:12:23 EDT; 29s ago
    Main PID: 10776 (code=exited, status=0/SUCCESS)
  1. facter dhcp_servers
  1. facter -v
    2.4.1

Centos 7.0, fully patched with 7.1 CR updates:

  1. systemctl status NetworkManager.service
    NetworkManager.service - Network Manager
    Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled)
    Active: inactive (dead)
  1. facter dhcp_servers
    Error: NetworkManager is not running.
  1. facter -v
    2.4.1
Comment by Peter Meier [ 2015/04/07 ]

I can confirm this appears on CentOS 7.1 using facter 2.4.3

$ facter -v
2.4.3
$ facter os
{"name"=>"CentOS", "family"=>"RedHat", "release"=>{"major"=>"7", "minor"=>"1", "full"=>"7.1.1503"}}
$ facter dhcp_servers
Error: NetworkManager is not running.

Comment by Peter Meier [ 2015/04/12 ]

Problem is that NetworkManager is printing to STDERR:

# nmcli -t -f STATE g 2> /dev/null
# nmcli -t -f STATE g 
Error: NetworkManager is not running.
# nmcli -t -f STATE nm·
Error: Object 'nm' is unknown, try 'nmcli help'.
# facter os
{"name"=>"CentOS", "family"=>"RedHat", "release"=>{"major"=>"7", "minor"=>"1", "full"=>"7.1.1503"}}
# nmcli --version
nmcli tool, version 1.0.0-14.git20150121.b4ea599c.el7

PR that addresses this: https://github.com/puppetlabs/facter/pull/919

Comment by Kurt Wall [ 2015/04/16 ]

Verified in pl-facter-b1c85e7b2fede74091875f3c2c38ccc55f94835e-el-7-x6_64 on CentOS 7 x86_64. facter does not throw a warning when NetworkManager is installed and not running:

# nmcli d
Error: NetworkManager is not running.
 
# facter 
disks => {
  fd0 => {
    size => "4.00 KiB",
    size_bytes => 4096
  },
  sda => {
    model => "Virtual disk",
    size => "16.00 GiB",
    size_bytes => 17179869184,
    vendor => "VMware"
...

Comment by Kylo Ginsberg [ 2015/05/15 ]

Note that the followon fix will be released in facter 2.4.4.

Generated at Sat Dec 07 15:49:01 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.