<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - systemd-analyze plot as root missing hostnamed data"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=80665">80665</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>systemd-analyze plot as root missing hostnamed data
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>steven@uplinklabs.net
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I've noticed that "systemd-analyze plot" is failing to read data owned by
systemd-hostnamed when run as the root user:

$ systemd-analyze plot | grep Linux
<text x="20" y="50">Startup finished in 6.382s (kernel) + 7.912s (userspace) =
14.295s</text><text x="20" y="30">Arch Linux loki (Linux 3.15.2-1-ec2 #1 SMP
Fri Jun 27 04:10:09 UTC 2014) x86-64 </text><g
transform="translate(20.000,100)">

$ sudo systemd-analyze plot | grep Linux
<text x="20" y="50">Startup finished in 6.382s (kernel) + 7.912s (userspace) =
14.295s</text><text x="20" y="30">Linux  (  ) x86-64 </text><g
transform="translate(20.000,100)">

Note the lack of kernel version, distribution, hostname, etc. in the latter
case.

hostnamectl correctly reads this data when run as either root or a
non-privileged user.

The difference, from what I can find, is that hostnamectl uses
bus_open_transport() while systemd-analyze uses bus_open_transport_systemd().
This changes which dbus address is used.

bus_open_transport() always sets the address to
"unix:path=/var/run/dbus/system_bus_socket".

When run as an unprivileged user, bus_open_transport_systemd() does the same.
But when run as uid 0, bus_open_transport_systemd() sets the bus address to
"unix:path=/run/systemd/private", which isn't the right address to talk to
systemd-hostnamed.

Commit 1f89214e introduced the use of bus_open_transport_systemd() in
systemd-analyze to allow for "systemd-analyze --user" to function correctly, so
I don't think it's appropriate to just use bus_open_transport() here. I've
confirmed that "systemd-analyze --user" doesn't work without that change.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>