You are not logged in.

#1 2016-12-21 21:51:32

forshark
Member
Registered: 2013-01-03
Posts: 41

[SOLVED] sane, uaccess, udev, and zfs a fractal of despair

Hello from the edge,

For home use (aka experimentation), I am trying to setup a systemd-nspawn container for SANE (Scanner Access Now Easy). However, despite catchy pros, I am in a full out battle for scanner sanity. I can only only see the scanner as ROOT! To add chaos to your confusion, I am not even running sane in the systemd-nspawn container. I have escalated it to the host! Here's the juicy tidbits:

The Scanner:

Bus 002 Device 003: ID 03f0:1705 Hewlett-Packard ScanJet 5590

The Udev's:

# /usr/lib/udev/rules.d/49-sane.rules (relevant line):
# Hewlett-Packard ScanJet 5590
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1705", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"
# /usr/lib/udev/rules.d/70-uaccess.rules (relevant line):
# SCSI and USB scanners
ENV{libsane_matched}=="yes", TAG+="uaccess"

The ZFS:

what I did:
zfs set acltype=posixacl zroot/ROOT/default

NAME                          USED   AVAIL   REFER  MOUNTPOINT
zroot                             2.83G   447G    96K               /zroot
zroot/ROOT                  1.50G   447G    96K              none
zroot/ROOT/default      1.50G   447G    1.32G           /
zroot/home                   1.44M   447G    1.34M           /home
zroot/jails                      1.32G   447G    96K              none
zroot/jails/scanner        175M    447G    555M           /var/lib/machines/scanner

What I get:

> scanimage -L
No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).

{dafuk}
> sudo scanimage -L
[sudo] password for idiot: password123
device `hp5590:libusb:002:003' is a HP 5590 Workgroup scanner

{hmmm}
ls -lha /dev/bus/usb/002/003
crw-rw-r-- 1 root scanner 189, 130 Dec 21 15:42 /dev/bus/usb/002/003
{Grrrrr...}
 

Well, Grrrr.. means I have no idea whats going on. By the way, my rootfs is ZFS. I would appreciate any input, wisdom, magical spells, sane comments, and insane comments.

Happy Saturnalia,
Forshark

Last edited by forshark (2016-12-22 21:42:36)

Offline

#2 2016-12-21 22:45:28

forshark
Member
Registered: 2013-01-03
Posts: 41

Re: [SOLVED] sane, uaccess, udev, and zfs a fractal of despair

Hello's,

Additional madness:

> sane-find-scanner

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.
  # Also you need support for SCSI Generic (sg) in your operating system.
  # If using Linux, try "modprobe sg".

could not open USB device 0x03f0/0x1705 at 002:003: Access denied (insufficient permissions)
could not open USB device 0x067b/0x2305 at 002:004: Access denied (insufficient permissions)
could not open USB device 0x1a40/0x0101 at 002:002: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0002 at 002:001: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0001 at 008:001: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0001 at 007:001: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0001 at 006:001: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0002 at 009:001: Access denied (insufficient permissions)
could not open USB device 0x8564/0x1000 at 010:002: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0003 at 010:001: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0002 at 001:001: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0001 at 005:001: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0001 at 004:001: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0001 at 003:001: Access denied (insufficient permissions)
  # No USB scanners found. If you expected something different, make sure that
  # you have loaded a kernel driver for your USB host controller and have setup
  # the USB system correctly. See man sane-usb for details.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.

  # You may want to run this program as root to find all devices. Once you
  # found the scanner devices, be sure to adjust access permissions as
  # necessary.

Saturnalia's Madness:

> sudo sane-find-scanner
[sudo] password for idiot: password123 

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.
  # Also you need support for SCSI Generic (sg) in your operating system.
  # If using Linux, try "modprobe sg".

found USB scanner (vendor=0x03f0 [Hewlett-Packard], product=0x1705 [hp scanjet scanner]) at libusb:002:003
could not fetch string descriptor: Pipe error
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.

Last edited by forshark (2016-12-21 22:46:04)

Offline

#3 2016-12-22 13:48:19

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED] sane, uaccess, udev, and zfs a fractal of despair

I doubt using ZFS has impact on SANE.

The HP scanjet 5590 should not need custom udev or uaccess rule .

I'd also advise to make sure the scanner is recognized correctly and works as normal user before trying to run it in a container.

As for "scanimage -L"  needing root permissions to find the scanner, that is rather common .

After "scanimage -L" finds the scanner, try scanning in something to verify it works for normal user.
https://wiki.archlinux.org/index.php/SANE#Verification has details.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2016-12-22 16:24:18

forshark
Member
Registered: 2013-01-03
Posts: 41

Re: [SOLVED] sane, uaccess, udev, and zfs a fractal of despair

Good Morning,

This is definitely a permissions problem.

> scanimage --format=png > test.png
scanimage: no SANE devices found
> sudo scanimage --format=png > test.png
[sudo] password for idiot: password123
... The sound of a scanner obeying its master.

Additionally, all commands in my posts have been run on the host. I switched to the host after producing the same behavior inside the container.

I remember back in the dark ages I would simply add my user to the scanner group.  Then, say abra cadabra and my scanner simply worked. My end goal is to run a container as a network scanner server.

> sudo gpasswd -a idiot scanner
[sudo] password for idiot: password123 

Abra Cadabra ... Nowww Obeyyy Yourr Masterr...

> scanimage -L
device `hp5590:libusb:002:003' is a HP 5590 Workgroup scanner
> scanimage --format=png > test.png
... The sound of a scanner obeying its master.
systemctl start saned.socket

relevant files for the network scanner portion:

# /etc/sane.d/saned.conf (On scanner host)
# required
localhost
# allow local subnet
192.168.2.0/24
# /etc/sane.d/saned.conf (On computer on same subnet)
# hostname of the scanner
idiotsbox

command run on other computer on same subnet as the server.

> scanimage --format=png > test.png
scanimage: no SANE devices found

And I'm back where I started.

Thanks,
Forshark

Last edited by forshark (2016-12-22 16:25:42)

Offline

#5 2016-12-22 21:40:02

forshark
Member
Registered: 2013-01-03
Posts: 41

Re: [SOLVED] sane, uaccess, udev, and zfs a fractal of despair

Good Afternoon,

While scouring the internets in deep meditations, I was transported into a state of enlightenment and great wisdom came to me in regards to SANE. I came to believe that Arch Linux does not want me to use my scanner, but it wants others to use my scanner.

From within my systemd-nspawn container:

> scanimage -L

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).

Now transporting myself to another computer on the subnet:

# /etc/sane.d/net.conf
scanner.lan
heathen > scanimage -L
device `net:scanner:hp5590:libusb:002:003' is a HP 5590 Workgroup scanner
heathen > scanimage --format=png > test.png
... The sound of a scanner obeying someone other than its master.

However, This reaches my goal of having a scanner server container using systemd-nspawn. If you cannot access your scanner as a regular user, take some wisdom from the dark ages of arch and add your user to the scanner group with:

gpasswd -a $user scanner

However, you may be persecuted if the arch wiki learns of your treachery. I declare this problem solved.

Regards,
Forshark

Offline

Board footer

Powered by FluxBB