scanbd has 30 seconds delay when running as service on Archlinux

640 views Asked by At

I've set up sane/scanbd on an arm box (similar to raspberry pi) with Archlinux. The scanbd is configured to scan a page from the scanner when the scan button is pressed. Everything works fine when running scanbd directly from command line as scanbd -d1 -f. However, when I run it as a service (with systemd), there's a delay of about 30-40s before scanning starts (although it scans eventually).

I've followed this guide to install/configure scanbd.

I left the scanbd.conf as the default configuration. My test.script looks like this:

scanimage --batch-count=1 --resolution 150 --source="ADF Duplex" --batch=/tmp/$(date +%Y%m%d_%H%M)_%02d_out.tiff --format=tiff
#merge into multipage tiff
tiffcp -c lzw /tmp/*out.tiff /tmp/output.tiff
#convert to pdf
tiff2pdf -z /tmp/output.tiff > /tmp/output.pdf

rm /tmp/*.tiff
chmod 755 /tmp/output.pdf
mv /tmp/output.pdf /home/scanner/output.pdf

Any ideas as to why the massive delay is introduced?

1

There are 1 answers

0
ierdna On BEST ANSWER

Finally figured out a workaround. The delay comes from scanbm.socket service.

Steps to fix: 1. disable the socket:

systemctl stop scanbm.socket
systemctl disable scanbm.socket
  1. remove net as the device from /etc/scanbd/sane.d/dll.conf

  2. remove scanbm dependency from the scanbd service:

#/etc/systemd/system/dbus-de.kmux.scanbd.server.service
[Unit]
Description=Scanner button polling Service

[Service]
Type=simple
ExecStart=/usr/sbin/scanbd -f -c /etc/scanbd/scanbd.conf
#ExecReload=?
Environment=SANE_CONFIG_DIR=/etc/scanbd/sane.d
StandardInput=null
StandardOutput=syslog
StandardError=syslog
#NotifyAccess=?

[Install]
WantedBy=multi-user.target
#Also=scanbm.socket <-- comment out this line
Alias=dbus-de.kmux.scanbd.server.service
  1. restart the scanbd service: systemctl restart scanbd