Cannot run nmcli within an RPM

Some corporations distribute VPN profiles via RPMs, which run nmcli c r after the VPM profiles have been added.

Installing this kind of RPM via rpm-ostree leads to the following error (captured in journalctl):

May 01 08:46:28 localhost.localdomain rpm-ostree(corp-NetworkManager-openvpn-profiles.post)[2178]: Error: Could not create NMClient object: Could not connect: No such file or directory.

Extracting the content from the RPM and installing manually works fine as long as the VPN profiles have the right user ownership (i.e. after copying run chown root:root).

Right, I think their specfile should do:

if ! [ -f /run/ostree-booted ]; then
  nm cli c reload
fi

or so.

But the why it fails is interesting and important - it’s because installing an RPM cannot affect your booted system - it runs through the same infrastructure for applying updates, which also should not affect your booted system. A bit more info here: https://github.com/coreos/rpm-ostree/issues/639

But the why it fails is interesting and important - it’s because installing an RPM cannot affect your booted system

Fascinating. So presumably if nm cli c reload is not called then the new NetworkManager configuration is loaded after the next reboot.