# Removing CUPS



## sidney (Mar 13, 2021)

I want to remove cups, but in doing so pkg wants to delete a whack of software that I want to keep. How do I prevent that from happening? TIA


----------



## Snurg (Mar 13, 2021)

Nowadays CUPS is (at least by default) built in in many software, and sadly more and more software drops LPR support.
Maybe there exists a WITHOUT_CUPS build flag or the like?


----------



## sidney (Mar 13, 2021)

Snurg said:


> Nowadays CUPS is (at least by default) built in in many software, and sadly more and more software drops LPR support.
> Maybe there exists a WITHOUT_CUPS build flag or the like?


I’m too much of a *nix rookie to even attempt such a thing.  Lpr was working just fine and suddenly it stopped working. I thought that removing CUPS to debug might help. Thx!!


----------



## Snurg (Mar 13, 2021)

Umm... you are aware that CUPS has its own version of LPR which is being used if CUPS is installed?
So actually you were using CUPS even when you believed to use LPR...

(I hate this also, there is no way except fixing CUPS, or just print using another computer until CUPS decided to work again for no apparent reason.)


----------



## Deleted member 30996 (Mar 13, 2021)

print/cups gets pulled in with programs I build. I don't use it or worry about it by disabling it from starting in /etc/rc.conf, along with a number of other things I don't want started:


```
sshd_enable="NO"
telnet_enable="NO"
cupsd_enable="NO"
samba_enable="NO"
inetd_enable="NO"
rlogin_enable="NO"
portmap_enable="NO"
winbindd_enable="NO"
lpd_enable="NO"
nfs_server_enable="NO"
nfs_client_enable="NO"
webcamd_enable="NO"
```


----------



## sidetone (Mar 13, 2021)

I don't think you can remove it, once programs are compiled with it. Many packages are compiled with it by default, as you already see.

To be sure CUPS doesn't get inserted when you compile ports, the following can be added to /etc/make.conf:

```
OPTIONS_UNSET= CUPS
```
or you can unset it manually, which will require this option to be unchecked for every `make config`. That's only applicable for when building your own ports.


CUPS and Postscript have their own services. CUPS is 631 as ipp, and Postscript is 170 as print-srv, under /etc/services.

`grep -i print /etc/services`

```
#         35/tcp       any private printer server
#         35/udp       any private printer server
npp       92/tcp       #Network Printing Protocol
npp       92/udp       #Network Printing Protocol
print-srv 170/tcp      #Network PostScript
print-srv 170/udp      #Network PostScript
printer   515/tcp      spooler
printer   515/udp      spooler
ipp       631/tcp      ipps    #IPP (Internet Printing Protocol)
ipp       631/udp      ipps    #IPP (Internet Printing Protocol)
```


----------



## Alexander88207 (Mar 13, 2021)

sidney said:


> I want to remove cups, but in doing so pkg wants to delete a whack of software that I want to keep. How do I prevent that from happening? TIA



You can do remove cups without the other software by using `-f` option. But this maybe can damage some functionality ofc.


```
doas pkg remove -f cups
Password:
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
    cups: 2.3.3op2
```


----------



## sidetone (Mar 13, 2021)

Removing CUPS through `pkg remove -f cups` broke at least one program on my computer from running:

```
ld-elf.so.1: Shared object "libcups.so.2" not found, required by "qpdfview"
```
Maybe, recompiling print/qpdfview with the CUPS option turned off, will allow it to work like that. I'll put CUPS back in for other programs that need it.


----------



## gpw928 (Mar 13, 2021)

sidney said:


> I’m too much of a *nix rookie to even attempt such a thing.  Lpr was working just fine and suddenly it stopped working. I thought that removing CUPS to debug might help. Thx!!


You have tripped across one of the major mis-features of CUPS.  It installs replacements for the common lpr/lpd commands in alternative directories:
	
	



```
/usr/local/sbin/lpc
/usr/local/bin/lpr
/usr/local/bin/lpq
```
whereas the originals are in:
	
	



```
/usr/sbin/lpc
/usr/bin/lpr
/usr/bin/lpq
```
To confirm that the CUPS versions of these programs are in the "local" directories:
	
	



```
[f121.189] $ strings /usr/local/bin/lpr | grep -q cups && echo CPS version
CPS version
```
I don't know of a simple solution to this dilemma, as the outcome depends on your PATH, and changing your PATH for CUPS may break other things.
A temporary solution is to move the executables in /usr/local/bin out of the way (e.g. to /usr/local/bin/lpr.cups) but that will break the next time you patch or upgrade CUPS.  this would get you out of trouble while you figure out how to proceed.
I don't use lpr(1) any more, and I use the (alternative lp/lpadmin) System V command set (which are also installed with CUPS and are unambiguous) for printing with CUPS, so I am no longer bothered by this dilemma.


----------

