Package: ipp-usb
Version: 0.9.23-2+b7
Severity: normal

Since ipp-usb ships only systemd-based startup, its daemon doesn't
start up on systems using sysvinit. Consequently, IPP-over-USB
printers aren't functional until a user runs it manually.


The only startup paths shipped are:
1)
  /usr/lib/systemd/system/ipp-usb.service

2)
  /usr/lib/udev/rules.d/71-ipp-usb.rules
      ... TAG+="systemd", ENV{SYSTEMD_WANTS}+="ipp-usb.service"

If systemd is not present, the activation directives are inert.
It still applies GROUP and MODE which is useful but nothing starts the
daemon, preventing the desired functionality.

Package installs fine, and the binary can otherwise be run manually.

Reproduce:

1. Install ipp-usb on a system without systemd.

2. Attach an IPP-over-USB printer.

3. `sudo /usr/sbin/lpinfo -v` shows no ipp:// device, only a usb:// device.

4. Run `sudo /usr/sbin/ipp-usb` manually.

5. `sudo /usr/sbin/lpinfo -v` now shows the printer and printing
functions fully.

Discovered on system specs:
Distro: Devuan Excalibur 6.1.1 amd64
Init System: sysvinit
IPP-over-USB Printer: Canon TS6300

Debian supports sysvinit-core as an init system and ships this package
directly, meaning the failure is not specific to or inherited from
Devuan's distribution.

Most modern printers use IPP Everywhere when no PPD-based driver is available.

Parallel to #1071079 because udev is the only activation path, if the
system environment doesn't match udev's assumptions it will fail to
startup.

Here is a working init script, tested on my Devuan Excalibur sysvinit system.
It starts correctly, the printer appears in the `sudo /usr/sbin/lpinfo
-v` output, survives reboots, and prints properly:
------------------------------------------------------------------
#!/bin/sh
### BEGIN INIT INFO
# Provides:          ipp-usb
# Required-Start:    $local_fs $remote_fs $syslog cups
# Required-Stop:     $local_fs $remote_fs $syslog
# Should-Start:      avahi-daemon
# Should-Stop:       avahi-daemon
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: IPP over USB printer support
# Description:       Presents IPP-over-USB printers as local network
#                    IPP devices so CUPS can use them driverlessly.
### END INIT INFO

DAEMON=/usr/sbin/ipp-usb
NAME=ipp-usb
PIDFILE=/run/$NAME.pid

[ -x "$DAEMON" ] || exit 0

case "$1" in
  start)
    printf 'Starting %s: ' "$NAME"
    start-stop-daemon --start --quiet --background \
      --make-pidfile --pidfile "$PIDFILE" \
      --exec "$DAEMON"
    printf 'done\n'
    ;;
  stop)
    printf 'Stopping %s: ' "$NAME"
    start-stop-daemon --stop --quiet --retry 5 \
      --pidfile "$PIDFILE"
    rm -f "$PIDFILE"
    printf 'done\n'
    ;;
  restart)
    "$0" stop
    sleep 1
    "$0" start
    ;;
  status)
    if start-stop-daemon --status --pidfile "$PIDFILE"; then
      printf '%s is running\n' "$NAME"
    else
      printf '%s is not running\n' "$NAME"
      exit 3
    fi
    ;;
  *)
    printf 'Usage: %s {start|stop|restart|status}\n' "$0" >&2
    exit 1
    ;;
esac

exit 0
------------------------------------------------------------------

This script calls the daemon with no arguments instead of with the
`udev` argument as the systemd script needs.
The `udev` argument exits when the last IPP-over-USB device is
disconnected, this is only desired if something relaunches it on the
next connection.
This reactivation doesn't occur on sysvinit systems, it needs to be
handled by an auxiliary script.
This means the daemon just runs from boot until shutdown. The desired
printer functionality works but deactivating and reactivating the
daemon based on connection status will require an extra patch, which I
am happy to prepare if you would find it useful.
It just requires replacing the systemd directives in the udev rule with RUN+=
directives that detach to prevent automatic termination as a
long-running child of udev.

Reply via email to