Difference between revisions of "CUPS (简体中文)"

From ArchWiki
Jump to: navigation, search
(配置)
(PDF virtual printer: Sync to new version.)
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[Category:Printers (简体中文)]]
 
[[Category:Printers (简体中文)]]
 
[[Category:简体中文]]
 
[[Category:简体中文]]
{{i18n|CUPS}}
+
[[cs:CUPS]]
{{Translateme}}
+
[[en:CUPS]]
 +
[[es:CUPS]]
 +
[[it:CUPS]]
 +
[[pl:CUPS]]
 +
[[ru:CUPS]]
 +
[[th:CUPS]]
 +
[[tr:CUPS]]
 +
[[zh-TW:CUPS]]
 +
{{translateme (简体中文)}}
  
 
来自 [http://www.cups.org/index.php CUPS' site]:
 
来自 [http://www.cups.org/index.php CUPS' site]:
:"''[[Wikipedia:CUPS|CUPS]] 是苹果公司为Mac OS® X 和其他类 UNIX 的操作系统开发的基于标准的、开源的打印系统''".
+
:"''[[Wikipedia:CUPS|CUPS]] 是苹果公司为Mac OS® X 和其他类 UNIX® 的操作系统开发的基于标准的、开源的打印系统''".
  
=介绍=
+
虽然有其他的打印程序包例如LPRNG,但CUPS是相当流行和相对容易使用的。它是Arch linux及许多其他Linux发行版缺省的打印系统。
  
==什么是 CUPS?==
+
==安装 CUPS==
  
CUPS网站的介绍: "The Common UNIX Printing System ("CUPS")'''CUPS''' 是个跨UNIX平台的打印解决方案. 它基于“网络打印协议”并且为大多数Postscript和光栅打印机提供完整的打印服务。CUPS基于GUN GPL协议提供。”虽然有其他的打印程序包例如LPRNG,但CUPS是相当流行和相对容易使用的。它是Arch linux及许多其他Linux发行版缺省的打印系统。
+
首先要安装这3个包{{Pkg|cups}}, {{Pkg|ghostscript}},以及 {{Pkg|gsfonts}},从[[官方软件仓库]]中[[安装]]它们。
It is based on the "Internet Printing Protocol" and provides complete printing services to most Postscript and raster printers. CUPS is provided under the GNU GPL..."  Although there are other printing packages such as LPRNG, CUPS is quite popular and relatively easy to use.  It is the default printing system on Arch Linux as well as many other Linux distributions.
+
  
==Troubleshooting CUPS & components  ''' CUPS'''及组件的疑难解答==
+
如果正常的cups不起作用,你可以试试从 [[AUR]] 安装 {{AUR|cups-usblp}}
 
+
在‘/etc/cups/cupsd.conf’文件中设置‘LogLevel’是让打印机工作最好的方法:The best way to get printing working is to set 'LogLevel' in '/etc/cups/cupsd.conf' to:
+
<pre>
+
LogLevel debug2
+
</pre>
+
然后像这样查看'/var/log/cups/error_log'文件的输出:And then viewing the output from '/var/log/cups/error_log' like this:
+
<pre>
+
tail -n 100 -f /var/log/cups/error_log
+
</pre>
+
在输出中左边的字符排列如下:The characters at the left of the output stands for:
+
<pre>
+
D = Debug
+
E = Error
+
I = Information
+
等等...
+
</pre>
+
这些文件也可能被证明是有用的。These files may also prove useful.
+
<pre>
+
/var/log/cups/page_log '每次打印成功后增加的词条spits out a new entry each time a print is successful.'
+
/var/log/cups/access_log '所有活跃的cupsd http1.1服务器列表lists all cupsd http1.1 server activity'
+
</pre>
+
 
+
当然,如果想解决你的问题,重要的是知道CUPS怎样工作,这多多少少是正确的:Of course it's important to know how CUPS work if you want to solve your problems, this is somewhat correct:
+
 
+
# 当你选择‘打印’时,应用程序会发送一个.ps文件(PostScript,是主要用于电子产业和桌面出版领域的一种页面描述语言。)给CUPS(99%的程序会这样做)。An application sends a .ps file(PostScript, a script language that details how the page will look) to CUPS when you select 'print'(99% of apps do).
+
# CUPS然后读取你打印机的PPD文件(打印机描述文件)并且计算出它需要哪种解释器去将.ps文件转换成一种打印机认识的语言(像PJL,PCL)。通常它需要ghostscript。CUPS then looks at your printers PPD file(printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands(like PJL,PCL). Usually it needs ghostscript.
+
# GhostScript取得输入并且计算出它需要哪个过滤器,然后将它们转变成打印机能读懂的.ps格式。GhostScript takes the input and figures out which filters it should use,then applies them and converts the .ps file to a format understood by the printer.
+
#然后它被发送到后端。举个例子,如果你有打印机连接到USB端口,它就用USB后端。 Then it is sent to the backend. For example, if you have your printer connected to a USB port, it uses the USB backend.
+
 
+
打印一个文档并且查看'error_log'文件来得到关于打印队列更多的细节和正确地印象。Print a document and watch 'error_log' to get a more detailed and correct image of the printing process.
+
 
+
=安装 CUPS=
+
 
+
首先要安装这两个包:
+
# pacman -S cups ghostscript gsfonts
+
如果正常的cups不起作用,你可以试试从 [[AUR]] 安装 {{AUR|cups-usblp}} 。(建议三星的USB打印机试用)
+
  
 
* '''cups''' - 就是传说中的CUPS软件
 
* '''cups''' - 就是传说中的CUPS软件
Line 57: Line 28:
 
* '''hpoj''' - 如果你使用 HP Officejet, 你应该再安装这个包,遵循指导避免发生错误. 更多信息见 [http://answers.launchpad.net/hplip/+question/133425 thread at launchpad/hplip].
 
* '''hpoj''' - 如果你使用 HP Officejet, 你应该再安装这个包,遵循指导避免发生错误. 更多信息见 [http://answers.launchpad.net/hplip/+question/133425 thread at launchpad/hplip].
  
如果你的系统要通过 [[Samba]] 使用网络打印机,或者这台机器要作为打印服务器向其它windows客户端提供服务,你还需要安装Samba:
+
如果你的系统要通过 [[Samba]] 使用网络打印机,或者这台机器要作为打印服务器向其它windows客户端提供服务,你还需要安装{{pkg|samba}}.
# pacman -S samba
+
  
==打印机驱动==
+
===打印机驱动===
 
这是一些驱动包。根据你的打印机选择合适的包安装。
 
这是一些驱动包。根据你的打印机选择合适的包安装。
  
* '''gutenprint''' - 一组质量非常好的驱动集合,支持的目标机型包括 Canon, Epson, Lexmark, Sony, Olympus;以及配合CUPS/GhostSscript/Foomatic/GIMP使用的 PCL printers。
+
* '''{{Pkg|gutenprint}}''' - 一组质量非常好的驱动集合,支持的目标机型包括 Canon, Epson, Lexmark, Sony, Olympus;以及配合CUPS/GhostSscript/Foomatic/GIMP使用的 PCL printers。
* '''foomatic-db, foomatic-db-engine, foomatic-db-nonfree, and foomatic-filters''' - Foomatic 是一个基于数据库的,集成自由软件打印机驱动和脱机打印程序的系统。安装 foomatic-filters 可以解决 cups error_log 报告错误 "stopped with status 22!".
+
* '''{{Pkg|foomatic-db}}, {{Pkg|foomatic-db-engine}},{{Pkg|foomatic-db-nonfree}}, and {{Pkg|foomatic-filters}}''' - Foomatic 是一个基于数据库的,集成自由软件打印机驱动和脱机打印程序的系统。安装 foomatic-filters 可以解决 cups error_log 报告错误 "stopped with status 22!".
* '''hplip''' - HP GNU/Linux 驱动. 支持 DeskJet, OfficeJet, Photosmart, Business Inkjet 和一些 LaserJet printer 型的, 以及一些兄弟打印机。
+
* '''{{AUR|foo2zjs}}''' - Drivers for ZjStream protocol printers such as the HP Laserjet 1018. More info [http://foo2zjs.rkkda.com here], Foo2zsj is available in the {{AUR|foo2zjs}}.
* '''splix''' - 三星驱动,支持SPL打印机(SPL:Samsung Printer Language)  (USB打印机要配合使用 [[AUR]] 的 {{AUR|cups-usblp}} )
+
* '''{{Pkg|hplip}}''' - HP GNU/Linux 驱动. 支持 DeskJet, OfficeJet, Photosmart, Business Inkjet 和一些 LaserJet printer 型的, 以及一些兄弟打印机。
* '''ufr2''' - 佳能 UFR2 驱动,支持LBP, iR 和 MF 系列打印机. 在 [[AUR]] 能找到这个包。
+
* '''{{Pkg|splix}}''' - 三星驱动,支持SPL打印机(SPL:Samsung Printer Language)  (USB打印机要配合使用 [[AUR]] 的 {{AUR|cups-usblp}} )
* '''cups-pdf''' - PDF虚拟打印机,这个东西可以把发送给他的打印任务输出为PDF文件。
+
* '''{{AUR|ufr2}}''' - 佳能 UFR2 驱动,支持LBP, iR 和 MF 系列打印机. 在 [[AUR]] 能找到这个包。
 +
* '''{{Pkg|cups-pdf}}''' - PDF虚拟打印机,这个东西可以把发送给他的打印任务输出为PDF文件。
  
==下载PPD文件==
+
If unsure of what driver package to install or if the current driver is not working, it may be easiest to just install all of drivers, since some of the packages are misleading because printers of other makes may rely on them. For instance, the Brother HL-2140 needs the hplip driver installed.
 +
 
 +
====下载PPD文件====
  
 
取决于你的打印机,不一定需要进行这个步骤,如果没什么问题可以直接跳到下一节进行配置了。因为标准的CUPS安装已经携带了很多PPD(Postscript Printer Description)。 另外,''foomatic-filters'', ''gimp-print'' and ''hplip'' 已经自带了很多 PPD 文件,CUPS会自动检测他们.
 
取决于你的打印机,不一定需要进行这个步骤,如果没什么问题可以直接跳到下一节进行配置了。因为标准的CUPS安装已经携带了很多PPD(Postscript Printer Description)。 另外,''foomatic-filters'', ''gimp-print'' and ''hplip'' 已经自带了很多 PPD 文件,CUPS会自动检测他们.
 
  
 
这是一句来自 "Linux 打印网站" 的内容解释什么是 PPD 文件:
 
这是一句来自 "Linux 打印网站" 的内容解释什么是 PPD 文件:
 
:"''For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc.''"
 
:"''For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc.''"
 
  
 
如果打印机需要的PPD文件 ''不'' 在CUPS中, 那么:
 
如果打印机需要的PPD文件 ''不'' 在CUPS中, 那么:
Line 84: Line 55:
 
*浏览制造商的网站寻找GNU/Linux驱动程序。
 
*浏览制造商的网站寻找GNU/Linux驱动程序。
  
{{Note|PPD文件放在这个路径 {{ic|/usr/share/cups/model/}}}}
+
{{注意|PPD文件放在这个路径 {{ic|/usr/share/cups/model/}}}}
  
=配置=
+
==配置==
  
 
现在CUPS已经安装好了, 有很多选择可以供你安装一个打印机实例. 一直以来你都可以选用非常可靠的命令行的方式. 同样,Gnome和KDE也都提供了实用的用户界面的配置工具. 为了让最广大的群众方便地配置成功,本文将解释CUPS提供的web界面.
 
现在CUPS已经安装好了, 有很多选择可以供你安装一个打印机实例. 一直以来你都可以选用非常可靠的命令行的方式. 同样,Gnome和KDE也都提供了实用的用户界面的配置工具. 为了让最广大的群众方便地配置成功,本文将解释CUPS提供的web界面.
Line 92: Line 63:
 
如果你要连接到一个网络打印机而不是直接连到你机器上的, 你应该先读一读这一页 [[CUPS printer sharing]]. 在GNU/Linux系统间共享打印机非常简单,只需要少许配置,而在linux和Windows之间共享打印机就需要多费一些功夫了.
 
如果你要连接到一个网络打印机而不是直接连到你机器上的, 你应该先读一读这一页 [[CUPS printer sharing]]. 在GNU/Linux系统间共享打印机非常简单,只需要少许配置,而在linux和Windows之间共享打印机就需要多费一些功夫了.
  
==Kernel Modules==
+
USB printers can get accessed with two methods: The usblp kernel module and libusb. The former is the classic way. It is simple: Data is sent to the printer by writing it to a device file as a simple serial data stream. Reading the same device file allows bi-di access, at least for things like reading out ink levels, status, or printer capability information (PJL). It works very well for simple printers, but for multi-function devices (printer/scanner) it is not suitable and manufacturers like HP supply their own backends. (source: [http://lists.linuxfoundation.org/pipermail/printing-architecture/2012/002412.html here])
 +
 
 +
===Kernel Modules===
  
 
我们首先需要安装合适的内核模块才能使用web界面。以下是一些相关的步骤。
 
我们首先需要安装合适的内核模块才能使用web界面。以下是一些相关的步骤。
 +
 
根据你使用的不同内核,这些步骤不一定是必要的. 当你连上打印机时内核会自动加载合适的模块. 用 {{ic|tail}} 命令 (后文会说明) 看看打印机是否已经连上了。 {{ic|lsmod}} 命令可以查看哪些模块已经被加载了。
 
根据你使用的不同内核,这些步骤不一定是必要的. 当你连上打印机时内核会自动加载合适的模块. 用 {{ic|tail}} 命令 (后文会说明) 看看打印机是否已经连上了。 {{ic|lsmod}} 命令可以查看哪些模块已经被加载了。
  
 
===USB 打印机===
 
===USB 打印机===
USB printer users may need to blacklist the {{ic|usblp}} module. Keep in mind that there seems to be a lot of [http://bbs.archlinux.org/viewtopic.php?pid=660601 uncertainty] regarding blacklisting {{ic|usblp}}, as some USB printers, including some Canon and Epson printer series, are not recognized without it. Several user reported issues with Samsung printers when using {{ic|cups}} with blacklisted {{ic|usblp}} module, the solution was to re-enable {{ic|usblp}} and install {{ic|cups-usblp}} from aur instead of regular {{ic|cups}} package (https://bbs.archlinux.org/viewtopic.php?pid=778104)
+
USB printer users may need to blacklist the {{ic|usblp}} module. Keep in mind that there seems to be a lot of [https://bbs.archlinux.org/viewtopic.php?pid=660601 uncertainty] regarding blacklisting {{ic|usblp}}, as some USB printers, including some Canon and Epson printer series, are not recognized without it. Several user reported issues with Samsung printers when using {{ic|cups}} with blacklisted {{ic|usblp}} module, the solution was to re-enable {{ic|usblp}} and install {{ic|cups-usblp}} from aur instead of regular {{ic|cups}} package (https://bbs.archlinux.org/viewtopic.php?pid=778104)
  
 
To blacklist the module:
 
To blacklist the module:
Line 140: Line 114:
 
  MODULES=(!usbserial scsi_mod sd_mod snd-ymfpci snd-pcm-oss '''lp parport parport_pc''' ide-scsi)
 
  MODULES=(!usbserial scsi_mod sd_mod snd-ymfpci snd-pcm-oss '''lp parport parport_pc''' ide-scsi)
  
==CUPS daemon==
+
===CUPS 守护进程===
安装了合适的内核模块后(如果使用网络打印机,则可能不用安装内核模块),就可以启动CUPS服务了 ([[Daemon#Performing daemon actions manually|start the cupsd daemon]]). 添加'''cupsd'''到你的'''/etc/rc.conf''' ([[daemons#Starting on Boot|DAEMONS array]])。
+
相关的内核模块安装后,你就可以启动[[Daemon#Performing daemon actions manually|start the cupsd daemon]]。添加“cupsd”到你的[[daemons#Starting on Boot|DAEMONS array]]后它就可以开机自动启动。
DAEMONS=(... cupsd ...)
+
这样每次启动计算机时都会自动开启cupsd服务。
+
  
不需要重启,直接启动cupsd可以使用命令:
+
=== Web 接口和工具 ===
# rc.d start cupsd
+
  
== Web 接口和工具 ==
+
只要cupsd这个服务在线了, 你就可以打开浏览器前往: http://localhost:631 (''The '''localhost''' string may need to be replaced with the hostname found in'' {{ic|/etc/hostname}}).
  
只要cupsd这个服务在线了, 你就可以打开浏览器前往: http://localhost:631 (''The '''localhost''' string may need to be replaced with the hostname found in'' {{ic|/etc/hosts}}).
+
从这开始,跟着向导就可以一步步地添加打印机了. 一般的步骤是点击 ''Adding Printers and Classes'' -> ''Add Printer''.  提示需要用户名和密码时,使用root账户。然后让你填写的哪些描述性信息都无关紧要。紧接着,一个列表会提示你选择打印机型号。 Finally, choose the appropriate drivers and the configuration is complete.
 
+
从这开始,跟着向导就可以一步步地添加打印机了. 一般的步骤是点击 ''Adding Printers and Classes'' -> ''Add Printer''.  提示需要用户名和密码时,使用root账户。然后让你填写的哪些描述性信息都无关紧要。紧接着,一个列表会提示你选择打印机型号。如果同一打印机相同型号提供了多种驱动,可以各试一下看看哪个更好用。
+
  
 
配置好以后,点击 ''Maintenance'' 下拉菜单,然后点击 ''Print Test Page'' 打印一个测试页。如果打印不正常则说明存在一些配置的问题,问题很可能是选择的驱动不合适。
 
配置好以后,点击 ''Maintenance'' 下拉菜单,然后点击 ''Print Test Page'' 打印一个测试页。如果打印不正常则说明存在一些配置的问题,问题很可能是选择的驱动不合适。
Line 163: Line 132:
 
A user-name and password will be required when administering the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default user-name is the one assigned in the ''sys'' group, or root (change this by editing {{ic|/etc/cups/cupsd.conf}} in the line of ''SystemGroup'').  
 
A user-name and password will be required when administering the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default user-name is the one assigned in the ''sys'' group, or root (change this by editing {{ic|/etc/cups/cupsd.conf}} in the line of ''SystemGroup'').  
  
If the root account has been locked (i.e. when using sudo), it is not possible to log in the CUPS administration interface with the default user-name and password. In this case, follow [http://www.cups.org/articles.php?L237+T+Qprintadmin these instructions] on the CUPS FAQ.  You might also want to read [http://bbs.archlinux.org/viewtopic.php?id=35567 this post].
+
If the root account has been locked (i.e. when using sudo), it is not possible to log in the CUPS administration interface with the default user-name and password. In this case, follow [http://www.cups.org/articles.php?L237+T+Qprintadmin these instructions] on the CUPS FAQ.  You might also want to read [https://bbs.archlinux.org/viewtopic.php?id=35567 this post].
  
 
====Remote access to web interface====
 
====Remote access to web interface====
Line 217: Line 186:
 
This should avoid the error: 426 - Upgrade Required when using the CUPS web interface from a remote machine.
 
This should avoid the error: 426 - Upgrade Required when using the CUPS web interface from a remote machine.
  
=共享打印机=
+
==Troubleshooting==
 +
在‘/etc/cups/cupsd.conf’文件中设置‘LogLevel’是让打印机工作最好的方法:The best way to get printing working is to set 'LogLevel' in '/etc/cups/cupsd.conf' to:
 +
{{bc|
 +
LogLevel debug2
 +
}}
 +
然后像这样查看'/var/log/cups/error_log'文件的输出:And then viewing the output from '/var/log/cups/error_log' like this:
 +
{{bc|
 +
tail -n 100 -f /var/log/cups/error_log
 +
}}
 +
在输出中左边的字符排列如下:The characters at the left of the output stands for:
 +
{{bc|1=
 +
D = Debug
 +
E = Error
 +
I = Information
 +
等等...
 +
}}
 +
这些文件也可能被证明是有用的。These files may also prove useful.
 +
{{bc|
 +
/var/log/cups/page_log '每次打印成功后增加的词条spits out a new entry each time a print is successful.'
 +
/var/log/cups/access_log '所有活跃的cupsd http1.1服务器列表lists all cupsd http1.1 server activity'
 +
}}
  
==Linux共享给 Linux==
+
当然,如果想解决你的问题,重要的是知道CUPS怎样工作,这多多少少是正确的:Of course it's important to know how CUPS work if you want to solve your problems, this is somewhat correct:
  
Once you have CUPS setup on your Linux print server, sharing the printer with another Linux box is relatively easy. There are several ways to configure such a scenario, here we will describe the manual setup. On the server computer (the one managing and connecting to the printer) simply open up the <i>/etc/cups/cupsd.conf</i> file and allow access to the server by modifying the location lines. For instance:
+
# 当你选择‘打印’时,应用程序会发送一个.ps文件(PostScript,是主要用于电子产业和桌面出版领域的一种页面描述语言。)给CUPS(99%的程序会这样做)。An application sends a .ps file(PostScript, a script language that details how the page will look) to CUPS when you select 'print'(99% of apps do).
 +
# CUPS然后读取你打印机的PPD文件(打印机描述文件)并且计算出它需要哪种解释器去将.ps文件转换成一种打印机认识的语言(像PJL,PCL)。通常它需要ghostscript。CUPS then looks at your printers PPD file(printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands(like PJL,PCL). Usually it needs ghostscript.
 +
# GhostScript取得输入并且计算出它需要哪个过滤器,然后将它们转变成打印机能读懂的.ps格式。GhostScript takes the input and figures out which filters it should use,then applies them and converts the .ps file to a format understood by the printer.
 +
#然后它被发送到后端。举个例子,如果你有打印机连接到USB端口,它就用USB后端。 Then it is sent to the backend. For example, if you have your printer connected to a USB port, it uses the USB backend.
  
<pre>
+
打印一个文档并且查看'error_log'文件来得到关于打印队列更多的细节和正确地印象。Print a document and watch 'error_log' to get a more detailed and correct image of the printing process.
<Location />
+
===Problems resulting from upgrades===
  Order Deny,Allow
+
''Issues that appeared after CUPS and related program packages underwent a version increment''
  Deny From All
+
  Allow From 127.0.0.1
+
  Allow From 10.0.0.*
+
</Location>
+
</pre>
+
  
You will also need to make sure the server is listening on the IP address your client will be addressing. Add the following line after "Listen localhost:631":
+
====CUPS stops working====
 +
The chances are that a new configuration file is needed for the new version to work properly. Messages such as "404 - page not found" my result from trying to manage CUPS via localhost:631, for example.
  
<pre>
+
To use the new configuration, copy /etc/cups/cupsd.conf.default to /etc/cups/cupsd.conf (backup the old the configuration if needed):
Listen 10.0.0.1:631
+
# cp /etc/cups/cupsd.conf.default /etc/cups/cupsd.conf
</pre>
+
and restart CUPS to employ the new settings.
  
用你服务器的IP地址,替换掉“ 10.0.0.1”.
+
====Error with gnutls====
 +
If receiving errors such as:
 +
/usr/sbin/cupsd: error while loading shared libraries: libgnutls.so.13: cannot open shared object file: No such file or directory
 +
gnutls may be in need of updating:
 +
# pacman -S gnutls
  
Add the IP address of the client computer by doing Allow From client_ip_address. After you make your modifications, you will want to restart CUPS by doing:
+
After updating, there may be a file named {{ic|cupsd.conf.pacnew}} in {{ic|/etc/cups}}. This is the unmodified original configuration file that has been placed as part of the update. Compare it with the currently installed version and adjust to preference.
  
<pre>
+
====All jobs are "stopped"====
# /etc/rc.d/cupsd restart
+
If all jobs sent to the printer become "stopped", delete the printer and add it again.
</pre>
+
Using the [http://localhost:631 CUPS web interface], go to Printers > Delete Printer.
  
On the client side, open up <i>/etc/cups/client.conf</i> and edit the ServerName option to match the ip address or the name of your server.  For instance I named my server beast and have entry in my hosts file to point to it.  So in my <i>client.conf</i> file, I just edited this line ''Factory: I did not have to do this step with cups 1.3.7. Going to localhost:631 on the client and then manage printers works fine without ever creating this file.'':
+
To check the printer's settings go to ''Printers'', then ''Modify Printer''. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), and so on.
  
<pre>
+
====All jobs are "The printer is not responding"====
ServerName beast
+
On networked printers, you should check that the name that CUPS uses as its connection URI resolves to the printer's IP via DNS. E.g.
</pre>
+
If your printer's connection looks like this:
 +
lpd://BRN_020554/BINARY_P1
  
Next, run the following command to update the client computer''Factory: Same as the previous step... I did not have to do this.'':
+
then the hostname 'BRN_020554' needs to resolve to the printer's IP from the server running CUPS
  
<pre>
+
====The PPD version is not compatible with gutenprint====
# lpq
+
Run:
</pre>
+
# /usr/sbin/cups-genppdupdate
  
You should see something like this:
+
And restart CUPS (as pointed out in gutenprint's post-install message)
  
<pre>
+
===Other===
ml1250 is ready
+
no entries
+
</pre>
+
  
 +
=====CUPS permission errors=====
 +
*Some users fixed 'NT_STATUS_ACCESS_DENIED' (Windows clients) errors by using a slightly different syntax:
 +
smb://workgroup/username:password@hostname/printer_name
  
There are more configuration possibilities including an automatic configuration which are described in detail on http://localhost:631/sam.html#CLIENT_SETUP (this link works on your printer server). ''Factory: This link brings the user to a "404 Not Found" page.''
+
*Sometimes, the block device has wrong permissions:
 +
# ls /dev/usb/
 +
lp0
 +
# chgrp lp /dev/usb/lp0
  
when prompted for username and password use root to access
+
====HPLIP printer sends "/usr/lib/cups/backend/hp failed" error====
then follow the instructions from here
+
Make sure dbus is installed and running, e.g. check DAEMONS in {{ic|/etc/rc.conf}} or run {{ic|ls /var/run/daemons}}.
http://www.digitalhermit.com/linux/printing/
+
if its a TCP/IP printer use Jetdirect
+
  
That's it for Linux to Linux printer sharing.
+
The avahi-daemon might be required if this error persists and the dbus is already running.
  
==Linux 共享给 Windows==
+
====hp-toolbox sends an error, "Unable to communicate with device"====
 +
If running hp-toolbox as a regular user results in:
 +
# hp-toolbox
 +
# error: Unable to communicate with device (code=12): hp:/usb/<printer id>
 +
or, "{{ic|Unable to communicate with device"}}", then it may be needed to add the user to the lp group by running the following command:
 +
# gpasswd -a <username> lp
  
If you are connected to a Windows print server (or any other Samba capable print server), you can skip the section about kernel modules and such. All you have to do is start the CUPS daemon and complete the web interface as specified in section 3.3 and 3.4.  Before this, you need to activate the Samba CUPS backend.  You can do this by entering the following command:
+
This can also be caused by printers such as the P1102 that provide a virtual cd-rom drive for MS-Windows drivers. The lp dev appears and then disappears. In that case try the '''usb-modeswitch''' and '''usb-modeswitch-data''' packages, that lets one switch off the "Smart Drive" (udev rules included in said packages).
  
<pre>
+
====CUPS returns '"foomatic-rip" not available/stopped with status 3' with a HP printer====
# ln -s `which smbspool` /usr/lib/cups/backend/smb
+
If receiving any of the following error messages in {{ic|/var/log/cups/error_log}} while using a HP printer, with jobs appearing to be processed while they all end up not being completed with their status set to 'stopped':
</pre>
+
Filter "foomatic-rip" for printer "<printer_name>" not available: No such file or director
 +
or:
 +
PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!
 +
make sure '''hplip''' has been installed, in addition to [[#Packages|the packages mentioned above]], '''net-snmp''' is also needed. See [https://bbs.archlinux.org/viewtopic.php?id=65615 this forum post].
 +
# pacman -S hplip
  
Note that the symbol before is ` (underneath the ~ on a standard US keyboard) and not '.  After this, you will have to restart CUPS using the command specified in the previous section. Next, simply login into the CUPS web interface and choose to add a new printer. For device, there should be an option that says something to the effect Windows Printer Via Samba near the button of the device list. For the device location enter:
+
====Printing fails with unauthorised error====
 +
If the user has been added to the lp group, and allowed to print (set in {{ic|cupsd.conf}}), then the problem lies in {{ic|/etc/cups/printers.conf}}. This line could be the culprit:
 +
  AuthInfoRequired negotiate
  
<pre>
+
Comment it out and restart CUPS.
smb://username:password@hostname/printer_name
+
</pre>
+
  
Or without a password:
+
====Print button greyed-out in GNOME print dialogs====
 +
:''<small>Source: [https://bbs.archlinux.org/viewtopic.php?id=70418 I can't print from gnome applications. - Arch Forums]</small>''
  
<pre>
+
Be sure the package: '''libgnomeprint''' is installed
smb://username@hostname/printer_name
+
</pre>
+
  
Make sure that the user actually has access to the printer on Windows computer. Select the appropriate drivers and that's about it. If the computer is located on a domain, make sure the username includes the domain:
+
Edit {{ic|/etc/cups/cupsd.conf}} and add
  smb://username:password@domain/hostname/printer_name
+
  # HostNameLookups Double
  
Note: if your network contains many printers use "lpoptions -d your_desired_default_printer_name" to set your preferred printer
+
Restart CUPS:
 +
# /etc/rc.d/cupsd restart
  
Note: I, thepizzaking, was having 'NT_STATUS_ACCESS_DENIED' errors and to fix them I needed to use a slightly different syntax:
+
====Unknown supported format: application/postscript====
<pre>
+
Comment the lines:
smb://workgroup/username:password@hostname/printer_name
+
application/octet-stream        application/vnd.cups-raw        0      -
</pre>
+
from {{ic|/etc/cups/mime.convs}}, and:
 +
application/octet-stream
 +
in {{ic|/etc/cups/mime.types}}.
  
==Windows 共享给 Linux==
+
====Finding URIs for Windows Print Servers====
  
有时,我们需要允许一台装windows系统的电脑连接到一台linux电脑上.方法有很多种,最常用的就是使用Samba.编辑samba配置文件 <i>/etc/samba/smb.conf</i> ,使其允许控制打印机。修改后的smb.conf 看起来如下:
+
Sometimes Windows is a little less than forthcoming about exact device URIs (device locations). If having trouble specifying the correct device location in CUPS, run the following command to list all shares available to a certain windows username:
 +
$ smbtree -U ''windowsusername''
 +
This will list every share available to a certain Windows username on the local area network subnet, as long as Samba is set up and running properly. It should return something like this:
 +
{{bc| WORKGROUP
 +
\\REGULATOR-PC 
 +
\\REGULATOR-PC\Z             
 +
\\REGULATOR-PC\Public       
 +
\\REGULATOR-PC\print$        Printer Drivers
 +
\\REGULATOR-PC\G             
 +
\\REGULATOR-PC\EPSON Stylus CX8400 Series EPSON Stylus CX8400 Series}}
 +
What is needed here is first part of the last line, the resource matching the printer description.  So to print to the EPSON Stylus printer, one would enter:
 +
smb://username.password@REGULATOR-PC/EPSON Stylus CX8400 Series
 +
as the URI into CUPS.  Notice that whitespaces are allowed in URIs, whereas backslashes get replaced with forward slashes.
  
<pre>
+
====Print-Job client-error-document-format-not-supported====
[global]
+
Try installing the foomatic packages and use a foomatic driver.
workgroup = Heroes
+
server string = Arch Linux Print Server
+
security = user
+
  
[printers]
+
====/usr/lib/cups/backend/hp failed====
    comment = All Printers
+
Change
    path = /var/spool/samba
+
  SystemGroup sys root
    browseable = yes
+
to
    # to allow user 'guest account' to print.
+
  SystemGroup lp root
    guest ok = no
+
in /etc/cups/cupsd.conf
    writable = no
+
    printable = yes
+
    create mode = 0700
+
    write list = @adm root neocephas
+
</pre>
+
  
如果只是给单一用户,下面的应该就足够了:
 
  
<pre>
+
Following steps 1-3 in the Alternative CUPS interfaces below may be a better solution, since newer versions of cups will not allow the same group for both normal and admin operation.
[ML1250]
+
    comment = Samsung ML-1250 Laser Printer
+
    printer=ml1250
+
    path = /var/spool/samba
+
    printing = cups
+
    printable = yes
+
    printer admin = @admin root neocephas
+
    user client driver = yes
+
    # to allow user 'guest account' to print.
+
    guest ok = no
+
    writable = no
+
    write list = @adm root neocephas
+
    valid users = @adm root neocephas
+
</pre>
+
  
Please note that in my configuration I made it so that users must have a valid account to access the printer.  To have a public printer, set guest ok to yes, and remove the valid users line.  To add accounts, you must setup a regular Linux account and then setup a Samba password on the server.  For instance:
+
====Samsung Printer won't print certain documents====
  
<pre>
+
Your Samsung printer may work fine with {{ic|cups}} refuse to print certain documents (Inkscape file with text) and even crash completely, causing a restart. The solution is to use mentioned the {{pkg|cups-usblp}} package and to blacklist the {{ic|usblp}} module as described in this article.
# useradd neocephas
+
# smbpasswd -a neocephas
+
</pre>
+
  
After setting up any user accounts that you need, you will also need to set up the samba spool folder:
+
====Local USB printer does not show up====
 +
In case your printer does not show up you might need to replace cups with cups-usblp from AUR. Then try it again, once with the usblp module loaded and once with the module blacklisted.
  
<pre>
+
===="Unable to get list of printer drivers"====
# mkdir /var/spool/samba
+
Try to remove Foomatic drivers.
# chmod 777 /var/spool/samba
+
</pre>
+
  
The next items that need changing are /etc/cups/mime.convs and /etc/cups/mime.types:
+
==Appendix==
  
mime.convs:
+
===Alternative CUPS interfaces===
<pre>
+
If using [[GNOME]], a possibility is to manage and configure the printer by using system-config-printer-gnome. This package is available through pacman:
# The following line is found at near the end of the file. Uncomment it.
+
# pacman -S system-config-printer-gnome
application/octet-stream        application/vnd.cups-raw        0      -
+
</pre>
+
  
mime.types:
+
For system-config-printer to work as it should, running as root may be required, or alternatively set up a "normal" user to administer CUPS (if so '''follow steps 1-3''')
<pre>
+
# Again near the end of the file.
+
application/octet-stream
+
</pre>
+
  
The changes to mime.convs and mime.types are needed to make CUPS print Microsoft Office document files. Many people seem to need that.
+
* 1. Create group, and add a user to it
 +
# groupadd lpadmin
 +
# usermod -aG lpadmin <username>
  
After this restart your Samba daemon:
+
* 2. Add "lpadmin" (without the quotes) to this line in {{ic|/etc/cups/cupsd.conf}}
 +
SystemGroup sys root <insert here>
  
<pre>
+
* 3. Restart cups, log out and in again (or restart computer)
# /etc/rc.d/samba restart
+
{{bc|# rc.d restart cupsd}}
</pre>
+
  
Obvious, there are a lot of tweaks and customization that can be done with setting up a Samba print server, so I advise you to look at the Samba and CUPS documentation for more help.  The <i>smb.conf.example</i> file also has some good samples to that you might want to look at.
+
[[KDE]] users can modify their printers from the Control Center. Both should refer to those desktop environments' documentation for more information on how to use the interfaces.
  
==Windows 2000 and Windows XP to Linux==
+
There is also [https://aur.archlinux.org/packages.php?ID=43505 gtklp] in the [[AUR]]
  
For the most modern flavors of Windows an alternative way of connecting to your Linux printer server is to use the CUPS protocol directly.  The Windows client will need to be using Windows 2000 or Windows XP. Make sure you allows the clients to access the print server by editing the location settings as specified in section 4.1.
+
==PDF virtual printer==
 +
CUPS-PDF is a nice package that allows one to setup a virtual printer that will generate a PDF from anything sent to it. This package is not necessary, but it can be quite useful. It can be installed using the following command:
 +
  # pacman -S cups-pdf
  
On the Windows computer, go to the printer control panel and choose to Add a New Printer. Next, choose to give an url.  For the url type in the location of your printer:
+
After installing the package, set it up as if it were for any other printer by using the web interface. Access the cups print manager: http://localhost:631 and select:
 +
Administration -> Add Printer
 +
  Select CUPS-PDF (Virtual PDF), choose for the make and driver:
 +
Make: Generic
 +
Driver: Generic CUPS-PDF Printer
  
<i>http://host_ip_address:631/printers/printer_name</i>
+
Find generated PDF documents in a sub-directory located at {{ic|/var/spool/cups-pdf}}. Normally, the subdirectory is named after the user who performed the job. A little tweak helps you to find your printed PDF documents more easily. Edit {{ic|/etc/cups/cups-pdf.conf}} by changing the line
 
+
#Out /var/spool/cups-pdf/${USER}
where host_ip_address is the Linux server's IP address and printer_name is the name of the printer you are connecting to.  After this, install the printer drivers for the Windows computer.  If you setup the CUPS server to use its own printer drivers, then you can just select a generic postscript printer for the Windows client.  You can then test your print setup by printing a test page.
+
 
+
==Others to Linux, Linux to others==
+
 
+
More information on interfacing CUPS with other printing systems can be found in the CUPS manual, e.g. on http://localhost:631/sam.html#PRINTING_OTHER
+
 
+
=Appendix=
+
 
+
==Alternative CUPS Interfaces==
+
A Pygtk CUPS configuration program from Red Hat is also available in the "community" repository:
+
 
+
pacman -S system-config-printer
+
 
+
You can also try hal-cups-utils, also from community:
+
 
+
pacman -S hal-cups-utils
+
 
+
KDE users can modify their printers from the Control Center.  Refer the KDE documentation for more information on how to use the interface.
+
 
+
There is also gtklp for handling print jobs. It is in the "extra" repository.
+
 
+
pacman -S gtklp
+
 
+
==PDF Virtual Printer==
+
 
+
A nice little package that I submitted to the incoming folder (ftp://ftp.archlinux.org/incoming) is CUPS-PDF.  This package allows one to setup a virtual printer that will generate a PDF from anything sent to it.  For example, I wrote this document in AbiWord and then printed it to the Virtual Printer which generated a pdf in my <i>/var/spool/cups-pdf/neocephas</i> folder. Obviously, this package is not necessary, but it can be quite useful.  After downloading the package from the ftp server and installing it, you can set it up as you would for any other printer in the web interface.  Select Virtual PDF Printer as the device and choose Postscript -> Postscript Color Printer for the drivers.
+
 
+
==Online Resources==
+
 
+
Here is a listing of websites that may be of use to you:
+
 
+
* <b>Official CUPS documentation on your computer</b> http://localhost:631/help.html
+
* <b>Official CUPS Website</b> - http://www.cups.org/
+
* <b>Linux Printing</b> - http://www.linuxprinting.org/
+
* <b>Tips and Suggestions on common CUPS problems</b> - http://home.nyc.rr.com/computertaijutsu/cups.html
+
* <b>Gentoo's Printing Guide</b> - http://www.gentoo.org/doc/en/printing-howto.xml
+
* <b>Arch Linux User Forums</b> - http://bbs.archlinux.org/
+
* [http://uniteddigitalsolutions.com/?page=prcat&cid=83 Minolta toner cartridge]
+
* [http://uniteddigitalsolutions.com/index.php?page=prcat&cid=91 Tektronix print cartridge]
+
* [http://uniteddigitalsolutions.com/?page=prcat&cid=87 Pitney Bowes ink cartridge]
+
 
+
==Specialized Cases==
+
 
+
This section is dedicated to specific problems and their solutions. If you managed to get some <i>unusual</i> printer working, please put the solution here.
+
 
+
===Printing does not work/aborts with the HP Deskjet 700 Series Printers.===
+
 
+
*The solution is to install <b>pnm2ppa</b> printer filter for the HP Deskjet 700 series. Without this the print jobs will be aborted by the system.  A [[ABS - The Arch Build System | PKGBUILD]] for pnm2ppa can be found in [http://aur.archlinux.org/packages.php?do_Details=1&ID=696&O=0&L=0&C=0&K=pnm&SB=n&SO=a&PP=25&do_MyPackages=0&do_Orphans=0 AUR].
+
 
+
===Getting HP LaserJet 1010 to work===
+
I had to compile ghostscript myself because ESP gs in rep was 7.07 and had not fixed some bugs like ESP 8.15.1 had. I never downloaded 'foomatic' in rep. I think that is an old package.
+
<pre>
+
$ pacman -Qs cups a2ps psutils foo ghost
+
local/cups 1.1.23-3
+
    The CUPS Printing System
+
local/a2ps 4.13b-3
+
    a2ps is an Any to PostScript filter
+
local/psutils p17-3
+
    A set of postscript utilities.
+
local/foomatic-db 3.0.2-1
+
    Foomatic is a system for using free software printer drivers with common
+
    spoolers on Unix
+
local/foomatic-db-engine 3.0.2-1
+
    Foomatic is a system for using free software printer drivers with common
+
    spoolers on Unix
+
local/foomatic-db-ppd 3.0.2-1
+
    Foomatic is a system for using free software printer drivers with common
+
    spoolers on Unix
+
local/foomatic-filters 3.0.2-1
+
    Foomatic is a system for using free software printer drivers with common
+
    spoolers on Unix
+
local/espgs 8.15.1-1
+
    ESP Ghostscript
+
</pre>
+
I also had to set LogLevel in /etc/cups/cupsd.conf to debug2 before i saw that I missed some "Nimbus" fonts. Then I had to rename & put them where the log told me to. Some fancy google searching had to be applied, example: http://www.google.com/search?q=n019003l+filetype%3Apfb since the fonts turned out to be proprietary (i'm sure windows comes with these default). Nevertheless after downloading them(about 7 fonts) and putting them in the correct folder printing started working.
+
 
+
Before that i were getting all the errors said here: http://linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_1010 'Unsupport PCL' etc...
+
 
+
I'm sure it could have worked with ESP gs 7.07 too(in rep) if i was smart enough to turn on DebugLevel2 sooner :/ UPDATE: yeah it did... maybe this info is useful for someone else though.. sorry for the inconvenience.
+
 
+
===Getting HP LaserJet 1020 to work===
+
After a lot of tries with hplib and gutenprint I finally found the solution to get my printer HP Laserjet 1020 printing.
+
 
+
First of all you only need to install cups and ghostscript. Then follow the link on http://www.linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_1020 to the http://foo2zjs.rkkda.com/ printer driver page and follow the install instructions. Log in as root. After you downloaded the package and extracted the archive, change into the foo2zjs directory. Now you can follow the original installation instructions with a minor modification to change the userid for printing:<br />
+
 
+
$ make
+
$ ./getweb 1020
+
+
Open the ''Makefile''
+
$ nano Makefile
+
and search for the line
+
# LPuid=-olp
+
and modify it to
+
# LPuid=-oroot
+
then continue with the script
+
$ make install
+
$ make install-hotplug
+
$ make cups
+
 
+
Or you can use the package foo2zjs from AUR and modify the PKGBUILD: change the line
+
 
+
./getweb all
+
  
 
to
 
to
  
  ./getweb 1020
+
  Out ${HOME}
 
+
(or if you're setting another printer change this line to what you need).
+
 
+
As a last step add and configure the printer in the CUPS manager. The printer should be recognized automatically. It works fine for root and all users. When booting the operating system, the printer is initialized and indicates its working.
+
 
+
=== Printer connected to an Airport Express Station ===
+
The first thing to do is to scan the airport express station. It
+
seems that there are different addresses depending on the model.
+
<pre>
+
[root@somostation somos]# nmap 192.168.0.4
+
 
+
Starting Nmap 4.20 ( http://insecure.org ) at 2007-06-26 00:50 CEST
+
Interesting ports on 192.168.0.4:
+
Not shown: 1694 closed ports
+
PORT      STATE SERVICE
+
5000/tcp  open  UPnP
+
9100/tcp  open  jetdirect
+
10000/tcp open  snet-sensor-mgmt
+
MAC Address: 00:14:51:70:D5:66 (Apple Computer)
+
 
+
Nmap finished: 1 IP address (1 host up) scanned in 25.815 seconds
+
</pre>
+
With my station the port is 9100. The airport station is accessed like
+
an HP JetDirect printer.
+
After, you can edit your printer.conf file in this way:
+
<pre>
+
# Printer configuration file for CUPS v1.2.11
+
# Written by cupsd on 2007-06-26 00:44
+
<Printer LaserSim>
+
Info SAMSUNG ML-1510 gdi
+
Location SomoStation
+
DeviceURI socket://192.168.0.4:9100
+
State Idle
+
StateTime 1182811465
+
Accepting Yes
+
Shared Yes
+
JobSheets none none
+
QuotaPeriod 0
+
PageLimit 0
+
KLimit 0
+
OpPolicy default
+
ErrorPolicy stop-printer
+
</Printer>
+
</pre>
+
It should work. I had a few problems. There were resolved by removing foomatic and installing foomatic-db, foomatic-db-engine, foomatic-db-ppd instead.
+
 
+
===Performing Utility Functions on Epson Printers===
+
 
+
====Escputil====
+
 
+
Here we explain how to perform some of the utility functions such as nozzle cleaning and nozzle checks on Epson printers. We will use the escputil utility, which is part of the gutenprint package.
+
 
+
There is a man page ("man escputil") that provides pretty good information, but it does not include necessary information on how to identify your printer. There are two parameters that can be used. One is --printer; what it expects is the name you used to identify your printer when you configured it. The other is --raw-device. What this option expects is is something beginning with "/dev". If your printer is a serial printer, and the only serial printer, it is "/dev/lp0". If it is an usb printer, it is "/dev/usb/lp0". If you have more than one printer, they will have names ending in "lp1", "lp2", etc.
+
 
+
* To clean the printer heads:
+
 
+
  escputil -u --clean-head
+
 
+
* To prints the nozzle-check pattern, allowing you to verify that the previous head cleaning worked. (Or to determine that you need to clean the heads)
+
 
+
  escputil -u --nozzle-check
+
 
+
If you want to perform an operation that requires 2-way communication with a printer, you must use the "--raw-device" specification, and your user must root or be a member of the group "lp".
+
 
+
* The following is an example of getting the printer's internal identification:
+
 
+
  sudo escputil --raw-device=/dev/usb/lp0 --identify
+
 
+
* To prints out the ink levels of the printer:
+
 
+
  sudo escputil --raw-device=/dev/usb/lp0 --ink-level
+
 
+
====Mtink====
+
 
+
This is a printer status monitor which enables to get the remaining ink quantity, to print test patterns, to reset printer and to clean nozzle. It use an intuitive graphical user interface. Package can be downloaded from [http://aur.archlinux.org/packages.php?do_Details=1&ID=476&O=0&L=0&C=0&K=mtink&SB=n&SO=a&PP=25&do_MyPackages=0&do_Orphans=0&SeB=nd AUR].
+
 
+
==Another Source for Printer Drivers==
+
 
+
On <i>http://www.turboprint.de/english.html</i> is a really good printer driver for many printers not yet supported by Linux (especially Canon i*). The only problem is that high-quality-prints are either marked with a turboprint-logo or you have to pay for it... It's not Open-Source.
+
 
+
{{Wikipedia|Common_Unix_Printing_System}}
+
 
+
=Troubleshooting=
+
==As a result of upgrade==
+
 
+
===Error with gnutls===
+
After updating, if you get something like :
+
  /usr/sbin/cupsd: error while loading shared libraries: libgnutls.so.13: cannot open shared object file: No such file or directory
+
 
+
You need to update gnutls:
+
 
+
  pacman -S gnutls
+
  
In addition, in /etc/cups, there will be a file named cupsd.conf.pacnew. Rename it cupsd.conf.
+
=== Print to PostScript ===
 +
The CUPS-PDF (Virtual PDF Printer) actually creates a PostScript file and then creates the PDF using the ps2pdf utility. To print to PostScript, just print as usual, in the print dialog choose "CUPS-PDF" as the printer, then select the checkbox for "print to file", hit print, enter the filename.ps and click save. This is handy for faxes, etc...
  
===All jobs are "stopped"===
+
===Another source for printer drivers===
After updating CUPS, if all jobs sent to the printer become "stopped", delete the printer and add it again.
+
[http://www.turboprint.de/english.html Turboprint] is a proprietary driver for many printers not yet supported by GNU/Linux (Canon i*, for example). Unlike CUPS, however, high quality prints are either marked with a watermark or are a pay-only service.
Using the CUPS web interface (http://localhost:631), go to Printers > Delete Printer.
+
  
''Note:'' If you don't remember your printer's settings, go to Printers > Modify Printer. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), etc.
+
==Resources==
 +
* [http://localhost:631/documentation.html Official CUPS documentation], ''locally installed''
 +
* [http://www.cups.org/ Official CUPS Website]
 +
* [http://www.linuxprinting.org/ Linux Printing], ''[http://www.linuxfoundation.org The Linux Foundation]''
 +
* [http://www.gentoo.org/doc/en/printing-howto.xml Gentoo's Printing Guide], ''[http://www.gentoo.org/doc/en  Gentoo Documentation Resources]''
 +
* [https://bbs.archlinux.org/ Arch Linux User Forums]

Revision as of 01:56, 4 March 2013

Tango-preferences-desktop-locale.png本页面需要更新翻译,内容可能已经与英文脱节。要贡献翻译,请访问简体中文翻译组Tango-preferences-desktop-locale.png

附注: please use the first argument of the template to provide more detailed indications.

来自 CUPS' site:

"CUPS 是苹果公司为Mac OS® X 和其他类 UNIX® 的操作系统开发的基于标准的、开源的打印系统".

虽然有其他的打印程序包例如LPRNG,但CUPS是相当流行和相对容易使用的。它是Arch linux及许多其他Linux发行版缺省的打印系统。

安装 CUPS

首先要安装这3个包cups, ghostscript,以及 gsfonts,从官方软件仓库安装它们。

如果正常的cups不起作用,你可以试试从 AUR 安装 cups-usblpAUR

  • cups - 就是传说中的CUPS软件
  • ghostscript - Postscript语言的解释器
  • gsfonts - Ghostscript标准Type1字体
  • hpoj - 如果你使用 HP Officejet, 你应该再安装这个包,遵循指导避免发生错误. 更多信息见 thread at launchpad/hplip.

如果你的系统要通过 Samba 使用网络打印机,或者这台机器要作为打印服务器向其它windows客户端提供服务,你还需要安装samba.

打印机驱动

这是一些驱动包。根据你的打印机选择合适的包安装。

  • gutenprint - 一组质量非常好的驱动集合,支持的目标机型包括 Canon, Epson, Lexmark, Sony, Olympus;以及配合CUPS/GhostSscript/Foomatic/GIMP使用的 PCL printers。
  • foomatic-db, foomatic-db-engine,foomatic-db-nonfree, and foomatic-filters - Foomatic 是一个基于数据库的,集成自由软件打印机驱动和脱机打印程序的系统。安装 foomatic-filters 可以解决 cups error_log 报告错误 "stopped with status 22!".
  • foo2zjsAUR - Drivers for ZjStream protocol printers such as the HP Laserjet 1018. More info here, Foo2zsj is available in the foo2zjsAUR.
  • hplip - HP GNU/Linux 驱动. 支持 DeskJet, OfficeJet, Photosmart, Business Inkjet 和一些 LaserJet printer 型的, 以及一些兄弟打印机。
  • splix - 三星驱动,支持SPL打印机(SPL:Samsung Printer Language) (USB打印机要配合使用 AURcups-usblpAUR )
  • ufr2AUR - 佳能 UFR2 驱动,支持LBP, iR 和 MF 系列打印机. 在 AUR 能找到这个包。
  • cups-pdf - PDF虚拟打印机,这个东西可以把发送给他的打印任务输出为PDF文件。

If unsure of what driver package to install or if the current driver is not working, it may be easiest to just install all of drivers, since some of the packages are misleading because printers of other makes may rely on them. For instance, the Brother HL-2140 needs the hplip driver installed.

下载PPD文件

取决于你的打印机,不一定需要进行这个步骤,如果没什么问题可以直接跳到下一节进行配置了。因为标准的CUPS安装已经携带了很多PPD(Postscript Printer Description)。 另外,foomatic-filters, gimp-print and hplip 已经自带了很多 PPD 文件,CUPS会自动检测他们.

这是一句来自 "Linux 打印网站" 的内容解释什么是 PPD 文件:

"For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc."

如果打印机需要的PPD文件 在CUPS中, 那么:

  • AUR 寻找为打印机/制造商提供的包。
  • 去这个网站 OpenPrinting database 选择你需要的制造商和型号。
  • 浏览制造商的网站寻找GNU/Linux驱动程序。
注意: PPD文件放在这个路径 /usr/share/cups/model/

配置

现在CUPS已经安装好了, 有很多选择可以供你安装一个打印机实例. 一直以来你都可以选用非常可靠的命令行的方式. 同样,Gnome和KDE也都提供了实用的用户界面的配置工具. 为了让最广大的群众方便地配置成功,本文将解释CUPS提供的web界面.

如果你要连接到一个网络打印机而不是直接连到你机器上的, 你应该先读一读这一页 CUPS printer sharing. 在GNU/Linux系统间共享打印机非常简单,只需要少许配置,而在linux和Windows之间共享打印机就需要多费一些功夫了.

USB printers can get accessed with two methods: The usblp kernel module and libusb. The former is the classic way. It is simple: Data is sent to the printer by writing it to a device file as a simple serial data stream. Reading the same device file allows bi-di access, at least for things like reading out ink levels, status, or printer capability information (PJL). It works very well for simple printers, but for multi-function devices (printer/scanner) it is not suitable and manufacturers like HP supply their own backends. (source: here)

Kernel Modules

我们首先需要安装合适的内核模块才能使用web界面。以下是一些相关的步骤。

根据你使用的不同内核,这些步骤不一定是必要的. 当你连上打印机时内核会自动加载合适的模块. 用 tail 命令 (后文会说明) 看看打印机是否已经连上了。 lsmod 命令可以查看哪些模块已经被加载了。

USB 打印机

USB printer users may need to blacklist the usblp module. Keep in mind that there seems to be a lot of uncertainty regarding blacklisting usblp, as some USB printers, including some Canon and Epson printer series, are not recognized without it. Several user reported issues with Samsung printers when using cups with blacklisted usblp module, the solution was to re-enable usblp and install cups-usblp from aur instead of regular cups package (https://bbs.archlinux.org/viewtopic.php?pid=778104)

To blacklist the module:

/etc/modprobe.d/blacklist.conf
blacklist usblp

Custom kernel users may need to manually load the usbcore module before proceeding:

# modprobe usbcore

Once the modules are installed, plug in the printer and check if the kernel detected it by running the following:

# tail /var/log/messages.log

or

# dmesg

If you're using usblp, the output should indicate that the printer has been detected like so:

Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E
Feb 19 20:17:11 kernel: usb.c: usblp driver claimed interface cfef3920
Feb 19 20:17:11 kernel: printer.c: v0.13: USB Printer Device Class driver

If you blacklisted usblp, you will see something like:

usb 3-2: new full speed USB device using uhci_hcd and address 3
usb 3-2: configuration #1 chosen from 1 choice

Parallel port printers

To use a parallel port printer the configuration is pretty much the same, except for the modules:

# modprobe lp
# modprobe parport
# modprobe parport_pc

Once again, check the setup by running:

# tail /var/log/messages.log

It should display something like this:

lp0: using parport0 (polling).

If you are using a USB to parallel port adapter, CUPS will not be able to detect the printer. As a workaround, add the printer using a different connection type and then change DeviceID in /etc/cups/printers.conf:

DeviceID = parallel:/dev/usb/lp0

Auto-loading

It is convenient to have the system automatically load the kernel module every time the it starts up. To do so, use a text editor to open up /etc/rc.conf and add the appropriate module to the MODULES=() line. Here is an example:

MODULES=(!usbserial scsi_mod sd_mod snd-ymfpci snd-pcm-oss lp parport parport_pc ide-scsi)

CUPS 守护进程

相关的内核模块安装后,你就可以启动start the cupsd daemon。添加“cupsd”到你的DAEMONS array后它就可以开机自动启动。

Web 接口和工具

只要cupsd这个服务在线了, 你就可以打开浏览器前往: http://localhost:631 (The localhost string may need to be replaced with the hostname found in /etc/hostname).

从这开始,跟着向导就可以一步步地添加打印机了. 一般的步骤是点击 Adding Printers and Classes -> Add Printer. 提示需要用户名和密码时,使用root账户。然后让你填写的哪些描述性信息都无关紧要。紧接着,一个列表会提示你选择打印机型号。 Finally, choose the appropriate drivers and the configuration is complete.

配置好以后,点击 Maintenance 下拉菜单,然后点击 Print Test Page 打印一个测试页。如果打印不正常则说明存在一些配置的问题,问题很可能是选择的驱动不合适。

Tip: See: #Alternative CUPS interfaces for other other frontends.
Note: When setting up a USB printer, you should see your printer listed on Add Printer page. If you can only see a "SCSI printer" option, it probably means that CUPS has failed to recognize your printer.

CUPS administration

A user-name and password will be required when administering the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default user-name is the one assigned in the sys group, or root (change this by editing /etc/cups/cupsd.conf in the line of SystemGroup).

If the root account has been locked (i.e. when using sudo), it is not possible to log in the CUPS administration interface with the default user-name and password. In this case, follow these instructions on the CUPS FAQ. You might also want to read this post.

Remote access to web interface

By default, the CUPS web interface can only be accessed by the localhost; i.e. the computer that it is installed on. To remotely access the interface, make the following changes to the /etc/cups/cupsd.conf file. Replace the line:

Listen localhost:631

with

port 631

so that CUPS listens to incoming requests.

Three levels of access can be granted:

<Location />           #access to the server
<Location /admin>	#access to the admin pages
<Location /admin/conf>	#access to configuration files

To give remote hosts access to one of these levels, add an Allow statement to that level's section. An Allow statement can take one or more of the forms listed below:

Allow all
Allow host.domain.com
Allow *.domain.com
Allow ip-address
Allow ip-address/netmask

Deny statements can also be used. For example, if wanting to give all hosts on the 192.168.1.0/255.255.255.0 subnet full access, file /etc/cups/cupsd.conf would include this:

# Restrict access to the server...
# By default only localhost connections are possible
<Location />
   Order allow,deny
   Allow From localhost
   Allow From 192.168.1.0/255.255.255.0
</Location>

# Restrict access to the admin pages...
<Location /admin>
   # Encryption disabled by default
   #Encryption Required
   Order allow,deny
   Allow From localhost
   Allow From 192.168.1.0/255.255.255.0
</Location>

# Restrict access to configuration files...
<Location /admin/conf>
   AuthType Basic
   Require user @SYSTEM
   Order allow,deny
   Allow From localhost
   Allow From 192.168.1.0/255.255.255.0
</Location>

You might also need to add:

DefaultEncryption Never

This should avoid the error: 426 - Upgrade Required when using the CUPS web interface from a remote machine.

Troubleshooting

在‘/etc/cups/cupsd.conf’文件中设置‘LogLevel’是让打印机工作最好的方法:The best way to get printing working is to set 'LogLevel' in '/etc/cups/cupsd.conf' to:

LogLevel debug2

然后像这样查看'/var/log/cups/error_log'文件的输出:And then viewing the output from '/var/log/cups/error_log' like this:

tail -n 100 -f /var/log/cups/error_log

在输出中左边的字符排列如下:The characters at the left of the output stands for:

D = Debug
E = Error
I = Information
等等...

这些文件也可能被证明是有用的。These files may also prove useful.

/var/log/cups/page_log '每次打印成功后增加的词条spits out a new entry each time a print is successful.'
/var/log/cups/access_log '所有活跃的cupsd http1.1服务器列表lists all cupsd http1.1 server activity'

当然,如果想解决你的问题,重要的是知道CUPS怎样工作,这多多少少是正确的:Of course it's important to know how CUPS work if you want to solve your problems, this is somewhat correct:

  1. 当你选择‘打印’时,应用程序会发送一个.ps文件(PostScript,是主要用于电子产业和桌面出版领域的一种页面描述语言。)给CUPS(99%的程序会这样做)。An application sends a .ps file(PostScript, a script language that details how the page will look) to CUPS when you select 'print'(99% of apps do).
  2. CUPS然后读取你打印机的PPD文件(打印机描述文件)并且计算出它需要哪种解释器去将.ps文件转换成一种打印机认识的语言(像PJL,PCL)。通常它需要ghostscript。CUPS then looks at your printers PPD file(printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands(like PJL,PCL). Usually it needs ghostscript.
  3. GhostScript取得输入并且计算出它需要哪个过滤器,然后将它们转变成打印机能读懂的.ps格式。GhostScript takes the input and figures out which filters it should use,then applies them and converts the .ps file to a format understood by the printer.
  4. 然后它被发送到后端。举个例子,如果你有打印机连接到USB端口,它就用USB后端。 Then it is sent to the backend. For example, if you have your printer connected to a USB port, it uses the USB backend.

打印一个文档并且查看'error_log'文件来得到关于打印队列更多的细节和正确地印象。Print a document and watch 'error_log' to get a more detailed and correct image of the printing process.

Problems resulting from upgrades

Issues that appeared after CUPS and related program packages underwent a version increment

CUPS stops working

The chances are that a new configuration file is needed for the new version to work properly. Messages such as "404 - page not found" my result from trying to manage CUPS via localhost:631, for example.

To use the new configuration, copy /etc/cups/cupsd.conf.default to /etc/cups/cupsd.conf (backup the old the configuration if needed):

# cp /etc/cups/cupsd.conf.default /etc/cups/cupsd.conf

and restart CUPS to employ the new settings.

Error with gnutls

If receiving errors such as:

/usr/sbin/cupsd: error while loading shared libraries: libgnutls.so.13: cannot open shared object file: No such file or directory

gnutls may be in need of updating:

# pacman -S gnutls

After updating, there may be a file named cupsd.conf.pacnew in /etc/cups. This is the unmodified original configuration file that has been placed as part of the update. Compare it with the currently installed version and adjust to preference.

All jobs are "stopped"

If all jobs sent to the printer become "stopped", delete the printer and add it again. Using the CUPS web interface, go to Printers > Delete Printer.

To check the printer's settings go to Printers, then Modify Printer. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), and so on.

All jobs are "The printer is not responding"

On networked printers, you should check that the name that CUPS uses as its connection URI resolves to the printer's IP via DNS. E.g. If your printer's connection looks like this:

lpd://BRN_020554/BINARY_P1

then the hostname 'BRN_020554' needs to resolve to the printer's IP from the server running CUPS

The PPD version is not compatible with gutenprint

Run:

# /usr/sbin/cups-genppdupdate

And restart CUPS (as pointed out in gutenprint's post-install message)

Other

CUPS permission errors
  • Some users fixed 'NT_STATUS_ACCESS_DENIED' (Windows clients) errors by using a slightly different syntax:
smb://workgroup/username:password@hostname/printer_name
  • Sometimes, the block device has wrong permissions:
# ls /dev/usb/
lp0
# chgrp lp /dev/usb/lp0

HPLIP printer sends "/usr/lib/cups/backend/hp failed" error

Make sure dbus is installed and running, e.g. check DAEMONS in /etc/rc.conf or run ls /var/run/daemons.

The avahi-daemon might be required if this error persists and the dbus is already running.

hp-toolbox sends an error, "Unable to communicate with device"

If running hp-toolbox as a regular user results in:

# hp-toolbox
# error: Unable to communicate with device (code=12): hp:/usb/<printer id>

or, "Unable to communicate with device"", then it may be needed to add the user to the lp group by running the following command:

# gpasswd -a <username> lp

This can also be caused by printers such as the P1102 that provide a virtual cd-rom drive for MS-Windows drivers. The lp dev appears and then disappears. In that case try the usb-modeswitch and usb-modeswitch-data packages, that lets one switch off the "Smart Drive" (udev rules included in said packages).

CUPS returns '"foomatic-rip" not available/stopped with status 3' with a HP printer

If receiving any of the following error messages in /var/log/cups/error_log while using a HP printer, with jobs appearing to be processed while they all end up not being completed with their status set to 'stopped':

Filter "foomatic-rip" for printer "<printer_name>" not available: No such file or director

or:

PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!

make sure hplip has been installed, in addition to the packages mentioned above, net-snmp is also needed. See this forum post.

# pacman -S hplip

Printing fails with unauthorised error

If the user has been added to the lp group, and allowed to print (set in cupsd.conf), then the problem lies in /etc/cups/printers.conf. This line could be the culprit:

AuthInfoRequired negotiate

Comment it out and restart CUPS.

Print button greyed-out in GNOME print dialogs

Source: I can't print from gnome applications. - Arch Forums

Be sure the package: libgnomeprint is installed

Edit /etc/cups/cupsd.conf and add

# HostNameLookups Double

Restart CUPS:

# /etc/rc.d/cupsd restart

Unknown supported format: application/postscript

Comment the lines:

application/octet-stream        application/vnd.cups-raw        0      -

from /etc/cups/mime.convs, and:

application/octet-stream

in /etc/cups/mime.types.

Finding URIs for Windows Print Servers

Sometimes Windows is a little less than forthcoming about exact device URIs (device locations). If having trouble specifying the correct device location in CUPS, run the following command to list all shares available to a certain windows username:

$ smbtree -U windowsusername

This will list every share available to a certain Windows username on the local area network subnet, as long as Samba is set up and running properly. It should return something like this:

 WORKGROUP
	\\REGULATOR-PC   		
		\\REGULATOR-PC\Z              	
		\\REGULATOR-PC\Public         	
		\\REGULATOR-PC\print$         	Printer Drivers
		\\REGULATOR-PC\G              	
		\\REGULATOR-PC\EPSON Stylus CX8400 Series	EPSON Stylus CX8400 Series

What is needed here is first part of the last line, the resource matching the printer description. So to print to the EPSON Stylus printer, one would enter:

smb://username.password@REGULATOR-PC/EPSON Stylus CX8400 Series

as the URI into CUPS. Notice that whitespaces are allowed in URIs, whereas backslashes get replaced with forward slashes.

Print-Job client-error-document-format-not-supported

Try installing the foomatic packages and use a foomatic driver.

/usr/lib/cups/backend/hp failed

Change

 SystemGroup sys root

to

 SystemGroup lp root

in /etc/cups/cupsd.conf


Following steps 1-3 in the Alternative CUPS interfaces below may be a better solution, since newer versions of cups will not allow the same group for both normal and admin operation.

Samsung Printer won't print certain documents

Your Samsung printer may work fine with cups refuse to print certain documents (Inkscape file with text) and even crash completely, causing a restart. The solution is to use mentioned the cups-usblp package and to blacklist the usblp module as described in this article.

Local USB printer does not show up

In case your printer does not show up you might need to replace cups with cups-usblp from AUR. Then try it again, once with the usblp module loaded and once with the module blacklisted.

"Unable to get list of printer drivers"

Try to remove Foomatic drivers.

Appendix

Alternative CUPS interfaces

If using GNOME, a possibility is to manage and configure the printer by using system-config-printer-gnome. This package is available through pacman:

# pacman -S system-config-printer-gnome

For system-config-printer to work as it should, running as root may be required, or alternatively set up a "normal" user to administer CUPS (if so follow steps 1-3)

  • 1. Create group, and add a user to it
# groupadd lpadmin
# usermod -aG lpadmin <username>
  • 2. Add "lpadmin" (without the quotes) to this line in /etc/cups/cupsd.conf
SystemGroup sys root <insert here>
  • 3. Restart cups, log out and in again (or restart computer)
# rc.d restart cupsd

KDE users can modify their printers from the Control Center. Both should refer to those desktop environments' documentation for more information on how to use the interfaces.

There is also gtklp in the AUR

PDF virtual printer

CUPS-PDF is a nice package that allows one to setup a virtual printer that will generate a PDF from anything sent to it. This package is not necessary, but it can be quite useful. It can be installed using the following command:

# pacman -S cups-pdf

After installing the package, set it up as if it were for any other printer by using the web interface. Access the cups print manager: http://localhost:631 and select:

Administration -> Add Printer
Select CUPS-PDF (Virtual PDF), choose for the make and driver:
Make:	Generic
Driver:	Generic CUPS-PDF Printer

Find generated PDF documents in a sub-directory located at /var/spool/cups-pdf. Normally, the subdirectory is named after the user who performed the job. A little tweak helps you to find your printed PDF documents more easily. Edit /etc/cups/cups-pdf.conf by changing the line

#Out /var/spool/cups-pdf/${USER}

to

Out ${HOME}

Print to PostScript

The CUPS-PDF (Virtual PDF Printer) actually creates a PostScript file and then creates the PDF using the ps2pdf utility. To print to PostScript, just print as usual, in the print dialog choose "CUPS-PDF" as the printer, then select the checkbox for "print to file", hit print, enter the filename.ps and click save. This is handy for faxes, etc...

Another source for printer drivers

Turboprint is a proprietary driver for many printers not yet supported by GNU/Linux (Canon i*, for example). Unlike CUPS, however, high quality prints are either marked with a watermark or are a pay-only service.

Resources