Bug 1976006 - systemd presets request - pipewire-media-session.service
Summary: systemd presets request - pipewire-media-session.service
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: fedora-release
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Mohan Boddu
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-24 23:59 UTC by Peter Hutterer
Modified: 2021-07-05 07:05 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-07-05 07:05:22 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Peter Hutterer 2021-06-24 23:59:27 UTC
Please enable the user unit pipewire-media-session.service by default.

pipewire-media-session is a session manager for pipewire.

The dependency tree is:
- pipewire.socket (default: enabled, see bug 1592434)
- pipewire.service
- pipewire-media-session

Pipewire currently starts pipewire-media-session through exec, our  goal is to have pipewire-media-session started through a systemd user unit as a dependency of pipewire.service. For that it needs to be enabled by default.

* Does the service require post-rpm-installation configuration in order to be useful (for example, does it need manual edits to a configuration file)?

No

* Does the service listen on a network socket for connections originating on a separate physical or virtual machine?

No

* Is the service non-persistent (i.e. run once at startup and exit)?

It is persistent for the user session

* What is the exact name (or names) of the systemd unit files to be enabled?

pipewire-media-session.service

* Is this request for all Fedora deliverables or only for some Editions (list them)?

It needs to match the pipewire defaults in 90-default-user.preset (unsure which editions apply here but I guess all of them?)

Comment 1 Zbigniew Jędrzejewski-Szmek 2021-06-25 08:00:38 UTC
Hmm, right now pipewire is socket activated lazily. Enabling pipewire-media-session.service
would make this non-lazy.

> our  goal is to have pipewire-media-session started through a systemd user unit as a dependency of pipewire.service.

Why not just add Wants=pipewire-media-session.service (or Requires= if necessary) to pipewire.service?

> For that it needs to be enabled by default.

Not necessarily. Does something else apart from pipewire.service require pipewire-media-session.service to 
be running before pipewire.service is started?

(I can open a pull request to add the preset, but let's clarify the needs first.)

Comment 2 Peter Hutterer 2021-06-26 03:45:54 UTC
FTR, I'm open to any suggestion that lets us handle this, I just thought the preset is the only option.

> Why not just add Wants=pipewire-media-session.service (or Requires= if necessary) to pipewire.service?

The long-term goal is to have the session manager exchangeable. Right now, that's pipewire-media-session.service, long term it's going to be wireplumber.service with the option to swap. All my experiments with WantedBy in the service files required a manual systemctl enable for that service - that's where this request comes from. Maybe this works with an explicit Wants but then we'd have pipewire wanting every possible session manager in the hope that one of them is installed. That doesn't seem right.

Goal for wireplumber and media-session is to Conflicts each other, so only one is installed. I tried with a virtual pipewire-session-manager.service that both provide but that didn't work either.

> Not necessarily. Does something else apart from pipewire.service require pipewire-media-session.service to be running before pipewire.service is started?

It's actually the other way round, pipewire starts first, then pipewire-media-session which connects to said pipewire daemon to manage it. Pipewire can run without a session manager, it's just not very useful.


If you can think of a better way to fix all this, you may just become my favourite person this month :)

Comment 3 Zbigniew Jędrzejewski-Szmek 2021-06-26 08:21:48 UTC
OK, I think we want something similar to how dbus-broker and dbus-daemon are set up:

pipewire-media-session.service has [Install] Alias=pipewire-session-manager.service,
wireplumber.service has the same Alias,
pipewire.service has [Unit] Wants=pipewire-session-manager.service,
and then presets are used to pick either pipewire-media-session.service or wireplumber.service
as the actual implementation.

Comment 4 Zbigniew Jędrzejewski-Szmek 2021-06-26 08:24:44 UTC
https://src.fedoraproject.org/rpms/fedora-release/pull-request/186

Comment 5 Peter Hutterer 2021-07-05 03:47:38 UTC
I can confirm that (locally) this works as you suggested above. I've done this with pipewire-media-session and wireplumber locally (the latter two are virtually identical in changes):

Added to pipewire.service:
[Unit]
Wants=pipewire-session-manager.service

Added to wireplumber.service:
[Install]
Alias=pipewire-session-manager.service

And after the manual systemctl --user enable wireplumber.service, it starts up correctly on restarting pipewire.service.

$ systemctl --user list-dependencies pipewire.service     
pipewire.service
● ├─pipewire.socket
● ├─session.slice
● ├─wireplumber.service
...

$ systemctl --user status pipewire-session-manager.service
● wireplumber.service - Multimedia Service Session Manager
Loaded: loaded (/usr/lib/systemd/user/wireplumber.service; enabled; vendor preset: disabled)
...

As said, the above is also true when wireplumber is swapped for pipewire-media-session.

Comment 6 Zbigniew Jędrzejewski-Szmek 2021-07-05 07:05:22 UTC
Let's do this then. I merged my pull request so we have 'enable pipewire-media-session.service' in presets.
The rest needs to happen in the packages.


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