[sane-devel] Running sane din docker

Olaf Meeuwissen paddy-hack at member.fsf.org
Sun Jul 30 04:31:22 UTC 2017


Hi Jan,

Jan De Luyck writes:

> Ah. I'm running saned in a container, which runs on the host which has
> the usb scanner plugged in. I want to share that scanner over the
> network to other machines.

# For folks more familiar with VMs, it's like making the USB devices
# from the host OS visible to the guest OS and then use saned from the
# guest OS to expose a host OS connected USB scanner.

Can I have a look at your Dockerfile?  What docker command-line
invocation (or what docker-compose.yml) do you use?

Can you scan via the USB interface from within the container as well as
from outside of the container?  If that works, the problem is with the
networking part.

Can you scan via saned from *within* the container?  Obviously, from
outside the container doesn't work otherwise you wouldn't have asked
here ;-)

> The scanner is a HP PSC 1200, supported through hpaio (and works great).
>
> Hpaio backend is version 3.16.11.
> Sane is version 1.0.25
>> >
>> > I'm currently trying to get Sane to run inside a docker container.
>> > Reasons being that I can't modify the OS of the underlying machine, but
>> > I can play with docker containers.
>> >
>> > By sharing the /dev/bus/usb filesystem to the container, and mapping the
>> > necessary ports, I've gotten it to run (using runit to keep the services
>> > up and running). The scanner is detected, and I can start a remote scan
>> > - unfortunately it never completes, it fails shortly in the scan with a
>> > SIGPIPE error, and the client app (being scanimage or xsane) bombs out.
>> >
>> > The docker container is based on Debian Stable, I have dbus running
>> > inside it and ahavi is available.

IIUC, you shouldn't need either.  Not for a USB scanner exposed via
saned.

>> > Running scanimage -T returns:
>> > $ scanimage -T
>> > scanimage: scanning image of size 638x877 pixels at 24 bits/pixel
>> > scanimage: acquiring RGB frame, 8 bits/sample
>> > scanimage: reading one scanline, 1914 bytes...  FAIL No data

No data?  Right from the start ...

>> > [...]
>> > scanimage: stepped read, 3 bytes...     FAIL No data
>> > scanimage: received signal 13
>> > scanimage: trying to stop scanner
>> > Segmentation fault
>> >
>> > The last messages I get from saned -d128 are:
>> >
>> > [saned] do_scan: trying to write 8192 bytes to client
>> > [saned] quit: received signal 13

Given that you get No data from the start, there may be something more
interesting earlier in the log.

>> > Stracing saned gave me:
>> > 960  write(2, "[saned] ", 8)           = 8
>> > 1960  write(2, "do_scan: trying to read 8188 bytes from scanner\n", 48)
>> > = 48
>> > 1960  write(2, "[saned] ", 8)           = 8
>> > 1960  write(2, "do_scan: read 8188 bytes from scanner\n", 38) = 38
>> > 1960  select(135, [4], [134], NULL, {tv_sec=0, tv_usec=0}) = 1 (out
>> > [134], left {tv_sec=0, tv_usec=0})
>> > 1960  write(2, "[saned] ", 8)           = 8
>> > 1960  write(2, "do_scan: trying to write 8192 bytes to client\n", 46) =
>> > 46
>> > 1960  write(2, "do_scan: trying to read 8188 bytes from scanner\n", 48)
>> > = 48
>> > 1960  write(2, "[saned] ", 8)           = 8
>> > 1960  write(2, "do_scan: read 8188 bytes from scanner\n", 38) = 38
>> > 1960  select(135, [4], [134], NULL, {tv_sec=0, tv_usec=0}) = 1 (out
>> > [134], left {tv_sec=0, tv_usec=0})
>> > 1960  write(2, "[saned] ", 8)           = 8
>> > 1960  write(2, "do_scan: trying to write 8192 bytes to client\n", 46) =
>> > 46
>> > 1960  select(135, [4], [134], NULL, {tv_sec=0, tv_usec=0}) = 1 (out
>> > [134], left {tv_sec=0, tv_usec=0})
>> > 1960  write(2, "[saned] ", 8)           = 8
>> > 1960  write(2, "do_scan: trying to write 8192 bytes to client\n", 46) =
>> > 46
>> > 1960  write(134,
>> > "\0\0\37\374\372\370\373\372\370\374\373\371\374\373\371\374\373\371\374\373\371\374\373\371\371\370\3
>> > 66\372\371\367\372\371\367\373\372\370\373\372\370\372\371\367\372\371\367\371\370\366\372\372\370\372\372\370\372\372\
>> > 370\372\372\370\372\372\370\372\372\370\372\372\370\372\372\370\372\372\370\372\372\370\372\372\370\372\372\370\372\372
>> > "..., 8192) = -1 EPIPE (Broken pipe)
>> > 1960  --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=1960,
>> > si_uid=0} ---
>> > 1960  write(2, "[saned] ", 8)           = 8
>> > 1960  write(2, "quit: received signal 13\n", 25) = 25
>> >
>> > Does anyone here have any idea how I could figure out what's going wrong
>> > here? The first 8192 bytes of data get send, the second always fails.
>> >
>> > Thanks in advance for any answers,

Hope this helps,
--
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Software                        https://my.fsf.org/donate
 Join the Free Software Foundation              https://my.fsf.org/join



More information about the sane-devel mailing list