Bug 80665 - systemd-analyze plot as root missing hostnamed data
Summary: systemd-analyze plot as root missing hostnamed data
Status: NEW
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-29 07:59 UTC by Steven Noonan
Modified: 2014-06-29 08:04 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Steven Noonan 2014-06-29 07:59:06 UTC
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.
Comment 1 Steven Noonan 2014-06-29 08:04:36 UTC
Also, when run as a non-root user, "systemd-analyze --user plot" is also missing the systemd-hostnamed metadata:

$ systemd-analyze --user plot | grep Linux
<text x="20" y="50">Startup finished in 47ms (userspace) = 47ms</text><text x="20" y="30">Linux  (  ) x86-64 </text><g transform="translate(20.000,100)">


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.