After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766332 - data: Add a way for Rygel to be started via user systemd
data: Add a way for Rygel to be started via user systemd
Status: RESOLVED FIXED
Product: rygel
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: rygel-maint
rygel-maint
Depends on:
Blocks: 766329
 
 
Reported: 2016-05-12 14:01 UTC by Bastien Nocera
Modified: 2016-08-30 10:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
data: Add a way for Rygel to be started via user systemd (2.98 KB, patch)
2016-05-12 14:01 UTC, Bastien Nocera
none Details | Review
data: Add a way for Rygel to be started via user systemd (3.60 KB, patch)
2016-05-13 08:47 UTC, Bastien Nocera
committed Details | Review
[PATCH 1/2] data: Add missing SystemdService for DBus activation (767 bytes, patch)
2016-05-23 19:15 UTC, Jan Alexander Steffens (heftig)
committed Details | Review
[PATCH 2/2] data: Add [Install] section to rygel.service (1.08 KB, patch)
2016-05-23 19:16 UTC, Jan Alexander Steffens (heftig)
committed Details | Review

Description Bastien Nocera 2016-05-12 14:01:53 UTC
.
Comment 1 Bastien Nocera 2016-05-12 14:01:57 UTC
Created attachment 327715 [details] [review]
data: Add a way for Rygel to be started via user systemd

This will allow better tracking of whether rygel is running, ensuring
that even if the manager to enable/disable its startup
(gnome-settings-daemon) crashes and needs to restart, its status is
still available by querying the user systemd.
Comment 2 Jens Georg 2016-05-12 16:42:03 UTC
*** Bug 748921 has been marked as a duplicate of this bug. ***
Comment 3 Jens Georg 2016-05-12 16:43:17 UTC
Does it make sense to roll out both service files, this and the system-wide together? Should the user file also be used as system file?
Comment 4 Bastien Nocera 2016-05-12 16:47:17 UTC
(In reply to Jens Georg from comment #3)
> Does it make sense to roll out both service files, this and the system-wide
> together? Should the user file also be used as system file?

Very different use cases. The file in https://github.com/GNOME/rygel/blob/master/examples/service/systemd/rygel.service requires manual changes (at least the user name), and is built to be enabled by default on an "embedded" or single-use machine, not to run as a service under an existing session.
Comment 5 Jens Georg 2016-05-12 20:30:52 UTC
Review of attachment 327715 [details] [review]:

::: data/Makefile.am
@@ +21,3 @@
+systemdservicedir = $(systemduserunitdir)
+systemdservice_in_files = rygel.service.in
+systemdservice_DATA = rygel.service

This seems to break make distcheck because it tries to install to /usr/lib/systemd/user, ignoring prefix. Any suggestions?
Comment 6 Bastien Nocera 2016-05-13 01:48:19 UTC
(In reply to Jens Georg from comment #5)
> Review of attachment 327715 [details] [review] [review]:
> 
> ::: data/Makefile.am
> @@ +21,3 @@
> +systemdservicedir = $(systemduserunitdir)
> +systemdservice_in_files = rygel.service.in
> +systemdservice_DATA = rygel.service
> 
> This seems to break make distcheck because it tries to install to
> /usr/lib/systemd/user, ignoring prefix. Any suggestions?

You should add something like this to the top-level Makefile.am:
DISTCHECK_CONFIGURE_FLAGS = --with-systemduserunitdir='$${libdir}/systemd/user-distcheck'

The "-distcheck" bit is just to show that it's not supposed to be there. Want me to respin a patch with that? Did you get a chance to try it?

If you can't test it, I'll respin a patch, check that distcheck passes and that it works as expected with the Sharing panel before committing.
Comment 7 Bastien Nocera 2016-05-13 08:47:09 UTC
Created attachment 327764 [details] [review]
data: Add a way for Rygel to be started via user systemd

This will allow better tracking of whether rygel is running, ensuring
that even if the manager to enable/disable its startup
(gnome-settings-daemon) crashes and needs to restart, its status is
still available by querying the user systemd.
Comment 8 Debarshi Ray 2016-05-18 16:17:09 UTC
Review of attachment 327764 [details] [review]:

Just relaying David's comment from bug 766330 that ...

::: Makefile.am
@@ +13,3 @@
              build-aux/git-version-gen
 
+DISTCHECK_CONFIGURE_FLAGS = --with-systemduserunitdir='$${libdir}/systemd/user-distcheck'

... this should be AM_DISTCHECK_CONFIGURE_FLAGS.
Comment 9 Jens Georg 2016-05-19 19:26:44 UTC
Attachment 327764 [details] pushed as f206586 - data: Add a way for Rygel to be started via user systemd
Comment 10 Jan Alexander Steffens (heftig) 2016-05-23 19:14:57 UTC
This is missing the SystemdService=rygel.service; right now rygel.service added can only be started manually.
Comment 11 Jan Alexander Steffens (heftig) 2016-05-23 19:15:56 UTC
Created attachment 328402 [details] [review]
[PATCH 1/2] data: Add missing SystemdService for DBus activation

Without this, DBus could start an independent instance of rygel.
Comment 12 Jan Alexander Steffens (heftig) 2016-05-23 19:16:40 UTC
Created attachment 328403 [details] [review]
[PATCH 2/2] data: Add [Install] section to rygel.service

This allows running `systemctl --user enable rygel` in order to
automatically launch rygel at login. The default behavior is not
changed.

If lingering is also enabled for the user, rygel will be started
at boot; this will then share media without needing a session.

Since this disregards whether GSD would have launched rygel, it
is primarily useful for headless servers and avoids the wrap-dbus
hack used by the example system service.
Comment 13 Jens Georg 2016-05-25 08:36:34 UTC
(In reply to Jan Alexander Steffens (heftig) from comment #11)
> Created attachment 328402 [details] [review] [review]
> [PATCH 1/2] data: Add missing SystemdService for DBus activation
> 
> Without this, DBus could start an independent instance of rygel.

With this, is it still possible to start Rygel through DBus independently of systemd?
Comment 14 Jan Alexander Steffens (heftig) 2016-05-25 10:27:10 UTC
Sure. This just prevents the situation where DBus activates rygel and systemd still reports it as inactive.

If the bus was not started in systemd activation mode, DBus activates as usual.
Comment 15 Jens Georg 2016-05-25 10:36:43 UTC
Review of attachment 328402 [details] [review]:

+1
Comment 16 Jens Georg 2016-05-25 10:36:57 UTC
Review of attachment 328403 [details] [review]:

+1
Comment 17 Bastien Nocera 2016-05-25 13:39:45 UTC
Review of attachment 328403 [details] [review]:

> This allows running `systemctl --user enable rygel` in order to
> automatically launch rygel at login.

I really don't like this, it would clash with gnome-settings-daemon's Sharing support.

I'll start getting bugs that the 2 aren't in sync, etc. We want the default to be "rygel is not started", and for the sharing plugin of gnome-settings-daemon to be the one starting it.

If we're going this way, I'm going to have to run "disable" for every one of those services when gnome-settings-daemon starts.
Comment 18 Jens Georg 2016-05-25 16:55:40 UTC
(In reply to Bastien Nocera from comment #17)
> Review of attachment 328403 [details] [review] [review]:
> 
> > This allows running `systemctl --user enable rygel` in order to
> > automatically launch rygel at login.
> 
> I really don't like this, it would clash with gnome-settings-daemon's
> Sharing support.
> 
> I'll start getting bugs that the 2 aren't in sync, etc. We want the default
> to be "rygel is not started", and for the sharing plugin of
> gnome-settings-daemon to be the one starting it.
> 
> If we're going this way, I'm going to have to run "disable" for every one of
> those services when gnome-settings-daemon starts.

To my understanding, adding the first patch ensures that there will be only one for that particular user?

Would gnome-settings-daemon then not know that it's already running?
Comment 19 Jan Alexander Steffens (heftig) 2016-05-25 17:18:08 UTC
You don't need to disable rygel; the default state is disabled. User interaction is required to enable it, so rygel won't launch by default.

If it's enabled, the user configured it that way. Allowing rygel to be started at login/boot without the help of GSD has use outside of GNOME.

Stopping rygel at GSD initialization shouldn't be any more difficult than starting it. You'll be starting and stopping rygel dynamically, anyway.
Comment 20 Bastien Nocera 2016-05-26 12:45:18 UTC
(In reply to Jan Alexander Steffens (heftig) from comment #19)
> You don't need to disable rygel; the default state is disabled. User
> interaction is required to enable it, so rygel won't launch by default.
> 
> If it's enabled, the user configured it that way. Allowing rygel to be
> started at login/boot without the help of GSD has use outside of GNOME.

Not one that I care one iota about, and I'd rather scrap most of those patches to ship the .service files in g-s-d than to allow users to shoot themselves in the foot too easily. This has privacy concerns.

> Stopping rygel at GSD initialization shouldn't be any more difficult than
> starting it. You'll be starting and stopping rygel dynamically, anyway.

If lingering is enabled, and the user logs out, then there's nothing to stop rygel when the network changes. This is a privacy concern.
Comment 21 Zeeshan Ali 2016-05-26 12:56:07 UTC
(In reply to Bastien Nocera from comment #20)
> (In reply to Jan Alexander Steffens (heftig) from comment #19)
> > You don't need to disable rygel; the default state is disabled. User
> > interaction is required to enable it, so rygel won't launch by default.
> > 
> > If it's enabled, the user configured it that way. Allowing rygel to be
> > started at login/boot without the help of GSD has use outside of GNOME.
> 
> Not one that I care one iota about,

I thought you'd have preferred if your NAS had rygel on it. :) I think supporting headless (where GNOME doesn't make much sense) systems of all kind is important. Then there is also other embedded system (Rygel is used on phones and cars). So I think non-gsd case is very important here.
Comment 22 Bastien Nocera 2016-05-26 13:20:42 UTC
(In reply to Zeeshan Ali (Khattak) from comment #21)
> (In reply to Bastien Nocera from comment #20)
> > (In reply to Jan Alexander Steffens (heftig) from comment #19)
> > > You don't need to disable rygel; the default state is disabled. User
> > > interaction is required to enable it, so rygel won't launch by default.
> > > 
> > > If it's enabled, the user configured it that way. Allowing rygel to be
> > > started at login/boot without the help of GSD has use outside of GNOME.
> > 
> > Not one that I care one iota about,
> 
> I thought you'd have preferred if your NAS had rygel on it. :) I think
> supporting headless (where GNOME doesn't make much sense) systems of all
> kind is important. Then there is also other embedded system (Rygel is used
> on phones and cars). So I think non-gsd case is very important here.

I don't care in the context of this bug. It's not like it would be complicated to replace the service file for those embedded cases. It will however be a major PITA if distributions have to patch rygel and other service files to work with GNOME.
Comment 23 Jan Alexander Steffens (heftig) 2016-05-26 13:25:10 UTC
You don't need to patch rygel. The default state is disabled.
Comment 24 Bastien Nocera 2016-05-26 13:26:48 UTC
(In reply to Jan Alexander Steffens (heftig) from comment #23)
> You don't need to patch rygel. The default state is disabled.

Sure, then the user enables it by hand, and the UI is busted because it will restart it on every new login, even if the network doesn't match. Is that right?
Comment 25 Jan Alexander Steffens (heftig) 2016-05-26 13:46:15 UTC
No, the UI is not busted because start/stop commands from GSD still have the effect they're supposed to have. If the user logs into GNOME, GSD can control rygel all it wants.

In fact, I'd consider GSD running "disable" evil as it overrides user configuration with its own.

In either case distributions won't need to patch rygel to work with GNOME, as the default state is disabled. But they will have to patch rygel if they want "enable" to work.

Enabling rygel will start it at login because that's what the user commanded to happen. Why is this so much of an issue? People who are dependent on the GNOME UI don't run "systemctl --user enable rygel.service" on the terminal.
Comment 26 Bastien Nocera 2016-05-26 13:52:16 UTC
(In reply to Jan Alexander Steffens (heftig) from comment #25)
> No, the UI is not busted because start/stop commands from GSD still have the
> effect they're supposed to have. If the user logs into GNOME, GSD can
> control rygel all it wants.
> 
> In fact, I'd consider GSD running "disable" evil as it overrides user
> configuration with its own.
> 
> In either case distributions won't need to patch rygel to work with GNOME,
> as the default state is disabled. But they will have to patch rygel if they
> want "enable" to work.
> 
> Enabling rygel will start it at login because that's what the user commanded
> to happen. Why is this so much of an issue? People who are dependent on the
> GNOME UI don't run "systemctl --user enable rygel.service" on the terminal.

Or they do, and GNOME gets blamed for overriding it, or not overriding it depending on the mood of the reporter.

Do what you want there, and I'll see what I need to do to not make this a pain for me.
Comment 27 Jan Alexander Steffens (heftig) 2016-05-26 13:53:26 UTC
(In reply to Bastien Nocera from comment #20)
> If lingering is enabled, and the user logs out, then there's nothing to
> stop rygel when the network changes. This is a privacy concern.

This is completely independent of the enable status. If lingering is enabled and GSD does not shut down rygel when it exits, rygel will keep running whether it was "enabled" or not.