Comment 9 for bug 1577137

Revision history for this message
Hanky (hankschwie) wrote : Re: sane service masked and cannot be unmasked

After doing some research I believe this is not a bug, but a misunderstanding. With systemd in use in 16.04 saned is started only "on demand", when a program calls for it.

The solution from the manpage I described above is actually realised with the sane-utils package, the files are part of that package, only difference is that the are placed in /lib/systemd/system instead of /etc/systemd/system.

sane.socket listens on port 6566 for incoming saned-requests,
`sudo systemtctl status saned.socked` results in

● saned.socket - saned incoming socket
   Loaded: loaded (/lib/systemd/system/saned.socket; enabled; vendor preset: enabled)
   Active: active (listening) since Mi 2016-05-25 16:46:07 CEST; 2h 17min ago
   Listen: [::]:6566 (Stream)
 Accepted: 0; Connected: 0

If saned is configured correctly and a program like xsane calls for it, it is started accordingly.

`sudo systemtctl status saned@*.service` (mark the * !) then will result in something like

● saned@0-192.168.xxx.xx:6566-192.168.xxx.xx:38046.service - Scanner Service (192.168.xxx.xx:38046)
   Loaded: loaded (/lib/systemd/system/saned@.service; indirect; vendor preset: enabled)
   Active: active (running) since Mi 2016-05-25 18:47:01 CEST; 6min ago
 Main PID: 2181 (saned)
   CGroup: /system.slice/system-saned.slice/saned@0-192.168.xxx.xx:6566-192.168.xxx.xx:38046.service
           └─2181 /usr/sbin/saned

Mai 25 18:47:01 computer-name systemd[1]: Started Scanner Service (192.168.xxx.xx:38046).
Mai 25 18:47:01 computer-name saned[2181]: saned (AF-indep+IPv6+systemd) from sane-backends 1.0.25git starting up
Mai 25 18:47:01 computername saned[2181]: check_host: access by remote host: ::ffff:192.168.xxx.xx
Mai 25 18:47:01 computername saned[2181]: init: access granted to saned-user@::ffff:192.168.xxx.xx

sane is loaded by /lib/systemd/system/saned@.service, which starts /usr/bin/saned as requested by xsane.

The service cannot be started manually by something like `sudo systemctl start saned`, because it is only started by incoming requests. `scanimage -L` will also start saned, but it will stop as soon as the process is completed.