rtpmidid icon indicating copy to clipboard operation
rtpmidid copied to clipboard

Do not depend on systemctl/systemd exclusively for `debian/postinst` and `debian/prerm`

Open wyatt8740 opened this issue 5 years ago • 3 comments

My Debian system is using sysvinit and elogind. This makes the debian packages fail to install due to their reliance on systemctl to start and stop the software.

Selecting previously unselected package rtpmidid.
(Reading database ... 755593 files and directories currently installed.)
Preparing to unpack rtpmidid_20.07_amd64.deb ...
Unpacking rtpmidid (20.07) ...
Setting up rtpmidid (20.07) ...
Adding user rtpmidid to group audio
/var/lib/dpkg/info/rtpmidid.postinst: 28: systemctl: not found
/var/lib/dpkg/info/rtpmidid.postinst: 29: systemctl: not found
dpkg: error processing package rtpmidid (--install):
 installed rtpmidid package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 rtpmidid

I'd suggest checking that it exists and alerting the user that the program cannot be started automatically without systemd, or else maybe some LSB init scripts.

It looks like maybe you were attempting to do this, but at some point your postinst script got messed up. Line 27 of one of them currently reads: if [ -e /usr.

Alternatively you could make systemd | systemctl a hard dependency, but I'd personally rather you didn't since it's unnecessary. I just got it working on my system by rebuilding the debian package with some tweaks to postinst/prerm and a little setgid/setuid trickery (hopefully safe enough) to make rtpmidid run as the rtpmidid user and create a socket file with correct permissions (rtpmidid:audio ownership, I think).

Something like:

type systemctl
if [ $? -ne 0 ]; then
    # handle systemctl not found
else
    # systemctl commands
fi

Setting up /var/run/rtpmidid and the like would probably be left up to the user on such systems (unless a few more changes are made, anyway), so maybe that would be something to warn people about in the handling section.

wyatt8740 avatar Aug 12 '20 17:08 wyatt8740

I will try to do something for next release, but its low priority.

On the other hand, a merge request is almost guaranteed to be accepted if it solves this problem.

davidmoreno avatar Aug 25 '20 07:08 davidmoreno

OK, I'll try to remember to submit my changes.

wyatt8740 avatar Sep 01 '20 03:09 wyatt8740

This is also problem on WSL2 (Windows Subsystem for Linux) in Windows 10, though it also lacks the /dev/snd/seq kernel driver - quess rtpmidid can't be easily implemented without ALSA sequencer support (instead of sequencer device some other interface or API would be needed).

mhelin avatar Dec 09 '20 21:12 mhelin