Just to clarify... Steps to reproduce and diagnose the problem:

1. libsane-hpaio installed
2. avahi-daemon uninstalled or disabled
3. Then, run:

export SANE_DEBUG_DLL=255
scanimage -L

The SANE debug output stops after the following lines:

[09:55:30.981866] [dll] init: initializing backend `hpaio'
[09:55:30.982461] [dll] init: backend `hpaio' is version 1.0.0

At this point, polkit displays a window asking the user to enter a
password, stating: "Authentication is required to manage system services
or other units." This happens because hpaio is trying to activate the
avahi-daemon service.

If the pop-up window is cancelled, the process continues, and no other
backend in the system causes further issues. The only error will be the
failure to activate the service, as we can check:

# journalctl -b -t scanimage
Jul 15 09:56:26 PC29552 scanimage[11391]: protocol/discovery/avahiDiscovery.c 
472: Failed to create client object: Daemon not running

The file protocol/discovery/avahiDiscovery.c is part of hplip and first
appeared in version 3.20.9; previously, protocol/discovery/mdns.c was
used.

I have tested with three hplip versions:

* 3.20.3 → The issue does not occur
* 3.21.12 → The issue occurs
* 3.22.10 → The issue occurs

These are the relevant lines of code for the failure:

445 static void avahi_setup(const int iCommandType, const char* iHostName)
...
457     if (!(client = avahi_client_new(avahi_simple_poll_get(aSimplePoll), 
AVAHI_CLIENT_IGNORE_USER_CONFIG, client_callback, NULL, &error)))
458     {
459         //if Daemon connection failed or daemon not running, 
460         //call systemctl for authorization once it authorized start the 
service
461         if ( ( ( error == AVAHI_ERR_NO_DAEMON ) || (error == 
AVAHI_ERR_DISCONNECTED) )
462               && checkAuthorizationForAvahiService() && 
systemdStartAvahiService() )
463         {
464             if (!(client = 
avahi_client_new(avahi_simple_poll_get(aSimplePoll), 
AVAHI_CLIENT_IGNORE_USER_CONFIG, client_callback, NULL, &error)))
465             {
466                 BUG( "Failed to create client object: %s\n", 
avahi_strerror(error));
467                 goto fail;
468             }
469         }
470         else
471         {
472             BUG( "Failed to create client object: %s\n", 
avahi_strerror(error));
473             goto fail;
474         }
475     }


The resulting behavior is sometimes confusing or even undesirable. We have been 
struggling with this issue for some time now. We manage nearly 3,000 Linux 
workstations centrally and in a controlled manner, not allowing automatic 
device installation and certainly not granting end users administrative 
privileges. So far, sadly, the most common workaround we've found and applied 
is just to uninstall libsane-hpaio. We would like to know or have a better 
solution.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1926014

Title:
  simple-scan is trying to start disabled avahi-daemon.service

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/policykit-1/+bug/1926014/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to