Subject: Re: bug#33832: The VPN service 'org.freedesktop.NetworkManager.openvpn' was not installed.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 10 Jan 2019 07:51:07 -0500

Debugging a bit further, it seems that my change to the
network-manager-service-type had the following effect:

A file populated at /etc/dbus-1/system-local.conf now has an include
directive for network-manager-openvpn:

--8<---------------cut here---------------start------------->8---
<includedir>/gnu/store/gw3ckmw2pihc44d23lc8pipfw7wr16g7-network-manager-openvpn-1.8.0/etc/dbus-1/system.d</includedir>
--8<---------------cut here---------------end--------------->8---

There is no /etc/dbus-1/system.conf file, which usually should source
the above system-local.conf, although the package holds a copy of it
such as
/gnu/store/5bda3bgy871dyb9cna4k7gnz002j88rq-dbus-1.12.6/share/dbus-1/system.conf,
and this file has:

--8<---------------cut here---------------start------------->8---
<!-- This is included last so local configuration can override what's

       in this standard file -->
  <include ignore_missing="yes">/etc/dbus-1/system-local.conf</include>
--8<---------------cut here---------------end--------------->8---

I'm not sure if it works though, because using the Emacs dbus support to
view the available definitions, I cannot see the ones from the
system-local.conf file:

--8<---------------cut here---------------start------------->8---
(require 'dbus)
(dbus-list-activatable-names ':system)

;; Results:
("org.freedesktop.DBus"		     ;
 "org.freedesktop.UPower"	     ;from /etc/dbus-1/system-services
 "org.freedesktop.GeoClue2"	     ;from /etc/dbus-1/system-services
 "org.freedesktop.login1"	     ;from /etc/dbus-1/system-services
 "org.freedesktop.UDisks2"	     ;from /etc/dbus-1/system-services
 "org.freedesktop.ColorHelper"	     ;from /etc/dbus-1/system-services
 "org.freedesktop.PolicyKit1"	     ;from /etc/dbus-1/system-services
 "org.freedesktop.Accounts"	     ;from /etc/dbus-1/system-services
 "org.freedesktop.ColorManager"	     ;from /etc/dbus-1/system-services
 "org.freedesktop.nm_dispatcher")	;from /etc/dbus-1/system-services
--8<---------------cut here---------------end--------------->8---

So it could be that the system-local.conf file is not read in.

I've tried stracing the dbus-daemon (by attaching to it) as suggested by
Ludovic on #guix, but that doesn't mention anything about reading the
files.

So, to debug this further, I've added the documentation to dbus [1] and
in `man dbus-daemon`, we can read:

--8<---------------cut here---------------start------------->8---
DEBUGGING
       If you're trying to figure out where your messages are going or why you aren't getting messages, there are
       several things you can try.

       Remember that the system bus is heavily locked down and if you haven't installed a security policy file to
       allow your message through, it won't work. For the session bus, this is not a concern.

       The simplest way to figure out what's happening on the bus is to run the dbus-monitor program, which comes
       with the D-Bus package. You can also send test messages with dbus-send. These programs have their own man
       pages.

       If you want to know what the daemon itself is doing, you might consider running a separate copy of the daemon
       to test against. This will allow you to put the daemon under a debugger, or run it with verbose output,
       without messing up your real session and system daemons.

       To run a separate test copy of the daemon, for example you might open a terminal and type:

             DBUS_VERBOSE=1 dbus-daemon --session --print-address

       The test daemon address will be printed when the daemon starts. You will need to copy-and-paste this address
       and use it as the value of the DBUS_SESSION_BUS_ADDRESS environment variable when you launch the applications
       you want to test. This will cause those applications to connect to your test bus instead of the
       DBUS_SESSION_BUS_ADDRESS of your real session bus.

       DBUS_VERBOSE=1 will have NO EFFECT unless your copy of D-Bus was compiled with verbose mode enabled. This is
       not recommended in production builds due to performance impact. You may need to rebuild D-Bus if your copy
       was not built with debugging in mind. (DBUS_VERBOSE also affects the D-Bus library and thus applications
       using D-Bus; it may be useful to see verbose output on both the client side and from the daemon.)

       If you want to get fancy, you can create a custom bus configuration for your test bus (see the session.conf
       and system.conf files that define the two default configurations for example). This would allow you to
       specify a different directory for .service files, for example.
--8<---------------cut here---------------end--------------->8---

This should help in further debbugging the issue, along with this local
definition that enables the verbose mode of dbus:

--8<---------------cut here---------------start------------->8---
gnu/packages/glib.scm | 11 +++++++++++

modified   gnu/packages/glib.scm
@@ -68,6 +68,7 @@
   ;; Export variables up-front to allow circular dependency with the 'xorg'
   ;; module.
   #:export (dbus
+            my-dbus
             glib
             gobject-introspection
             dbus-glib
@@ -156,6 +157,16 @@ or through unencrypted TCP/IP suitable for use behind a firewall with
 shared NFS home directories.")
     (license license:gpl2+)))                     ; or Academic Free License 2.1
 
+(define my-dbus
+  (package
+    (inherit dbus)
+    (name "my-dbus")
+    (arguments
+     (substitute-keyword-arguments
+         (package-arguments dbus)
+       ((#:configure-flags flags)
+        `(cons "--enable-verbose-mode" ,flags))))))
+
 (define glib
   (package
    (name "glib")
--8<---------------cut here---------------end--------------->8---

To be continued...

Maxim

[1]:  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34028