How to Turn Off Autodiscovered Printers in Firefox?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to Turn Off Autodiscovered Printers in Firefox?

Kent West
So when I go to select a printer in Firefox, there are many autodiscovered printers to choose from. I don't want any of them in my list. How do I turn this off?

I found the two "browse" options in /etc/cups/cupsd.conf, but they make no difference. I found /etc/cups/cups-browsed, but killing that daemon makes no difference. In fact, killing CUPS altogether makes no difference (except my desired printer then goes away), so obviously this isn't a CUPS thing.

Then I discovered Avahi (and had to go into learning mode - apparently this is also known as "Bonjour" and "Rendevous" and "ZeroConf", depending on OS and version and situation). The most obvious tweaks in /"etc/avahi/avahi-daemon.conf", the two "disable-publishing..." options, don't do anything.

But I can "systemctl disable avahi-daemon" altogether to get rid of the unwanted printers. But that seems like overkill, and disables all of Avahi's function (I was pleased to learn I can find non-Windows clients on our mostly-Windows-oriented network using Avahi, just by adding ".local" to the hostname - ex. "ping bigserver" fails, but "ping bigserver.local" gets replies - sweet!).

So, any one know how to tell Avahi to not publish found printers to Firefox's print dialog?

Thanks!

--
Kent West                    <")))><
Westing Peacefully - http://kentwest.blogspot.com
Reply | Threaded
Open this post in threaded view
|

Re: How to Turn Off Autodiscovered Printers in Firefox?

Brian
On Tue 26 Sep 2017 at 00:15:31 -0500, Kent West wrote:

> So when I go to select a printer in Firefox, there are many autodiscovered
> printers to choose from. I don't want any of them in my list. How do I turn
> this off?

See later. But first stop or purge cups-browsed.
 
> I found the two "browse" options in /etc/cups/cupsd.conf, but they make no
> difference. I found /etc/cups/cups-browsed, but killing that daemon makes
> no difference. In fact, killing CUPS altogether makes no difference (except
> my desired printer then goes away), so obviously this isn't a CUPS thing.

Correct.
 
> Then I discovered Avahi (and had to go into learning mode - apparently this
> is also known as "Bonjour" and "Rendevous" and "ZeroConf", depending on OS
> and version and situation). The most obvious tweaks in
> /"etc/avahi/avahi-daemon.conf", the two "disable-publishing..." options,
> don't do anything.

Indeed not. They affect publishing, not discovery.
 
> But I can "systemctl disable avahi-daemon" altogether to get rid of the
> unwanted printers. But that seems like overkill, and disables all of
> Avahi's function (I was pleased to learn I can find non-Windows clients on
> our mostly-Windows-oriented network using Avahi, just by adding ".local" to
> the hostname - ex. "ping bigserver" fails, but "ping bigserver.local" gets
> replies - sweet!).

Without avahi-daemon running Firefox cannot discover printers or print
servers on the network from their DNS-SD broadcasts.

> So, any one know how to tell Avahi to not publish found printers to
> Firefox's print dialog?

All GTK applications can use avahi-daemon for printer discovery. It is
GTK you want to control, not avahi-daemon. gtk-print-backends is the
relevant property to use. Its default value is "file,cups".

I think Firefox uses GTK3. In /etc/gtk-3.0 or ~/.gtk-3.0 you want to
create the file settings.ini and see what the contents

  [Settings]
  gtk-print-backends=file

do for you. (The file name and format is different for GTK2).

--
Brian.

Reply | Threaded
Open this post in threaded view
|

Re: How to Turn Off Autodiscovered Printers in Firefox?

Curt
On 2017-09-26, Brian <[hidden email]> wrote:

> On Tue 26 Sep 2017 at 00:15:31 -0500, Kent West wrote:
>
>> So when I go to select a printer in Firefox, there are many autodiscovered
>> printers to choose from. I don't want any of them in my list. How do I turn
>> this off?
>
> See later. But first stop or purge cups-browsed.
>  
>> I found the two "browse" options in /etc/cups/cupsd.conf, but they make no
>> difference. I found /etc/cups/cups-browsed, but killing that daemon makes
>> no difference. In fact, killing CUPS altogether makes no difference (except
>> my desired printer then goes away), so obviously this isn't a CUPS thing.
>
> Correct.
>  
>> Then I discovered Avahi (and had to go into learning mode - apparently this
>> is also known as "Bonjour" and "Rendevous" and "ZeroConf", depending on OS
>> and version and situation). The most obvious tweaks in
>> /"etc/avahi/avahi-daemon.conf", the two "disable-publishing..." options,
>> don't do anything.
>
> Indeed not. They affect publishing, not discovery.
>  
>> But I can "systemctl disable avahi-daemon" altogether to get rid of the
>> unwanted printers. But that seems like overkill, and disables all of
>> Avahi's function (I was pleased to learn I can find non-Windows clients on
>> our mostly-Windows-oriented network using Avahi, just by adding ".local" to
>> the hostname - ex. "ping bigserver" fails, but "ping bigserver.local" gets
>> replies - sweet!).
>
> Without avahi-daemon running Firefox cannot discover printers or print
> servers on the network from their DNS-SD broadcasts.
>
>> So, any one know how to tell Avahi to not publish found printers to
>> Firefox's print dialog?
>
> All GTK applications can use avahi-daemon for printer discovery. It is
> GTK you want to control, not avahi-daemon. gtk-print-backends is the
> relevant property to use. Its default value is "file,cups".
>
> I think Firefox uses GTK3. In /etc/gtk-3.0 or ~/.gtk-3.0 you want to
> create the file settings.ini and see what the contents
>
>   [Settings]
>   gtk-print-backends=file
>
> do for you. (The file name and format is different for GTK2).
>

Some anonymous joe on the internet said you can edit the [server]
section of the /etc/avahi/avahi-daemon.conf file and uncomment the
'enable-dbus=yes' line, changing that line to 'enable-dbus=no' and this
will disable printer discovery (while retaining dns functionality).

Whether this works or not, or how perilously or ridiculously close this
edit is to just turning the damned avahi thing off altogether, I do not
know.


--
"A simpering Bambi narcissist and a thieving, fanatical Albanian dwarf."
Christopher Hitchens, commenting shortly after the nearly concurrent deaths
of Lady Diana and Mother Theresa.

Reply | Threaded
Open this post in threaded view
|

Re: How to Turn Off Autodiscovered Printers in Firefox?

Brian
On Tue 26 Sep 2017 at 12:08:02 +0000, Curt wrote:

> On 2017-09-26, Brian <[hidden email]> wrote:
> > On Tue 26 Sep 2017 at 00:15:31 -0500, Kent West wrote:
> >
> >> So when I go to select a printer in Firefox, there are many autodiscovered
> >> printers to choose from. I don't want any of them in my list. How do I turn
> >> this off?
> >
> > See later. But first stop or purge cups-browsed.
> >  
> >> I found the two "browse" options in /etc/cups/cupsd.conf, but they make no
> >> difference. I found /etc/cups/cups-browsed, but killing that daemon makes
> >> no difference. In fact, killing CUPS altogether makes no difference (except
> >> my desired printer then goes away), so obviously this isn't a CUPS thing.
> >
> > Correct.
> >  
> >> Then I discovered Avahi (and had to go into learning mode - apparently this
> >> is also known as "Bonjour" and "Rendevous" and "ZeroConf", depending on OS
> >> and version and situation). The most obvious tweaks in
> >> /"etc/avahi/avahi-daemon.conf", the two "disable-publishing..." options,
> >> don't do anything.
> >
> > Indeed not. They affect publishing, not discovery.
> >  
> >> But I can "systemctl disable avahi-daemon" altogether to get rid of the
> >> unwanted printers. But that seems like overkill, and disables all of
> >> Avahi's function (I was pleased to learn I can find non-Windows clients on
> >> our mostly-Windows-oriented network using Avahi, just by adding ".local" to
> >> the hostname - ex. "ping bigserver" fails, but "ping bigserver.local" gets
> >> replies - sweet!).
> >
> > Without avahi-daemon running Firefox cannot discover printers or print
> > servers on the network from their DNS-SD broadcasts.
> >
> >> So, any one know how to tell Avahi to not publish found printers to
> >> Firefox's print dialog?
> >
> > All GTK applications can use avahi-daemon for printer discovery. It is
> > GTK you want to control, not avahi-daemon. gtk-print-backends is the
> > relevant property to use. Its default value is "file,cups".
> >
> > I think Firefox uses GTK3. In /etc/gtk-3.0 or ~/.gtk-3.0 you want to
> > create the file settings.ini and see what the contents
> >
> >   [Settings]
> >   gtk-print-backends=file
> >
> > do for you. (The file name and format is different for GTK2).
> >
>
> Some anonymous joe on the internet said you can edit the [server]
> section of the /etc/avahi/avahi-daemon.conf file and uncomment the
> 'enable-dbus=yes' line, changing that line to 'enable-dbus=no' and this
> will disable printer discovery (while retaining dns functionality).
>
> Whether this works or not, or how perilously or ridiculously close this
> edit is to just turning the damned avahi thing off altogether, I do not
> know.

I tried this and the GTK print dialog took ages to come up. I'd also be
concerned about other possible knock-on effects. Why "damned avahi
thing..."? You make it sound evil.

--
Brian.

Reply | Threaded
Open this post in threaded view
|

Re: How to Turn Off Autodiscovered Printers in Firefox?

Kent West


On Tue, Sep 26, 2017 at 8:57 AM, Brian <[hidden email]> wrote:
On Tue 26 Sep 2017 at 12:08:02 +0000, Curt wrote:

> On 2017-09-26, Brian <[hidden email]> wrote:
> > On Tue 26 Sep 2017 at 00:15:31 -0500, Kent West wrote:
> >
> >> So when I go to select a printer in Firefox, there are many autodiscovered
> >> printers to choose from. I don't want any of them in my list. How do I turn
> >> this off?
> >
> > See later. But first stop or purge cups-browsed.
> >
> >> I found the two "browse" options in /etc/cups/cupsd.conf, but they make no
> >> difference. I found /etc/cups/cups-browsed, but killing that daemon makes
> >> no difference. In fact, killing CUPS altogether makes no difference (except
> >> my desired printer then goes away), so obviously this isn't a CUPS thing.
> >
> > Correct.


If this isn't a CUPS thing, what's the value in stopping or purging cups-browsed?

 
> >
> >> Then I discovered Avahi (and had to go into learning mode - apparently this
> >> is also known as "Bonjour" and "Rendevous" and "ZeroConf", depending on OS
> >> and version and situation). The most obvious tweaks in
> >> /"etc/avahi/avahi-daemon.conf", the two "disable-publishing..." options,
> >> don't do anything.
> >
> > Indeed not. They affect publishing, not discovery.


As in "publishing to other computers on the network", not as in "publishing to applications, like Firefox, on this computer"?

I don't mind Avahi discovering printers; I just don't want it "publishing" what it found to Firefox. Apparently I misunderstood the scope of the word "publish".



> >> So, any one know how to tell Avahi to not publish found printers to
> >> Firefox's print dialog?
> >
> > All GTK applications can use avahi-daemon for printer discovery. It is
> > GTK you want to control, not avahi-daemon. gtk-print-backends is the
> > relevant property to use. Its default value is "file,cups".
> >
> > I think Firefox uses GTK3. In /etc/gtk-3.0 or ~/.gtk-3.0 you want to
> > create the file settings.ini and see what the contents
> >
> >   [Settings]
> >   gtk-print-backends=file
> >
> > do for you. (The file name and format is different for GTK2).

When I do this, *all* my printers disappear from the Firefox dialog, including the one I've got in CUPS, which shows up in the CUPS web dialog (localhost:631) and in /etc/cups/printers.conf.

 
>
> Some anonymous joe on the internet said you can edit the [server]
> section of the /etc/avahi/avahi-daemon.conf file and uncomment the
> 'enable-dbus=yes' line, changing that line to 'enable-dbus=no' and this
> will disable printer discovery (while retaining dns functionality).
>
> Whether this works or not, or how perilously or ridiculously close this
> edit is to just turning the damned avahi thing off altogether, I do not
> know.

I tried this and the GTK print dialog took ages to come up. I'd also be
concerned about other possible knock-on effects. Why "damned avahi
thing..."? You make it sound evil.

When I tried this, it solved my problem, and I don't notice any delay issues.



--
Kent West                    <")))><
Westing Peacefully - http://kentwest.blogspot.com
Reply | Threaded
Open this post in threaded view
|

Re: How to Turn Off Autodiscovered Printers in Firefox?

Brian
On Tue 26 Sep 2017 at 13:55:33 -0500, Kent West wrote:

> On Tue, Sep 26, 2017 at 8:57 AM, Brian <[hidden email]> wrote:
>
> > On Tue 26 Sep 2017 at 12:08:02 +0000, Curt wrote:
> >
> > > On 2017-09-26, Brian <[hidden email]> wrote:
> > > > On Tue 26 Sep 2017 at 00:15:31 -0500, Kent West wrote:
> > > >
> > > >> So when I go to select a printer in Firefox, there are many
> > autodiscovered
> > > >> printers to choose from. I don't want any of them in my list. How do
> > I turn
> > > >> this off?
> > > >
> > > > See later. But first stop or purge cups-browsed.
> > > >
> > > >> I found the two "browse" options in /etc/cups/cupsd.conf, but they
> > make no
> > > >> difference. I found /etc/cups/cups-browsed, but killing that daemon
> > makes
> > > >> no difference. In fact, killing CUPS altogether makes no difference
> > (except
> > > >> my desired printer then goes away), so obviously this isn't a CUPS
> > thing.
> > > >
> > > > Correct.
> >
>
> If this isn't a CUPS thing, what's the value in stopping or purging
> cups-browsed?

It rules out cups-browsed as a source for printer discovery and makes
the next step more convincing.

> > > >> Then I discovered Avahi (and had to go into learning mode -
> > apparently this
> > > >> is also known as "Bonjour" and "Rendevous" and "ZeroConf", depending
> > on OS
> > > >> and version and situation). The most obvious tweaks in
> > > >> /"etc/avahi/avahi-daemon.conf", the two "disable-publishing..."
> > options,
> > > >> don't do anything.
> > > >
> > > > Indeed not. They affect publishing, not discovery.
>
> As in "publishing to other computers on the network", not as in "publishing
> to applications, like Firefox, on this computer"?

More or less. The print dialog of Firefox browses Bonjour-broadcasted
remote printers and populates its dialog from what is detected.
 
> I don't mind Avahi discovering printers; I just don't want it "publishing"
> what it found to Firefox. Apparently I misunderstood the scope of the word
> "publish".

No. What you want is either Firefox not browsing Bonjour broadcasts or,
if it does, selectively displaying print queues/printers it discovers.
AFAIK, the first cannot be done. The second is the subject of an
upstream GTK bug report somewhere.
 

> > >> So, any one know how to tell Avahi to not publish found printers to
> > > >> Firefox's print dialog?
> > > >
> > > > All GTK applications can use avahi-daemon for printer discovery. It is
> > > > GTK you want to control, not avahi-daemon. gtk-print-backends is the
> > > > relevant property to use. Its default value is "file,cups".
> > > >
> > > > I think Firefox uses GTK3. In /etc/gtk-3.0 or ~/.gtk-3.0 you want to
> > > > create the file settings.ini and see what the contents
> > > >
> > > >   [Settings]
> > > >   gtk-print-backends=file
> > > >
> > > > do for you. (The file name and format is different for GTK2).
> >
>
> When I do this, *all* my printers disappear from the Firefox dialog,
> including the one I've got in CUPS, which shows up in the CUPS web dialog
> (localhost:631) and in /etc/cups/printers.conf.

You have learned that "gtk-print-backends=file" achieves your objective
but has the side affect of removing local print queues too.

Restarting or reinstalling cups-browsed has no affect on this situation.
GTK apps get their printer lists directly from Bonjour broadcasts, so
neither cupsd nor cups-browsed is necessary.
 

> > > Some anonymous joe on the internet said you can edit the [server]
> > > section of the /etc/avahi/avahi-daemon.conf file and uncomment the
> > > 'enable-dbus=yes' line, changing that line to 'enable-dbus=no' and this
> > > will disable printer discovery (while retaining dns functionality).
> > >
> > > Whether this works or not, or how perilously or ridiculously close this
> > > edit is to just turning the damned avahi thing off altogether, I do not
> > > know.
> >
> > I tried this and the GTK print dialog took ages to come up. I'd also be
> > concerned about other possible knock-on effects. Why "damned avahi
> > thing..."? You make it sound evil.
>
> When I tried this, it solved my problem, and I don't notice any delay
> issues.

Users of Qt apps, command line utilities and LibreOffice would not be
overjoyed by having their printing experience severely degraded. There
might also be other drawbacks to dbus deactivation. The issue with an
"anonymous joe" is the lack of any detail, explanation or testing
reports.

Try: in settings.ini have 'gtk-print-backends=file,lpr'. Print from the
dialog with 'lp -d <print_queue>'.

In the end it depends on what you and your users can live with.

--
Brian.

Reply | Threaded
Open this post in threaded view
|

Re: How to Turn Off Autodiscovered Printers in Firefox?

Curt
On 2017-09-27, Brian <[hidden email]> wrote:
>>
>> When I tried this, it solved my problem, and I don't notice any delay
>> issues.
>
> Users of Qt apps, command line utilities and LibreOffice would not be
> overjoyed by having their printing experience severely degraded. There
> might also be other drawbacks to dbus deactivation. The issue with an
> "anonymous joe" is the lack of any detail, explanation or testing
> reports.

Well Joe(s) said:

 The cups client libraries now also get a list of network printers from Avahi.
 In older versions of cups, this was only done by the cups server.

 This is now done in the client-side cups libraries (ie libcups.so,
 which GNOME and KDE apps link against) and not in the cupsd server.
 So changing the "Browse" settings in the cups server won't work.

 $ ldd /usr/lib/x86_64-linux-gnu/libcups.so.2
 ...
 libavahi-common.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-common.so.3
 libavahi-client.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-client.so.3

 IE this behaviour (of showing remote printers in the Print dialog box) happens
 even if you turn off your local cups server. You can disable it by turning off
 the avahi service, but that will disable all zeroconf/mdns related
 functionality.

 However, there is at least a way to turn off most of avahi's functionality
 (including adding remote printers into the CUPS clients) while keeping the DNS
 functionality (eg when looking up foo.local-style host names):
 edit /etc/avahi/avahi-daemon.conf and in the [server] section, add
 enable-dbus=no then restart the avahi-daemon service.

I guess that's all the explanation we're going to get. As for testing, the OP
tested and said it solved his problem. I'm sorry the solution wasn't up to your
high standards, but I did my best.

;-)

 

> Try: in settings.ini have 'gtk-print-backends=file,lpr'. Print from the
> dialog with 'lp -d <print_queue>'.
>
> In the end it depends on what you and your users can live with.
>


--
"A simpering Bambi narcissist and a thieving, fanatical Albanian dwarf."
Christopher Hitchens, commenting shortly after the nearly concurrent deaths
of Lady Diana and Mother Theresa.

Reply | Threaded
Open this post in threaded view
|

Re: How to Turn Off Autodiscovered Printers in Firefox?

Kent West
Thanks for the explanations, y'all! I've learned a lot.

(My situation is on a kiosk, so limiting the users isn't an issue, so long as what the kiosk is designed to do, it does. It does. Thanks!

--
Kent West                    <")))><
Westing Peacefully - http://kentwest.blogspot.com
Reply | Threaded
Open this post in threaded view
|

Re: How to Turn Off Autodiscovered Printers in Firefox?

Brian
In reply to this post by Curt
On Wed 27 Sep 2017 at 14:46:22 +0000, Curt wrote:

> On 2017-09-27, Brian <[hidden email]> wrote:
> >>
> >> When I tried this, it solved my problem, and I don't notice any delay
> >> issues.
> >
> > Users of Qt apps, command line utilities and LibreOffice would not be
> > overjoyed by having their printing experience severely degraded. There
> > might also be other drawbacks to dbus deactivation. The issue with an
> > "anonymous joe" is the lack of any detail, explanation or testing
> > reports.
>
> Well Joe(s) said:
>
>  The cups client libraries now also get a list of network printers from Avahi.
>  In older versions of cups, this was only done by the cups server.

Ok.

>  This is now done in the client-side cups libraries (ie libcups.so,
>  which GNOME and KDE apps link against) and not in the cupsd server.
>  So changing the "Browse" settings in the cups server won't work.

Ok.
 
>  $ ldd /usr/lib/x86_64-linux-gnu/libcups.so.2
>  ...
>  libavahi-common.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-common.so.3
>  libavahi-client.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-client.so.3
>
>  IE this behaviour (of showing remote printers in the Print dialog box) happens
>  even if you turn off your local cups server. You can disable it by turning off
>  the avahi service, but that will disable all zeroconf/mdns related
>  functionality.

Your first point applies only to GTK applications, not to Qt and command
line applications and LibreOffice. They need cups-browsed. The second
point is swings and roundabouts; at least until GTK and/or GNOME gets
its act together. [1]
 
>  However, there is at least a way to turn off most of avahi's functionality
>  (including adding remote printers into the CUPS clients) while keeping the DNS
>  functionality (eg when looking up foo.local-style host names):
>  edit /etc/avahi/avahi-daemon.conf and in the [server] section, add
>  enable-dbus=no then restart the avahi-daemon service.

I've not disagreed with that, only with the idea it is a wise thing to
do. Most printing operations are user controlled; the intervention of
the superuser is rarely needed. This change to avahi-daemon.conf affects
those not relying on GTK. There would be a riot here if all users lost
access to remote printers for the sake of one user not wanting to see
them in one application.
 
> I guess that's all the explanation we're going to get. As for testing, the OP
> tested and said it solved his problem. I'm sorry the solution wasn't up to your
> high standards, but I did my best.
>
> ;-)

I also tested. It worked insofar as remote printers were not present in
the Firefox print dialog but lpstat, loptions etc took ages to display
an output. That is the third drawback to the "solution" I've pointed
out.

[1] LP #1379359
  https://bugs.launchpad.net/ubuntu/+source/gtk+3.0/+bug/1379359
leads to
  https://launchpad.net/~roman-shipovskij/+archive/ubuntu/gtk+3.0-withoutavahiprinters

--
Brian.