# saned and xinetd (resolved)

## dshook

This seems to be a persistent problem, but even after reviewing the threads, I'm still having issues.  I'm capable of getting saned to execute manually, but I can't get it to run from xinetd.  I'd appreciate any assistance in diagnosing and resolving this issue.  I've supplied all of the information that I can think of.

```
saned -d128
```

The following shows that the saned user is a member of usb and scanner groups and has permission to the scanner

```

 # su -s /bin/sh saned

sh-3.2$ whoami

saned

sh-3.2$ groups

usb users scanner saned

sh-3.2$ scanimage -L

device `hpaio:/usb/PSC_2100_Series?serial=MY34SF64660F' is a Hewlett-Packard PSC_2100_Series all-in-one

```

Here we've got the sane-daemon file 

```

# cat /etc/xinetd.d/sane-daemon

service sane-port

{

  socket_type = stream

  server = /usr/sbin/saned

  protocol = tcp

  user = saned

  group = usb

  wait = no

  disable = no

}

```

```

# cat /etc/services | grep sane

sane-port       6566/tcp                        # SANE Network Scanner Control Port

sane-port       6566/udp

```

/etc/sane.d/saned.conf

```

localhost

192.168.1.4

192.168.1.2

```

```

SANE_DEBUG_NET=128 scanimage -L

[sanei_debug] Setting debug level of net to 128.

[net] sane_init: authorize = 0x804ae40, version_code = 0xbfa35e58

[net] sane_init: SANE net backend version 1.0.13 (AF-indep) from sane-backends 1.0.18

[net] sane_init: Client has little endian byte order

[net] sane_init: searching for config file

[net] sane_init: trying to add localhost

[net] add_device: adding backend localhost

[net] add_device: backend localhost added

[net] sane_init: done reading config

[net] sane_init: evaluating environment variable SANE_NET_HOSTS

[net] sane_init: done

[net] sane_get_devices: local_only = 0

[net] connect_dev: trying to connect to localhost

[net] connect_dev: [0] connection succeeded (IPv4)

[net] connect_dev: sanei_w_init

[net] connect_dev: net_init (user=root, local version=1.0.3)

[net] connect_dev: argument marshalling error (Connection reset by peer)

[net] connect_dev: closing connection to localhost

[net] sane_get_devices: ignoring failure to connect to localhost

[net] sane_get_devices: finished (0 devices)

device `hpaio:/usb/PSC_2100_Series?serial=MY34SF64660F' is a Hewlett-Packard PSC_2100_Series all-in-one

[net] sane_exit: exiting

[net] sane_exit: closing dev 0x809d4a8, ctl=-1

[net] sane_exit: finished.

```

/var/log/messages

```

Oct 17 19:25:03 Fileserver xinetd[29286]: FAIL: sane-port address from=127.0.0.1

Oct 17 19:25:03 Fileserver xinetd[29277]: START: sane-port pid=29286 from=127.0.0.1

Oct 17 19:25:03 Fileserver xinetd[29277]: EXIT: sane-port status=0 pid=29286 duration=0(sec)

```

```

 # ls -la /usr/sbin/sane*

-rwxr-xr-x 1 root root   104 Oct 17 18:25 /usr/sbin/saned

-rwxr-xr-x 1 root root 41600 Oct  1 06:12 /usr/sbin/saned.bin

```

```

# cat /usr/sbin/saned

#!/bin/sh

SANE_DEBUG_HP=128

export SANE_DEBUG_HP

cd /tmp

exec /usr/sbin/saned.bin 2> saned.$$.stderr

```

The files in /tmp/saned....stderr are all 0-length

```

# cat /proc/bus/usb/devices

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2

B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0

D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=0000 ProdID=0000 Rev= 2.06

S:  Manufacturer=Linux 2.6.22-gentoo-r8 uhci_hcd

S:  Product=UHCI Host Controller

S:  SerialNumber=0000:00:07.2

C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA

I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub

E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1

P:  Vendor=03f0 ProdID=2811 Rev= 1.00

S:  Manufacturer=Hewlett-Packard

S:  Product=PSC 2100 Series

S:  SerialNumber=MY34SF64660F

C:* #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr=  2mA

I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=cc Prot=00 Driver=(none)

E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=10ms

I:* If#= 1 Alt= 0 #EPs= 3 Cls=07(print) Sub=01 Prot=02 Driver=(none)

E:  Ad=03(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

E:  Ad=83(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

E:  Ad=84(I) Atr=03(Int.) MxPS=   8 Ivl=10ms

I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)

E:  Ad=05(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

E:  Ad=85(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

E:  Ad=86(I) Atr=03(Int.) MxPS=   8 Ivl=10ms

```

```

# ls -l /proc/bus/usb/001/

total 0

-rw-rw-r-- 1 root usb  43 Oct  1 03:35 001

-rw-rw-r-- 1 root usb 117 Oct  1 03:35 002

```

```

# cat /etc/make.conf

# These settings were set by the catalyst build script that automatically

# built this stage.

# Please consult /etc/make.conf.example for a more detailed example.

CFLAGS="-O2 -mtune=i686 -pipe"

CXXFLAGS="${CFLAGS}"

# This should not be changed unless you know exactly what you are doing.  You

# should probably be using a different stage, instead.

CHOST="i486-pc-linux-gnu"

USE="fax foomaticdb -ipv6 jpeg png ppds samba scanner tiff usb"

```

```

# uname -a

Linux Fileserver 2.6.22-gentoo-r8 #1 SMP Sat Sep 29 08:20:58 EDT 2007 i686 Pentium III (Katmai) GenuineIntel GNU/Linux

```

```

# emerge --info

Portage 2.1.3.9 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.5-r4, 2.6.22-gentoo-r8 i686)

=================================================================

System uname: 2.6.22-gentoo-r8 i686 Pentium III (Katmai)

Timestamp of tree: Sun, 30 Sep 2007 18:30:01 +0000

app-shells/bash:     3.2_p17

dev-lang/python:     2.4.4-r5

dev-python/pycrypto: 2.0.1-r6

sys-apps/baselayout: 1.12.9-r2

sys-apps/sandbox:    1.2.17

sys-devel/autoconf:  2.61-r1

sys-devel/automake:  1.6.3, 1.9.6-r2, 1.10

sys-devel/binutils:  2.17-r1

sys-devel/gcc-config: 1.3.16

sys-devel/libtool:   1.5.24

virtual/os-headers:  2.6.21

ACCEPT_KEYWORDS="x86"

CBUILD="i486-pc-linux-gnu"

CFLAGS="-O2 -mtune=i686 -pipe"

CHOST="i486-pc-linux-gnu"

CONFIG_PROTECT="/etc /var/bind"

CONFIG_PROTECT_MASK="/etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo"

CXXFLAGS="-O2 -mtune=i686 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="acl berkdb bitmap-fonts cli cracklib crypt cups dri fax foomaticdb fortran gdbm gpm iconv isdnlog jpeg midi mudflap ncurses nls nptl nptlonly openmp pam pcre perl png ppds pppd python readline reflection samba scanner session spl ssl tcpd tiff truetype-fonts type1-fonts unicode usb x86 xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"

Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

```

p.s.

Just as a followup, I see that there may be a fix in hplip-2.7.9, but even after installing that, the result is the same.

----------

## dshook

I removed and reemerged xinetd on a whim and noticed the line that said all services are restricted to localhost.  After modifying the xinetd.conf and commenting out the line that says 

```

only_from = localhost

```

everything seems to work

----------

## Listat

I know that this thread is marked as resolved, but I think I should post here because this it finally showed me the way to solve my problem after I read through it. ( I Think)

I have a HP Printer/Scanner. Having set up sane and xinetd, /var/messages (on the server) kept giving me messages like:

```
io/hpmud/musb.c 140: unable get_string_descriptor -1: Operation not permitted
```

The final part of my problem was to give saned lp permissions

```
gpasswd -a saned lp
```

I guess that this gave Hplip the permissions required to access the device when accessing the device as a scanner as well as a printer.

Shame we can't get Gentoo or Udev to identify the printer/scanner as 2 separate devices, it would have saved me a real headache.

----------

