How do I disable automatic remote printer installation?
In Raring, everytime I connect to the network, Cups installs all the printers in the network automatically, some more than once.
Furthermore, I connect a USB printer to the laptop every now and then. Even though the printer is configured already, another printer is added to the list.
I wish to disable this feature and allow only manual installation of printers. How do I go about it?
Solution 1:
I just discovered a, possibly optimal, solution to this mess. There is as service called "cups-browsed" which apparently is responsible for going out on the network and finding all the printers it can locate and install them for you (gee - thanks --NOT). Since this is an Upstart/Systemd job, you can stop the service with:
For Ubuntu versions 15.04+ (using systemd)
sudo systemctl stop cups-browsed
Followed by:
sudo systemctl disable cups-browsed
You may still start/stop the service manually if you wish with:
sudo systemctl start cups-browsed
sudo systemctl stop cups-browsed
For Ubuntu versions prior to 15.04 (using upstart)
sudo service cups-browsed stop
Even better, you can prevent the service from ever starting again by adding a simple text file to /etc/init
that contains the single word manual
. The file must be named
cups-browsed.override
So, just start up gedit with
gksudo gedit /etc/init/cups-browsed.override
put manual
in the first and only line and save the file.
On the next Reboot, the service will not be re-started. However, you need not reboot if you've already stopped the service. Once you've placed this file in /etc/init, the service can only be started manually (if and when you need/want it) using:
sudo service cups-browsed start
-or-
sudo service cups-browsed stop`
I have tested this over one reboot. Printing still works fine and so far I am not getting several hundred printers installed anymore after the reboot. Just the ones I installed manually show up.
Solution 2:
In /etc/cups/cups-browsed.conf
, set directive:
BrowseProtocols none
Afterwards, run service cups-browsed restart
and service cups restart
. There should be no printers visible, except those you've added yourself.
Solution 3:
As mentioned earlier, 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.
Solution 4:
I tried all of the above. Modifying Cups did not work in Linux Mint 20, which is based on Ubuntu 20.4. Apparently, Ubuntu and Mint no longer use Cups for Printer discovery, but instead now use Avahi. I think it is a Systemd thing. Setting enable-dbus=no in avahi-daemon.conf somewhat worked, but caused the print menu in LibreOffice to take a long time (maybe 20-30 sec.) to show up, and thus was not a good solution.
The following did work, however, very well:
sudo nano /etc/avahi/avahi-daemon.conf
In that file:
change “use-ip4=yes” to “use-ip4=no”
change “use-ip6=yes” to “use-ip6=no”
Now, only printers that I added manually show up in the "Printers" control panel (Printers-localhost), the HPLIP Toolbox and LibreOffice.