[systemd-devel] Authenticating "sd bus" fails with Invalid argument

magnus at minimum.se magnus at minimum.se
Tue Jun 19 12:32:19 UTC 2018


Hi,
I'm trying to migrate a sys V-based system to systemd. At the moment, I'm using systemd 232. The system is on a quite old kernel (3.18.44), but I have enabled the kernel configs listed in the systemd README. Things are mostly working except systemd-logind.service fails to start. When I check systemctl status systemd-logind.service, it says:
Failed to get properties: Invalid argument
In addition, once I start playing around with systemd commands from the shell, I see similar errors ("Invalid argument"). For example, running busctl (or busctl --list) gives:
Failed to list names: Invalid argument
I've enabled systemd debug by putting systemd.log_level=debug on the kernel cmdline. If I review the bootlog, journalctl -b, I notice the following additional errors:
* systemd-gpt-auto-generator fails with out of memory errors. I found a bug in the systemd issue tracker (https://bugs.freedesktop.org/show_bug.cgi?id=76058 (https://bugs.freedesktop.org/show_bug.cgi?id=76058)), and its fix is included in my build. Still getting the OOM. My device is NAND based with UBIFS, so it does not even use GPT. I don't know if this is relevant to my "main" issue.
* dbus seem to start OK but systemd emits a few errors just after:

[  OK  ] Started D-Bus System Message Bus.
[    6.115125] systemd[1]: Failed to subscribe to NameOwnerChanged signal for 'org.freedesktop.login1': Invalid argument
[    6.160342] systemd[1]: Failed to register name: Invalid argument
[    6.170734] systemd[1]: Failed to set up API bus: Invalid argument
* My dbus seem to be OK. busctl --list fails but I can do it manually using dbus-send:
root at chihuahua:~# dbus-send --system            
>   --dest=org.freedesktop.DBus 
>   --type=method_call          
>   --print-reply               
>   /org/freedesktop/DBus       
>   org.freedesktop.DBus.ListNames
method return time=1529311428.695165 sender=org.freedesktop.DBus -> destination=:1.0 serial=3 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string ":1.0"
   ]
When I dive deeper into the systemd source code, I find that the issue is that my "sd bus" is not in running state when it should be. Here's a trace of whats going on when I call busctl --list:
1) sd_bus_list_names()
2) bus_list_names_dbus1()
3) sd_bus_call_method()
4) sd_bus_call()
sd_bus_call() fails because my bus is not in running state. bus_ensure_running() tries to put my bus into running state by the following sequence:
1) sd_bus_process()
2) bus_process_internal()
.. where it detects that my bus is in "authenticating" state and tries to authenticate by bus_socket_write_auth() (which is successfull) and then read the auth using bus_socket_read_auth(). At this point, things go wrong when recvmsg() is called on bus->input_fd with flags MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC. This syscall returns -22 (Invalid argument) which propagates all the way up to the user.
Any ideas why I'm getting Invalid argument error here? This error is reoccuring all over systemd where when it tries to authenticate on the bus and put it into running state. 
Any ideas on what might be wrong? Since this system never ran systemd before, I suspect it could be missing libs and/or additional kernel configs. My limited knowledge in systemd internals make this very difficult to debug.
Thanks in advance, Magnus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180619/1e6a7116/attachment.html>


More information about the systemd-devel mailing list