On Tue, 28 Jul 2026 21:14:49 +0200 Edmund Lodewijks
<[email protected]> wrote:
> I found this bug under Debian Release Critical Bugs relevant for
testing.
> 
> 
> Modern Linux audio stacks such as PulseAudio and PipeWire are designed
> around per-user audio sessions rather than system-wide sound services.
> As a result, running TiMidity++ as a system-wide daemon (whether via 
> SysV init or a system service) is no longer the recommended approach
and 
> may not work correctly when the audio device is managed by the user's 
> audio session.
> 
> If required, users can start a TiMidity++ daemon manually with:
> 
> $ timidity -iA
> 
> For a more permanent setup, TiMidity++ can be started automatically at
> login using a desktop autostart entry or a systemd --user service.
> 
> This is also the approach taken by other distributions. The OpenSUSE 
> README states:
> 
>    When using pulseaudio the use of timidity as a system wide daemon
is 
> discouraged,
>    because both pulseaudio and timidity need the same device 
> exclusively. However
>    timidity can be started as a daemon for the user to provide the
MIDI 
> ports he/she
>    needs [...]
> 
> and recommends:
> 
>    $ timidity -iAq -Oe -s 44100
> 
> Similarly, the Arch Linux wiki notes:
> 
>    If you are using PulseAudio, that may also cause the service to
fail. 
> You may want to
>    add the following command as an autostart program in your desktop 
> environment.
> 
>    $ timidity -iA
> 
> Given the move towards per-user audio services, I don't believe 
> replacing the existing SysV init script with a system-wide systemd
unit 
> would be an improvement. A systemd --user service would be more 
> appropriate for users who require a persistent TiMidity++ daemon. Such
a 
> service file is, I believe, not commonly provided by Debian.
> 
> I hope this helps!

Yes. That was helpful. I applied the attached two patches to the package
in Ubuntu. They should be useful for Debian as well.

-- 
Benjamin Drung
Debian & Ubuntu Developer
From 9ed1f33a0bf7cb1bd0d87cdefcb291352c3bc447 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <[email protected]>
Date: Thu, 24 Sep 2026 18:51:08 +0200
Subject: [PATCH 1/2] Add timidity systemd user service

Add a timidity systemd user service but do not enable it by default.

Closes: 1039396
LP: #2153928
---
 debian/rules                 | 3 +++
 debian/timidity.user.service | 9 +++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 debian/timidity.user.service

diff --git a/debian/rules b/debian/rules
index d35b686..308fa17 100755
--- a/debian/rules
+++ b/debian/rules
@@ -48,3 +48,6 @@ override_dh_fixperms-arch:
 
 override_dh_installinit:
 	dh_installinit -ptimidity-daemon --name=timidity
+
+override_dh_installsystemduser:
+	dh_installsystemduser --no-enable
diff --git a/debian/timidity.user.service b/debian/timidity.user.service
new file mode 100644
index 0000000..4d6ceea
--- /dev/null
+++ b/debian/timidity.user.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=TiMidity++ Daemon
+After=sound.target
+
+[Service]
+ExecStart=/usr/bin/timidity -iA
+
+[Install]
+WantedBy=multi-user.target
-- 
2.53.0

From 8a354d8c798986b8113548e53d91865a9022b5c9 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <[email protected]>
Date: Thu, 24 Sep 2026 18:55:04 +0200
Subject: [PATCH 2/2] Drop timidity-daemon package and system service

Use the systemd user service instead.
---
 debian/control                          |  22 -----
 debian/rules                            |   3 -
 debian/timidity-daemon.postinst         |  68 ----------------
 debian/timidity-daemon.timidity.default |  22 -----
 debian/timidity-daemon.timidity.init    | 104 ------------------------
 5 files changed, 219 deletions(-)
 delete mode 100644 debian/timidity-daemon.postinst
 delete mode 100644 debian/timidity-daemon.timidity.default
 delete mode 100644 debian/timidity-daemon.timidity.init

diff --git a/debian/control b/debian/control
index b096555..de99294 100644
--- a/debian/control
+++ b/debian/control
@@ -31,7 +31,6 @@ Vcs-Browser: https://salsa.debian.org/debian/timidity
 Package: timidity
 Architecture: any
 Depends:
- lsb-base,
  ${misc:Depends},
  ${shlibs:Depends},
 Recommends:
@@ -40,8 +39,6 @@ Suggests:
  fluid-soundfont-gs,
  freepats,
  pmidi,
- timidity-daemon (>= 2.14.0-1),
-Breaks: timidity-daemon (<< 2.14.0-1~),
 Description: Software sound renderer (MIDI sequencer, MOD player)
  TiMidity++ is a very high quality software-only MIDI sequencer and MOD player.
  It uses sound fonts (GUS-compatible or SF2-compatible) to render MIDI files,
@@ -88,22 +85,3 @@ Description: Emacs front end to Timidity++
  The timidity.el Emacs-Lisp program is a front-end to the TiMidity++ software-
  only MIDI sequencer and MOD player.  You can play MIDI amd MOD files directly
  from Emacs with this package.
-
-Package: timidity-daemon
-Architecture: all
-Depends:
- adduser,
- lsb-base,
- timidity (>= ${source:Version}),
- ${misc:Depends},
-Replaces: timidity (<< 2.14.0-1~)
-Breaks: timidity (<< 2.14.0-1~)
-Description: runs TiMidity++ as a system-wide MIDI sequencer
- TiMidity++ is a very high quality software-only MIDI sequencer and MOD
- player.
- .
- This package is not needed for a desktop install and output by default
- using the ALSA driver.
- .
- This package provides TiMidity++ as a system-wide MIDI sequencer.
-
diff --git a/debian/rules b/debian/rules
index 308fa17..8845188 100755
--- a/debian/rules
+++ b/debian/rules
@@ -46,8 +46,5 @@ override_dh_fixperms-arch:
 	chmod a+x debian/timidity-interfaces-extra/usr/lib/timidity/tk*.tcl
 	dh_fixperms -a
 
-override_dh_installinit:
-	dh_installinit -ptimidity-daemon --name=timidity
-
 override_dh_installsystemduser:
 	dh_installsystemduser --no-enable
diff --git a/debian/timidity-daemon.postinst b/debian/timidity-daemon.postinst
deleted file mode 100644
index 48e725c..0000000
--- a/debian/timidity-daemon.postinst
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-set -e
-
-case "$1" in
-configure)
-
-[ -f "/etc/default/timidity" ] && . /etc/default/timidity
-
-# Sane defaults, needed for when the user has messed with /etc/default/timidity:
-
-[ -z "$SERVER_HOME" ] && SERVER_HOME=/etc/timidity
-[ -z "$SERVER_USER" ] && SERVER_USER=timidity
-[ -z "$SERVER_NAME" ] && SERVER_NAME="TiMidity++ MIDI sequencer service"
-[ -z "$SERVER_GROUP" ] && SERVER_GROUP=timidity
-
-# Groups that the user will be added to, if undefined, then none.
-[ -z "$ADDGROUP" ] && ADDGROUP=audio
-
-# create user to avoid running server as root
-# 1. create group if not existing
-if ! getent group | grep -q "^$SERVER_GROUP:" ; then
-echo -n "Adding group $SERVER_GROUP.."
-addgroup --quiet --system $SERVER_GROUP 2>/dev/null ||true
-echo "..done"
-fi
-# 2. create user if not existing
-if ! getent passwd | grep -q "^$SERVER_USER:"; then
-echo -n "Adding system user $SERVER_USER.."
-adduser --quiet \
-            --system \
-            --ingroup $SERVER_GROUP \
-            --no-create-home \
-            --home $SERVER_HOME \
-            --disabled-password \
-            $SERVER_USER 2>/dev/null || true
-echo "..done"
-fi
-# 3. adjust passwd entry
-usermod -c "$SERVER_NAME" \
-            -d $SERVER_HOME   \
-            -g $SERVER_GROUP  \
-            $SERVER_USER 2> /dev/null || true
-# 4. Add the user to the ADDGROUP group
-if test -n $ADDGROUP
-   then
-   if ! groups $SERVER_USER | cut -d: -f2 | \
-        grep -qw $ADDGROUP; then
-        adduser $SERVER_USER $ADDGROUP
-   fi
-fi
-;;
-esac
-
-rm -f /etc/timidity/timidity.daemon
-
-# make sure we really stop, because packaging system doesn't
-# understand what we're trying to do with migration to timidity-daemon
-[ -f "/etc/init.d/timidity" ] && if which invoke-rc.d >/dev/null 2>&1; then
-  update-rc.d timidity defaults >/dev/null
-  invoke-rc.d timidity stop
-else
-  /etc/init.d/timidity stop
-fi
-
-#DEBHELPER#
-
-exit 0
-
diff --git a/debian/timidity-daemon.timidity.default b/debian/timidity-daemon.timidity.default
deleted file mode 100644
index 0db83c5..0000000
--- a/debian/timidity-daemon.timidity.default
+++ /dev/null
@@ -1,22 +0,0 @@
-# Defaults for TiMidity++ scripts
-# sourced by /etc/init.d/timidity
-# installed at /etc/default/timidity by the maintainer scripts
-# $Id: timidity.default,v 1.3 2004/08/07 14:33:26 hmh Exp $
-
-#
-# This is a POSIX shell fragment
-#
-
-SERVER_HOME=/etc/timidity
-SERVER_USER=timidity
-SERVER_NAME="TiMidity++ MIDI sequencer service"
-SERVER_GROUP=timidity
-ADDGROUP=audio
-
-# Enable MIDI sequencer (ALSA), if timidity-deamon is installed
-
-# uncomment to override enabling triggered by availability of timidity-deamon
-# TIM_ALSASEQ=false
-
-# Setting overrides (of /etc/timidity.conf) for the ALSA sequencer daemon
-TIM_ALSASEQPARAMS="-Os"
diff --git a/debian/timidity-daemon.timidity.init b/debian/timidity-daemon.timidity.init
deleted file mode 100644
index 2acbc45..0000000
--- a/debian/timidity-daemon.timidity.init
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/bin/sh
-#
-# TiMidity      /etc/init.d/ initscript for TiMidity++
-#               $Id: timidity.init,v 1.6 2004/09/30 01:04:04 hmh Exp $
-#
-#               Copyright (c) 2004 by Henrique M. Holschuh <[email protected]>
-#               Copyright (c) 2007-2009 Joost Yervante Damad <[email protected]>
-#
-#               Distributed under the GPL version 2
-#
-
-### BEGIN INIT INFO
-# Provides: timidity
-# Required-Start: $remote_fs
-# Required-Stop: $remote_fs
-# Default-Start:  2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: start and stop timidity
-# Description:  TiMidity++ is a very high quality software-only MIDI sequencer
-#        and MOD player.
-### END INIT INFO
-
-. /lib/lsb/init-functions
-
-NAME="timidity"
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/bin/${NAME}
-DESC="TiMidity++ ALSA midi emulation"
-PIDFILE=/var/run/timidity/${NAME}.pid
-
-set -e
-
-test -x ${DAEMON} || exit 0
-
-TIM_ALSASEQ=true
-TIM_ALSASEQPARAMS="-B2,8"
-[ -r /etc/default/timidity ] && . /etc/default/timidity
-if [ "${TIM_ALSASEQ}" != "true" ]; then
-	log_daemon_msg "Starting" "${NAME}"
-	log_daemon_msg " (to get timidity as an ALSA Sequencer enable this by editing the file /etc/default/timidity)"
-	log_end_msg 0
-	exit 0
-fi
-
-[ -z "$SERVER_USER" ] && SERVER_USER=timidity
-[ -z "$SERVER_GROUP" ] && SERVER_GROUP=timidity
-
-if ! getent passwd | grep -q "^${SERVER_USER}:"; then
-log_daemon_msg "Server user does not exist. Aborting"
-log_end_msg 0
-exit 1
-fi
-if ! getent group | grep -q "^${SERVER_GROUP}:" ; then
-log_daemon_msg "Server group does not exist. Aborting"
-log_end_msg =
-exit 1
-fi
-
-PARAMS="${TIM_ALSASEQPARAMS} -iAD"
-
-
-START="--start --chuid ${SERVER_USER} --quiet --exec ${DAEMON} --pidfile ${PIDFILE} -- ${PARAMS}"
-
-case "$1" in
-  start)
-	#log_daemon_msg "Starting" "${NAME}"
-	[ -d /proc/asound ] && [ -d /dev/snd/ ] || {
-		log_end_msg 1 || echo -n
-		log_warning_msg "ALSA is not active, cannot start $DESC"
-		exit 0
-	}
-	log_daemon_msg "Starting $DESC" "$NAME"
-    mkdir -p /var/run/timidity
-    chown timidity /var/run/timidity
-	if start-stop-daemon ${START} < /dev/null >/dev/null 2>&1; then
-		log_end_msg 0
-	else
-		log_end_msg 1
-		exit 1
-	fi
-	;;
-  stop)
-	log_daemon_msg "Stopping $DESC" "$NAME"
-	if start-stop-daemon --quiet --stop --oknodo --pidfile ${PIDFILE} \
-          --name ${NAME} --retry 10 ; then
-		log_end_msg 0
-	else
-		log_end_msg 1
-		exit 1
-	fi
-	;;
-  restart|force-reload)
-  	$0 stop
-	exec $0 start
-  	;;
-  status)
-	status_of_proc $DAEMON $NAME
-	;;
-  *)
-    echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
-    exit 1
-esac
- 
-exit 0
-- 
2.53.0

Reply via email to