Skip to main content
Topic: sane-openrc fails with runlevel "default" + results in a failure loop. (Read 1345 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

sane-openrc fails with runlevel "default" + results in a failure loop.

Hello, I would like to report an issue with an openrc service for sane.

I have installed the sane-openrc package and followed the given post-install instructions:

Code: [Select]
	==> Add a service to runlevel:
rc-update add <service> <runlevel>
==> Start/stop/restart a service:
rc-service <service> <start/stop/restart>

I have uncommented the following in /etc/sane.d/sane.conf before adding/starting the service as recommended by the Arch and Gentoo Wikis respectively:

Code: [Select]
#scan-client.somedomain.firm
#192.168.0.1
192.168.0.1/29
#[2001:db8:185e::42:12]
#[2001:db8:185e::42:12]/64

When starting the service it fails shortly thereafter. Attempting to reboot while the service is added to its default run level results in a failure spamming the tty with the following messages:

Code: [Select]
saned (AF-indep+IPv6) from sane-backends 1.4.0 starting up
check_host: getpeername failed: Socket operation on non-socket
init: access by host [error] denied
saned exiting

Hitting 'Control' and 'C' lets me break the loop and return to ly (display manager), I'm sure the intended result of a failed service isn't to bombard the tty with error outputs, but just fail and exit. I have no use for IPv6 and am confused as to why it's even pointing to IPv6, if that has anything at all to do with the service failing.

Re: sane-openrc fails with runlevel "default" + results in a failure loop.

Reply #1
Update: I've checked all of the available service scripts for saned...

Code: (sane-dinit) [Select]
type            = process
command         = /usr/bin/saned -e
smooth-recovery = true
logfile         = /var/log/dinit/saned.log
depends-on      = local.target
before          = login.target

Code: (sane-openrc) [Select]
#!/usr/bin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

supervisor="supervise-daemon"
pidfile="/run/saned.pid"
command="/usr/bin/saned"
# command_args="-a ${SANED_USER:-root}"
command_args="${SANED_USER:-root}"

start_pre() {
    checkpath -d -o ${SANED_USER:-root} ${pidfile%/*}
}

Code: (sane-runit) [Select]
#!/bin/sh
exec saned -l

Code: (sane-s6) [Select]
#!/bin/execlineb -P
fdmove -c 2 1
exec /usr/bin/saned -e

Every other version of the sane-init pass either the "-e" (redirect to stderr) or "-l" (listen) argument, so I've changed the default provided argument from "-a" to "-e -l" and that seemed to stop the service from failing outright. For some reason sane-openrc doesn't work if I don't use both of those arguments at once. I admit I don't have the equipment to see if this was an actual success beyond just the service running successfully. I don't know if the same problems mentioned in the OP are also present for the Dinit, Runit, and S6 versions either.

Code: (/etc/init.d/saned, edited) [Select]
#!/usr/bin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

supervisor="supervise-daemon"
pidfile="/run/saned.pid"
command="/usr/bin/saned"
command_args="-e -l ${SANED_USER:-root}"

start_pre() {
    checkpath -d -o ${SANED_USER:-root} ${pidfile%/*}
}

I could be having a dumbass moment and running the service insecurely this way, I need an expert opinion.