0

After creating the timidity.service file and the related symlink to start the service automatically at system reboot, I rebooted the system and gave the following input:

sudo systemctl status timidity

Output:

× timidity.service - TiMidity++ Daemon
     Loaded: loaded (/lib/systemd/system/timidity.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2024-10-07 16:34:46 CEST; 50s ago
    Process: 635 ExecStart=/usr/bin/timidity -iA Os (code=exited, status=1/FAILURE)
   Main PID: 635 (code=exited, status=1/FAILURE)
        CPU: 31ms

ott 07 16:34:46 netcom-Vostro-15-3510 systemd[1]: Started TiMidity++ Daemon. ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: jack_client_new: deprecated ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: Cannot connect to server socket err = No such file or directory ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: Cannot connect to server request channel ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: jack server is not running or cannot be started ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock ott 07 16:34:47 netcom-Vostro-15-3510 timidity[635]: Couldn't open output device ott 07 16:34:46 netcom-Vostro-15-3510 systemd[1]: timidity.service: Main process exited, code=exited, status=1/FAILURE ott 07 16:34:46 netcom-Vostro-15-3510 systemd[1]: timidity.service: Failed with result 'exit-code'.

My username is associated with the audio group.

Symlink:

/usr/lib/systemd/system/multi-user.target.wants/timidity.service

Service:

/usr/lib/systemd/system/timidity.service

Contains:

[Unit]
Description=TiMidity++ Daemon
After=sound.target
Requires=sound.target

[Service] ExecStart=/usr/bin/timidity -iA Os Type=simple

[Install] WantedBy=multi-user.target

I also tried changing the "timidity.service" file to the following:

[Unit]
Description=TiMidity++ Daemon
After=pulseaudio.service
Requires=pulseaudio.service

[Service] ExecStart=/usr/bin/timidity -iA Os Type=simple

[Install] WantedBy=multi-user.target

But after rebooting the system again, the error is the same.

Trying to start the service manually from the terminal with the system already started, the service starts correctly.

What am I doing wrong?

1 Answers1

0

The solution is as follows:

Service:

/usr/lib/systemd/system/timidity.service

Contains:

[Unit]
Description=TiMidity++ Daemon

[Service] ExecStart=/usr/bin/timidity -iA Os

[Install] WantedBy=sound.target

Start the service automatically on system reboot:

sudo systemctl enable timidity

Which creates the Symlink:

/etc/systemd/system/sound.target.wants/timidity.service

To make the automatic service startup not disableable via the command sudo systemctl disable timidity, then run this command instead of the one above:

ln -sf ../timidity.service /usr/lib/systemd/system/sound.target.wants/timidity.service

Which creates the Symlink:

/usr/lib/systemd/system/sound.target.wants/timidity.service

The folder sound.target.wants already exists inside the path just mentioned.

This solution is multi-user and a user does not need to be part of the audio group.

This solution works in 100% of system reboots.