Subject: Re: [devuan-dev] bug#921: sane-utils: init script prompts for file removal when status is queried by nonroot user

From: Andrew Bower <[email-masked]>
Date: Sun, 2 Nov 2025 00:12:17 +0000

Hi Alexander,

Some comments as an observer.

On Fri, Oct 31, 2025 at 06:01:42PM +0100, Alexander Rehbein wrote:
> when running the command '/usr/sbin/service --status-all' as nonroot,
> the script hangs inside '/etc/init.d/saned' until I press 'Enter'.
> Same for '/usr/sbin/service saned status'.
> 
> I would expect the command to just finish outputting all statuses.
> 
> It's an easy fix, just add the '-f' flag to the 'rm' command.
> 
> I did this and now both commands run through for nonroot without waiting for input.

I don't like the idea that a status check is destructive but I can see
why the initscript author did that, to clean up inconsistent state. In
that light, I agree your workaround is an improvement.

The root cause of this issue seems to be that saned does not remove
its pidfile. It would be nice to get that fixed upstream.

But we can also improve the issue in the initscript like so:

--- debian/sane-utils.saned.init	2025-11-01 23:30:39.852645419 +0000
+++ /etc/init.d/saned	2025-11-01 23:20:42.507591180 +0000
@@ -47,6 +47,7 @@
   stop)
 	log_daemon_msg "Stopping $DESC" "$NAME"
 	start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/$NAME.pid \
+		--remove-pidfile \
 		--retry 10 --exec $DAEMON
 	log_end_msg $?
 	;;

The init-d-script(5) interpreter actually deletes the pid file
unconditionally so an even better way might be to swap out the entire
initscript with a simpler one using init-d-script.

Out of interest, do you use the saned server?

I suspect most users of this package don't and I was already considering
proposing that the initscript is disabled by default, which would match
the systemd behaviour, which personally I think is the right thing to do
although might not be the majority view in Devuan:

diff --git a/debian/rules b/debian/rules
index 1b0243f..d0ecb43 100755
--- a/debian/rules
+++ b/debian/rules
@@ -148,7 +148,7 @@ ifeq (linux,$(DEB_HOST_ARCH_OS))
 endif
 
 override_dh_installinit-arch:
-       dh_installinit -psane-utils --name=saned
+       dh_installinit -psane-utils --no-enable --name=saned
 
 override_dh_installsystemd-arch:
        dh_installsystemd -psane-utils --no-enable --name=saned

-- 
Andrew