Bug 2098484

Summary: Add systemd user service
Product: [Fedora] Fedora Reporter: Daniel Rusek <drusek>
Component: fluidsynthAssignee: Christoph Karl <pampelmuse>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: green, mail, pampelmuse, walter.pete
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: fluidsynth-2.2.7-2.fc36 fluidsynth-2.2.7-2.fc35 fluidsynth-2.2.7-2.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-02 01:48:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
/usr/lib/systemd/user/fluidsynth.service from the Ubuntu fluidsynth package
none
/etc/default/fluidsynth from the Ubuntu fluidsynth package none

Description Daniel Rusek 2022-06-19 22:16:09 UTC
Created attachment 1891216 [details]
/usr/lib/systemd/user/fluidsynth.service from the Ubuntu fluidsynth package

Please, consider adding a systemd user service for FluidSynth. I am including a systemd service file from the fluidsynth Debian/Ubuntu package.

The included service file will most likely work fine in Fedora as well (the only thing I am not sure about is "EnvironmentFile=/etc/default/fluidsynth" since the Fedora package does not seem to contain this default config file).

Comment 1 Christoph Karl 2022-06-20 18:12:58 UTC
Hmm, interesting idea.
I always used qsynth for starting up fluidsynth and qjack to connecting it.
I will take a look.

Comment 2 Daniel Rusek 2022-06-20 21:04:53 UTC
Thanks! You will probably also need to add "fluid-soundfont-gm" package to the fluidsynth Recommends/Requires to make the fluidsynth daemon work out-of-box after installing the fluidsynth package. :-)

Comment 3 Daniel Rusek 2022-06-26 19:10:43 UTC
I am also including the default /etc/default/fluidsynth file from Ubuntu/Debian.

Comment 4 Daniel Rusek 2022-06-26 19:12:17 UTC
Created attachment 1892816 [details]
/etc/default/fluidsynth from the Ubuntu fluidsynth package

Comment 5 Fedora Update System 2022-06-29 12:25:42 UTC
FEDORA-2022-d98f665b76 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-d98f665b76

Comment 6 Fedora Update System 2022-06-29 12:25:43 UTC
FEDORA-2022-9665396a4a has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-9665396a4a

Comment 7 Fedora Update System 2022-06-29 12:25:43 UTC
FEDORA-EPEL-2022-cb471b2af4 has been submitted as an update to Fedora EPEL 9. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-cb471b2af4

Comment 8 Daniel Rusek 2022-06-29 14:18:05 UTC
The systemd user service does not seem to be enabled by default:

$ systemctl status sound.target
● sound.target - Sound Card
     Loaded: loaded (/usr/lib/systemd/system/sound.target; static)
     Active: active since Wed 2022-06-29 15:12:52 CEST; 17min ago
      Until: Wed 2022-06-29 15:12:52 CEST; 17min ago
       Docs: man:systemd.special(7)

čen 29 15:12:52 desktop systemd[1]: Reached target sound.target - Sound Card.

$ systemctl --user status fluidsynth.service
○ fluidsynth.service - FluidSynth Daemon
     Loaded: loaded (/usr/lib/systemd/user/fluidsynth.service; disabled; vendor preset: disabled)
     Active: inactive (dead)
       Docs: man:fluidsynth(1)

$ ps aux|grep fluidsynth
asciiwo+   13070  0.0  0.0 222184  2236 pts/0    S+   15:37   0:00 grep --color=auto fluidsynth
$ 


It works fine* after starting it manually:

$ systemctl --user start fluidsynth.service
$ systemctl --user status fluidsynth.service
● fluidsynth.service - FluidSynth Daemon
     Loaded: loaded (/usr/lib/systemd/user/fluidsynth.service; disabled; vendor preset: disabled)
     Active: active (running) since Wed 2022-06-29 16:02:27 CEST; 950ms ago
       Docs: man:fluidsynth(1)
   Main PID: 17014 (fluidsynth)
      Tasks: 17 (limit: 38226)
     Memory: 301.3M
        CPU: 184ms
     CGroup: /user.slice/user-1000.slice/user/app.slice/fluidsynth.service
             └─ 17014 /usr/bin/fluidsynth -is /usr/share/soundfonts/default.sf2

čen 29 16:02:27 desktop systemd[2180]: Starting fluidsynth.service - FluidSynth Daemon...
čen 29 16:02:27 desktop systemd[2180]: Started fluidsynth.service - FluidSynth Daemon.
čen 29 16:02:27 desktop fluidsynth[17014]: fluidsynth: warning: Failed to set thread to high priority
čen 29 16:02:27 desktop fluidsynth[17014]: fluidsynth: warning: Failed to set thread to high priority

* I have tried some applications that use MIDI synth and everything was working properly.

Comment 9 Daniel Rusek 2022-06-29 14:28:46 UTC
The systemd service seems to work only when running "systemctl --user start fluidsynth.service" manually. It does not seem to work when started automatically during system boot/login after enabling it using "systemctl --user enable fluidsynth.service":

systemctl --user status fluidsynth.service
● fluidsynth.service - FluidSynth Daemon
     Loaded: loaded (/usr/lib/systemd/user/fluidsynth.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2022-06-29 16:24:03 CEST; 42s ago
       Docs: man:fluidsynth(1)
   Main PID: 2258 (fluidsynth)
      Tasks: 16 (limit: 38226)
     Memory: 303.0M
        CPU: 868ms
     CGroup: /user.slice/user-1000.slice/user/app.slice/fluidsynth.service
             └─ 2258 /usr/bin/fluidsynth -is /usr/share/soundfonts/default.sf2

čen 29 16:24:03 desktop systemd[2239]: Starting fluidsynth.service - FluidSynth Daemon...
čen 29 16:24:03 desktop fluidsynth[2258]: ALSA lib seq_hw.c:466:(snd_seq_hw_open) open /dev/snd/seq failed: Permission denied
čen 29 16:24:03 desktop fluidsynth[2258]: fluidsynth: error: Error opening ALSA sequencer
čen 29 16:24:03 desktop fluidsynth[2258]: Failed to create the MIDI thread; no MIDI input
čen 29 16:24:03 desktop fluidsynth[2258]: will be available. You can access the synthesizer
čen 29 16:24:03 desktop fluidsynth[2258]: through the console.
čen 29 16:24:03 desktop systemd[2239]: Started fluidsynth.service - FluidSynth Daemon.
čen 29 16:24:03 desktop fluidsynth[2258]: fluidsynth: warning: Failed to set thread to high priority

Comment 10 Daniel Rusek 2022-06-29 14:30:44 UTC
This may be a PipeWire/WirePlumber issue.

Comment 11 Daniel Rusek 2022-06-29 14:32:55 UTC
We could probably workaround it by setting a delay (something like "ExecStartPre=/bin/sleep 15" in the systemd service file) before starting the service.

Comment 12 Daniel Rusek 2022-06-29 14:36:29 UTC
Or maybe rather "ExecStartPre=/usr/bin/sleep 15" since we are on Fedora. :-)

Comment 13 Daniel Rusek 2022-06-29 14:40:19 UTC
Oops, I am dumb. I did not notice the "Type=notify" service type. Anyway, none of the MIDI apps I tried sent a correct notification message that could start the systemd service and I had to start it manually.

Comment 14 Daniel Rusek 2022-06-29 14:42:59 UTC
Anyway, I am taking everything that I said back. The update seems to work fine and the problems I described are application (or PipeWire/WirePlumber) problems, not Fluidsynth/this update ones.

Comment 15 Fedora Update System 2022-06-30 01:25:00 UTC
FEDORA-2022-d98f665b76 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-d98f665b76`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-d98f665b76

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2022-06-30 01:33:23 UTC
FEDORA-2022-9665396a4a has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-9665396a4a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-9665396a4a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 17 Fedora Update System 2022-06-30 02:10:06 UTC
FEDORA-EPEL-2022-cb471b2af4 has been pushed to the Fedora EPEL 9 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-cb471b2af4

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 18 Fedora Update System 2022-07-02 01:48:04 UTC
FEDORA-2022-9665396a4a has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 19 Fedora Update System 2022-07-08 01:36:48 UTC
FEDORA-2022-d98f665b76 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 20 Fedora Update System 2022-07-08 01:44:23 UTC
FEDORA-EPEL-2022-cb471b2af4 has been pushed to the Fedora EPEL 9 stable repository.
If problem still persists, please make note of it in this bug report.