How do I disable automatic remote printer installation?
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.
Solution 5
The cups client libraries now also get a list of network printers from Avahi (which implements the protocol known variously as zeroconf or Bonjour or mdns or dns-sd). In older versions of cups, this was only done by the cups server.
You can see what is being broadcast on your network with a shell command like avahi-browse -a | grep Printer
You can disable avahi with sudo service avahi-daemon stop
, but that will stop all zeroconf based setup, not just printers.
Related videos on Youtube
Comments
-
thorstorm over 1 year
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?
-
Xu Wang almost 10 yearsDid you figure out the answer? I am having similar problems on 14.04 and the answers have not worked for me here. My question is at askubuntu.com/questions/477082/…
-
thorstorm almost 10 yearsNo, I didn't want to disable avahi-daemon and I'm no longer connected to the same network. There are no network printers where I am now.
-
Raffi Khatchadourian over 4 yearsHow do I get rid of all the printers it installed?
-
Michael Mandel over 4 years@RaffiKhatchadourian before disabling it (or after temporarily re-enabling it) I turned off my wifi and they went away. Then I disabled it with the wifi off. PS: Hi!
-
Kiwy almost 4 yearsI don't understand how it is even a feature
-
-
user2524205 over 10 yearsI still have this problem, although my cupsd.conf already contains "Browsing Off". Running the cupsctl leads to the following error:
cupsctl: Unknown option "--no-remote-printers" Usage: ...
-
user2524205 over 10 yearsForgot to mention, I'm on Ubuntu 13.10
-
user.dz about 10 years@CatalinHritcu, How about setting
BrowseLocalProtocols none
? -
azimut over 9 yearsUnfortunately, this didn't stop remote printers from being added for me.
-
Mustafa over 8 yearsThis is the most straightforward solution for 15.10.
-
Charles Green over 8 yearsThis seems to be a duplicate of the answers on Mar 20, 2014 and Dec 5, 2014
-
Stephen Ostermiller over 8 yearsOut of all the answers on the page, this is the only one that worked for me to solve: How do I get rid of a ghost printer in Gnome?
-
gene_wood over 8 yearsWhy does
enable-dbus=no
prevent avahi discovery of printers and what other avahi functionality will be affected by this config change? -
gene_wood over 8 yearsI made this change and it did indeed prevent auto discovered printers from showing up in the list of printers, however my goal was to make the printer dialog come up more quickly (it normally takes 5 to 10 seconds). This change made it take longer for the printer dialog to come up (long enough that Ubuntu dimmed the dialog thinking that it wasn't responding). Hmm.
-
Hitechcomputergeek about 8 yearsUbuntu 15.04 and later (they moved to systemd):
sudo systemctl disable cups-browsed
-
Alex R about 8 years1: that is for sharing the current device's printer(s) to the network, not for showing network printers.
-
Alex R about 8 yearsthis is for the local machines sharing not for not adding remote printers.
-
Organic Marble about 8 yearsI'd upvote you +100 if I could. This fixed my 16.04 shutdown hang.
-
kiko almost 8 yearsCorrect, only step 2 is necessary, and is more correct than the hack in the currently upvoted answer. Please fix your answer to avoid adding confusion to an already confusing answer!
-
Pablo Bianchi about 7 yearsYou can also uses friendly ncurses programs to setup services, like
rcconfc
orsysv-rc-conf
. -
jbrock over 6 yearsThere was one particular printer on my network that kept re-adding itself after being deleted. I set this option, rebooted, and it fixed the issue. I am using Debian 9. Thanks
-
Hoseung Choi over 6 yearsWorked for me. But I have the same problem as gene_wood. It takes ~5s to load the much-shortened printer list.
-
carestad about 6 yearsCan't you just
sudo systemctl mask cups-browsed
now? -
eetsurt over 5 yearsIt doesn't work for 18.04
-
eetsurt over 5 yearsthis solution is work for 18.04
-
haku almost 5 years@eetsurt confirmed working on 18.04.2
-
istepaniuk about 4 yearsTry adding
browse-domains=local.local
in your avahi-daemon.conf instead of disabling d-bus. That should avoid the delay. -
Patrick Rynhart almost 4 yearsThis should be the accepted answer. Works great for 20.04 LTS
-
joel almost 4 yearsnot working for me on 20.04
-
Daniel Burgner over 3 yearsI have had a very nasty side-effect by "sing enable-dbus=no". Libreoffice writter stalled for 30-40 seconds every time I open some files. LO tries to find the printer at file opening involving avahi somehow and stalled for 30 to 40 seconds each time. New files have no problem if they have not been printed yet. The lag also happen each time I enter the printing menu in LO or the printer configuration menu in Ubuntu. Tested in 18.04 and 20.04. It took me more than a year to find out it was related to disabling dbus in avahi, so I do not recommend to use this approach.
-
Thomas Wana over 3 yearsThere are two mechanisms how Ubuntu auto-adds printers. The first one is cups-browsed and can be stopped like this. The second one is cups adding printers itself. There is no easy way to stop the second one except with a load of messy patches. Just braindead.
-
Thomas Wana over 3 yearsThere are two mechanisms how Ubuntu auto-adds printers. The first one is cups-browsed and can be stopped like this. The second one is cups adding printers itself. There is no easy way to stop the second one except with a load of messy patches. Just braindead.
-
ciampix over 3 yearsThis is a piece of genius! It disable avahi without disabling it! :-)
-
Pau Coma Ramirez about 3 years
BrowseRemoteProtocols none
in my case -
Amos Folarin about 3 yearsconfirm not working on 20.04... the abomination of this mess continues.
-
Amos Folarin about 3 yearsthough doing this with Wifi off seems to work.
-
frr almost 3 years@ciampix yes it does get the job done for me in Ubuntu 20.04 - except I have found out, that if I configure both ipv4 and ipv6 to "no", upon systemctl start avahi-daemon, the daemon fails to start. Thus, the same effect would probaby be achieved simply by systemctl stop avahi-daemon, maybe followed by a "disable" to prevent automatic re-appearance on the next boot...
-
Patrick F almost 3 yearsAfter being annoyed by this problem for MONTHS, this ended up being by far both the simplest solution and most reliable solution.
-
FumbleFingers over 2 yearsFirst solution here just worked for me on Mint 20.3, thanks!