Bug 1443026 - DBus systemd unit name incorrect
Summary: DBus systemd unit name incorrect
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: usbguard
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Daniel Kopeček
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-18 10:50 UTC by Patrick Uiterwijk
Modified: 2017-06-15 12:01 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-15 12:01:21 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Patrick Uiterwijk 2017-04-18 10:50:45 UTC
Description of problem:
The name of the systemd service specified in /usr/share/dbus-1/system-services/org.usbguard.service is incorrect.

Version-Release number of selected component (if applicable):
usbguard-0.6.2-1.fc25.x86_64
usbguard-dbus-0.6.2-1.fc25.x86_64

How reproducible:
Consistent

Steps to Reproduce:
1. Install usbguard usbguard-dbus
2. See /usr/share/dbus-1/system-services/org.usbguard.service

Actual results:
SystemdService=dbus-org.usbguard.service

Expected results:
SystemdService=usbguard-dbus.service

Additional info:
Because of this, the org.usbguard dbus path is not actually available: dbus.exceptions.DBusException: org.freedesktop.systemd1.NoSuchUnit: Unit dbus-org.usbguard.service not found.

Updating the unit name in the dbus configuration fixes it.

Comment 1 Daniel Kopeček 2017-04-18 11:18:11 UTC
(In reply to Patrick Uiterwijk from comment #0)
> Description of problem:
> The name of the systemd service specified in
> /usr/share/dbus-1/system-services/org.usbguard.service is incorrect.
> 
> Version-Release number of selected component (if applicable):
> usbguard-0.6.2-1.fc25.x86_64
> usbguard-dbus-0.6.2-1.fc25.x86_64
> 
> How reproducible:
> Consistent
> 
> Steps to Reproduce:
> 1. Install usbguard usbguard-dbus
> 2. See /usr/share/dbus-1/system-services/org.usbguard.service
> 
> Actual results:
> SystemdService=dbus-org.usbguard.service
> 
> Expected results:
> SystemdService=usbguard-dbus.service
> 
> Additional info:
> Because of this, the org.usbguard dbus path is not actually available:
> dbus.exceptions.DBusException: org.freedesktop.systemd1.NoSuchUnit: Unit
> dbus-org.usbguard.service not found.
> 
> Updating the unit name in the dbus configuration fixes it.

There's an Alias= in the usbguard-dbus.service:

---snip---

[Install]
...
Alias=dbus-org.usbguard.service

---snip---

Does it not work properly?

Comment 2 Patrick Uiterwijk 2017-04-18 11:57:50 UTC
Seems like it doesn't based on the error I got from dbus when actually calling it..

Just install usbguard-dbus, and run gdbus introspect --system --dest org.usbguard --object-path /org/usbguard --recurse.

I am getting: Error: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit dbus-usbguard.service not found.

Comment 3 Daniel Kopeček 2017-04-18 12:42:08 UTC
(In reply to Patrick Uiterwijk from comment #2)
> Seems like it doesn't based on the error I got from dbus when actually
> calling it..
> 
> Just install usbguard-dbus, and run gdbus introspect --system --dest
> org.usbguard --object-path /org/usbguard --recurse.
> 
> I am getting: Error: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit
> dbus-usbguard.service not found.

Did you enable the usbguard-dbus service? i.e.:

# systemctl enable usbguard-dbus

If I do that on my system, then it works as expected.

Comment 4 Patrick Uiterwijk 2017-04-18 14:03:31 UTC
I did not (since editing the unit name in the dbus configuration worked), but even after that it doesn't work.

It works if I *start* usbguard-dbus, or if I reboot after enabling it (because then it's started), but isn't the whole point of the dbus configuration file to automatically start the service if it's stopped? (and as such, the enabling would also not be required?)


[root@krbadmin puiterwijk]# systemctl enable usbguard-dbus
Created symlink /etc/systemd/system/dbus-org.usbguard.service → /usr/lib/systemd/system/usbguard-dbus.service.
Created symlink /etc/systemd/system/multi-user.target.wants/usbguard-dbus.service → /usr/lib/systemd/system/usbguard-dbus.service.
[root@krbadmin puiterwijk]# gdbus introspect --system --dest org.usbguard --object-path /org/usbguard --recurse
Error: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit dbus-usbguard.service not found.

Comment 5 Patrick Uiterwijk 2017-04-18 14:09:48 UTC
Okay, so if I correctly revert the change I made to the dbus config file (to dbus-org.usbguard.service instead of forgetting the org.) it works.

However, I'm still confused why I need to enable it (to make the alias), if the whole point of the dbus config file is to automatically start the service when it's accessed.

Comment 6 Daniel Kopeček 2017-04-18 14:23:16 UTC
(In reply to Patrick Uiterwijk from comment #5)
> However, I'm still confused why I need to enable it (to make the alias), if
> the whole point of the dbus config file is to automatically start the
> service when it's accessed.

That is a good point. I should probably implement some sort of inactivity timeout and exit the service if it's not needed. Or maybe this something systemd could do. I don't know at this point.

Comment 7 Daniel Kopeček 2017-06-15 12:01:21 UTC
(In reply to Daniel Kopeček from comment #6)
> (In reply to Patrick Uiterwijk from comment #5)
> > However, I'm still confused why I need to enable it (to make the alias), if
> > the whole point of the dbus config file is to automatically start the
> > service when it's accessed.
> 
> That is a good point. I should probably implement some sort of inactivity
> timeout and exit the service if it's not needed. Or maybe this something
> systemd could do. I don't know at this point.

After some more thinking about this, I don't think there's anything to fix here. 

An inactivity timeout doesn't seem to be a useful thing after all, as it might lead to confusing situations / race conditions where a client calls a method the moment the service is shutting down.

The requirement to enable the service seems to be ok to me, as it is simply a way to say that the service should be enabled and available. As a maintainer, I'm not supposed to enable the service by default during the installation phase...


Note You need to log in before you can comment on or make changes to this bug.