Adding CUPS printer - command line help. <SOLVED>

a very small Live CD shaped to look and act like Puppy Linux.


Moderator: fredx181

Post Reply
dcung
Posts: 510
Joined: Fri Sep 25, 2020 4:31 am
Has thanked: 68 times
Been thanked: 70 times

Adding CUPS printer - command line help. <SOLVED>

Post by dcung »

Note - my builds has printer-driver-escpr package, so Epson drivers is (always) included.
I can use CUPS browser interface to add the printer - tested, working.
I'd like to be able to do so via command line.
Need help constructing the command.

My reading on the net points to lpadmin, lpstat, lpinfo etc commands.
I have experimented but have not been successful yet so far.

Epson WF-2760 printer IP address - lpd://xxx.xxx.xxx.xxx:515/PASSTHRU
This is the content of printers.conf when added thru browser (working).

Code: Select all

# Printer configuration file for CUPS v2.4.2
# Written by cupsd
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
NextPrinterId 2
<Printer Epson-WF-2760>
PrinterId 1
UUID urn:uuid:2265xxxx-xxxx-xxxx-xxxx-xxxx1711ee2c
Info Epson-WF-2760
Location Upstairs
MakeModel EPSON WF-2760 Series , Epson Inkjet Printer Driver (ESC/P-R) for Linux
DeviceURI lpd://xxx.xxx.xxx.xxx:515/PASSTHRU
State Idle
StateTime 1741228748
ConfigTime 1738828280
Type 4124
Accepting Yes
Shared No
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
Attribute marker-colors \#000000,#00FFFF,#FF00FF,#FFFF00
Attribute marker-levels -1,-1,-1,-1
Attribute marker-names ,,,
Attribute marker-types unknown,unknown,unknown,unknown
Attribute marker-change-time 1741228748
</Printer>

.
.
.
Tried these command lines

Code: Select all

root@live:/mnt/sda2/MyData# lpadmin -p Epson-WF2760 -E -v lpd://xxx.xxx.xxx.xxx:515/PASSTHRU -m drv:///Epson-WF-2760_Series-epson-escpr-en.ppd
lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS.
lpadmin: cups-driverd failed to get PPD file - see error_log for details.

root@live:/mnt/sda2/MyData# lpadmin -p Epson-WF2760 -E -v lpd://xxx.xxx.xxx.xxx:515/PASSTHRU -P escpr:0/cups/model/epson-inkjet-printer-escpr/Epson-WF-2760_Series-epson-escpr-en.ppd
lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS.
lpadmin: Unable to open PPD "escpr:0/cups/model/epson-inkjet-printer-escpr/Epson-WF-2760_Series-epson-escpr-en.ppd": Unable to open PPD file on line 0.

root@live:/mnt/sda2/MyData# 

.
.
.
It seems that the path to the PPD file is incorrect.
Where is this file located?
I looked at /etc/cups, /usr/share/cups, /lib/cups/driver, /usr/share/cups/drv, did not see ppd files.
There's in /etc/cups/ppd/Epson-WF-2760.ppd, but that's after adding thru browser interface.
Does this ppd file gets created on-the-fly?

Code: Select all

root@live:/mnt/sda2/MyData# lpinfo -m | grep WF-2760
escpr:0/cups/model/epson-inkjet-printer-escpr/Epson-WF-2760_Series-epson-escpr-en.ppd EPSON WF-2760 Series , Epson Inkjet Printer Driver (ESC/P-R) for Linux

Error log

Code: Select all

E [11/Mar/2025:12:35:00 +1100] [CGI] ippfind (PID 13280) stopped with status 2!
E [11/Mar/2025:12:41:38 +1100] [CGI] ippfind (PID 16228) stopped with status 2!
E [11/Mar/2025:12:46:43 +1100] [cups-driverd] Unable to open \"/usr/share/cups/drv/Epson-WF-2760_Series-epson-escpr-en.ppd\" - No such file or directory
E [11/Mar/2025:12:46:43 +1100] [cups-driverd] Unable to open \"/usr/share/cups/drv/Epson-WF-2760_Series-epson-escpr-en.ppd\" - No such file or directory
E [11/Mar/2025:12:46:43 +1100] copy_model: empty PPD file
E [11/Mar/2025:12:46:43 +1100] [Client 12] Returning IPP server-error-internal-error for CUPS-Add-Modify-Printer (ipp://localhost:631/printers/Epson-WF2760) from localhost.
E [11/Mar/2025:12:57:47 +1100] [CGI] ippfind (PID 23548) stopped with status 2!
Last edited by dcung on Tue Mar 11, 2025 6:56 pm, edited 1 time in total.
User avatar
rcrsn51
Posts: 1486
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 424 times

Re: Adding CUPS printer - command line help.

Post by rcrsn51 »

The package printer-driver-escpr contains the python3 script /usr/lib/cups/driver/escpr. The individual PPDs are not included in the package. At some point, the CUPS daemon runs this program to generate the Epson PPDs on-the-fly. I don't know when this happens, but it sounds like you can't get the PPDs just by running lpadmin.

[Edit] I was able to manually generate a PPD with this:

Code: Select all

cd /usr/lib/cups/driver
PPD=$(python3 escpr list | grep WF-2760 | cut -d\" -f2)
echo $PPD
python3 escpr cat $PPD > /usr/share/cups/model/WF-2760.ppd

Then run

Code: Select all

lpadmin -p Epson-WF2760 -E -v lpd://x.x.x.x:515/PASSTHRU -m WF-2760.ppd
dcung
Posts: 510
Joined: Fri Sep 25, 2020 4:31 am
Has thanked: 68 times
Been thanked: 70 times

Re: Adding CUPS printer - command line help. <SOLVED>

Post by dcung »

rcrsn51 wrote: Tue Mar 11, 2025 12:58 pm

...but it sounds like you can't get the PPDs just by running lpadmin.

I think this is the key part.

I was able to use a copy of PPD file generated by CUPS browser interface.
And I also have tested that I can use the PPD file generated by your python script.

Code: Select all

lpadmin -p Epson-WF2760 -E -v lpd://x.x.x.x:515/PASSTHRU -m WF-2760.ppd

Works. Thank you!

User avatar
rcrsn51
Posts: 1486
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 424 times

Re: Adding CUPS printer - command line help. <SOLVED>

Post by rcrsn51 »

Excellent. I checked this and the manually generated PPD is identical to the on-the-fly version that CUPS makes.

Post Reply

Return to “DebianDogs”