Syntax error when installing Epson Linux scanner driver (for v550)

I have an Epson v550 scanner, and have downloaded the latest official driver file.

http://support.epson.net/linux/en/iscan.php?model=perfection-v550&version=2.30.4

When I extract the file, and try to install the iscan-data package, I get the following error:

sudo dpkg -i iscan-data_1.39.1-2_all.deb 
[sudo] password for brylie: 
(Reading database ... 342144 files and directories currently installed.)
Preparing to unpack iscan-data_1.39.1-2_all.deb ...
Unpacking iscan-data (1.39.1-2) over (1.39.1-2) ...
Setting up iscan-data (1.39.1-2) ...
expr: syntax error: missing argument after ‘-’
tail: invalid number of lines: ‘/lib/udev/rules.d/60-libsane.rules’

Note: I get the same error when running ./install.sh, it is just related to the iscan-data package.

How can I fix the syntax error that is causing the .deb installation to break?

Edit:

$ dpkg -S /lib/udev/rules.d/60-libsane.rules
libsane:i386, libsane:amd64: /lib/udev/rules.d/60-libsane.rules
$ cat /lib/udev/rules.d/60-libsane.rules
# This file was automatically created based on description files (*.desc)
# by sane-desc 3.5 from sane-backends 1.0.27
#
# udev rules file for supported USB and SCSI devices
#
# For the list of supported USB devices see /usr/lib/udev/hwdb.d/20-sane.hwdb
#
# The SCSI device support is very basic and includes only
# scanners that mark themselves as type "scanner" or
# SCSI-scanners from HP and other vendors that are entitled "processor"
# but are treated accordingly.
#
# If your SCSI scanner isn't listed below, you can add it to a new rules
# file under /etc/udev/rules.d/.
#
# If your scanner is supported by some external backend (brother, epkowa,
# hpaio, etc) please ask the author of the backend to provide proper
# device detection support for your OS
#
# If the scanner is supported by sane-backends, please mail the entry to
# the sane-devel mailing list ([email protected]).
#
ACTION!="add", GOTO="libsane_rules_end"

# The following rule will disable USB autosuspend for the device
ENV{DEVTYPE}=="usb_device", ENV{libsane_matched}=="yes", TEST=="power/control", ATTR{power/control}="on"

SUBSYSTEMS=="scsi", GOTO="libsane_scsi_rules_begin"
GOTO="libsane_rules_end"

LABEL="libsane_scsi_rules_begin"
KERNEL!="sg[0-9]*", GOTO="libsane_rules_end"

# Generic: SCSI device type 6 indicates a scanner
ATTRS{type}=="6", ENV{libsane_matched}="yes"

# Some scanners advertise themselves as SCSI device type 3

# Wildcard: for some Epson SCSI scanners
ATTRS{type}=="3", ATTRS{vendor}=="EPSON", ATTRS{model}=="SCANNER*", ENV{libsane_matched}="yes"

# Epson Expression 800 | Epson Expression 800
ATTRS{type}=="3", ATTRS{vendor}=="EPSON", ATTRS{model}=="Expression800", ENV{libsane_matched}="yes"

# Epson Perfection 2450 | Epson GT-9700F | Epson Perfection 2450 PHOTO
ATTRS{type}=="3", ATTRS{vendor}=="EPSON", ATTRS{model}=="GT-9700", ENV{libsane_matched}="yes"

# Epson Perfection 3200 | Epson GT-9800F | Epson Perfection 3200 PHOTO
ATTRS{type}=="3", ATTRS{vendor}=="EPSON", ATTRS{model}=="GT-9800", ENV{libsane_matched}="yes"

# Epson GT-X900 | Epson Perfection V700 Photo | Epson Perfection V750 Photo
ATTRS{type}=="3", ATTRS{vendor}=="EPSON", ATTRS{model}=="GT-X900", ENV{libsane_matched}="yes"

# Epson Perfection 636S | Epson Perfection 1200S | Epson Perfection 1200S
ATTRS{type}=="3", ATTRS{vendor}=="EPSON", ATTRS{model}=="Perfection1200", ENV{libsane_matched}="yes"

# Epson Perfection 636 | Epson Perfection 636S
ATTRS{type}=="3", ATTRS{vendor}=="EPSON", ATTRS{model}=="Perfection636", ENV{libsane_matched}="yes"

# Hewlett-Packard ScanJet 4p
ATTRS{type}=="3", ATTRS{vendor}=="HP", ATTRS{model}=="C1130A", ENV{libsane_matched}="yes"

# Hewlett-Packard ScanJet IIc
ATTRS{type}=="3", ATTRS{vendor}=="HP", ATTRS{model}=="C1750A", ENV{libsane_matched}="yes"

# Hewlett-Packard ScanJet IIp
ATTRS{type}=="3", ATTRS{vendor}=="HP", ATTRS{model}=="C1790A", ENV{libsane_matched}="yes"

# Hewlett-Packard ScanJet IIcx
ATTRS{type}=="3", ATTRS{vendor}=="HP", ATTRS{model}=="C2500A", ENV{libsane_matched}="yes"

# Hewlett-Packard ScanJet 4c
ATTRS{type}=="3", ATTRS{vendor}=="HP", ATTRS{model}=="C2520A", ENV{libsane_matched}="yes"

# Hewlett-Packard ScanJet 5p
ATTRS{type}=="3", ATTRS{vendor}=="HP", ATTRS{model}=="C5110A", ENV{libsane_matched}="yes"

# Hewlett-Packard ScanJet 6200C
ATTRS{type}=="3", ATTRS{vendor}=="HP", ATTRS{model}=="C6270A", ENV{libsane_matched}="yes"

# Hewlett-Packard ScanJet 6300C
ATTRS{type}=="3", ATTRS{vendor}=="HP", ATTRS{model}=="C7670A", ENV{libsane_matched}="yes"


LABEL="libsane_rules_end"

Solution 1:

I'm using Debian 10 (Buster), and I've found the same problem. The origin of that error is in the file /usr/lib/iscan-data/make-policy-file, included in the iscan-data_1.39.1-2_all.deb package. It tries to look for the {idProduct} string in the /usr/lib/udev/rules.d/60-libsane.rules file. But the content of that file has changed substantially between Debian 9 and 10, so it can't find such string and it fails. I guess that also may be occurring in Ubuntu. In spite of that error, the SANE back-end seems to be installed well.

In addition to that problem, I've found one more, also related to the 60-libsane.rules file: it doesn't contain, anymore, the rule that grants the scanner group access to the scanner bus. So I only could scan with the root user, from the command line. Check this bug report for more information. After adding an udev rule similar to the one mentioned in that report, now I can scan again with my user and from a GUI. My rule is as follows:

ENV{ID_VENDOR_ID}=="04b8", ENV{ID_MODEL_ID}=="0130", RUN+="/usr/bin/bash -c '/usr/bin/setfacl -m g:scanner:rw $env{DEVNAME}'"

I need to filter by vendor ID and model ID (EPSON Perfection V500 Photo in my case) because the libsane_matched property seems to be empty. I guess that it's not properly set because of the problem with the installer mentioned in the 1st paragraph.