只用过HP的打印机,用过两个,分别是:HP_p2055dn, 和 HP_LaserJet_Professional_M1216nfh 别的不知道。以下内容仅试用于HP打印机。
第一:装HP,打印机工具
pacman -S hplip
这个包,自带配置工具和打印机驱动。
其实,装这个就能用了,然后使用自带工具hp-toolbox,hp-setup之类的一设置。
不过在几年前使用第一台打印机2055的时候,我还不太懂,所以学习了一个开放的打印机接入服务cups(到底是干啥的,我也并不太知道),cups支持所有主流的打印机。
所以我当时使用的cups来添加打印机。理论上你可以用cups来添加管理所有的打印机,但是非HP的,应该是需要另装驱动的,我不清楚。
第二:基于以上,安装cups
pacman -S cups
第三:启动cups服务:
>>> systemctl start org.cups.cupsd
第四:使用浏览器访问cups服务: http://localhost:631/
在页面里可以找到添加打印机的向导,然后跑到打印机旁边,找到品牌,型号标签,然后记下来。使用socket://172.168.10.98/ 添加打印机。并选择品牌,然后选择对应型号的驱动。最后完成向导。
然后,打印测试页。在job里查看是否成功。如果错了,80%是驱动选错了。重来该步骤,直到成功!
第五:理论上,在第四步骤里边,你就已经成功了。如果你来到了第五步,说明你没有成功。
如果你的打印机不是HP,请关闭该页,去google重新search。然后,最终你一定成功,欢迎回来留言,分享经验 :)
如果你的打印机是HP的,并且是m1216nfh,那么恭喜你和我的问题一样,请继续阅读。
我遇到的问题:添加成功,打印失败,说:filter failed
查看了详细日志文件 /var/log/cups/error_log
W [/Nov/::: +] CreateProfile failed: org.freedesktop.ColorManager.AlreadyExists:profile id \'hp-m1216nfh-Gray..\' already exists
W [/Nov/::: +] CreateProfile failed: org.freedesktop.ColorManager.AlreadyExists:profile id \'hp-m1216nfh-RGB..\' already exists
E [/Nov/::: +] [Job ] Job stopped due to filter errors; please consult the error_log file for details.
D [/Nov/::: +] [Job ] The following messages were recorded from :: PM to :: PM
D [/Nov/::: +] [Job ] Adding start banner page "none".
D [/Nov/::: +] [Job ] Adding end banner page "none".
D [/Nov/::: +] [Job ] File of type application/vnd.cups-pdf-banner queued by "root".
D [/Nov/::: +] [Job ] hold_until=
D [/Nov/::: +] [Job ] Queued on "hp-m1216nfh" by "root".
D [/Nov/::: +] [Job ] time-at-processing=
D [/Nov/::: +] [Job ] filters for job:
D [/Nov/::: +] [Job ] bannertopdf (application/vnd.cups-pdf-banner to application/pdf, cost )
D [/Nov/::: +] [Job ] pdftopdf (application/pdf to application/vnd.cups-pdf, cost )
D [/Nov/::: +] [Job ] gstoraster (application/vnd.cups-pdf to application/vnd.cups-raster, cost )
D [/Nov/::: +] [Job ] hpcups (application/vnd.cups-raster to printer/hp-m1216nfh, cost )
D [/Nov/::: +] [Job ] job-sheets=none,none
D [/Nov/::: +] [Job ] argv[]="hp-m1216nfh"
D [/Nov/::: +] [Job ] argv[]=""
D [/Nov/::: +] [Job ] argv[]="root"
D [/Nov/::: +] [Job ] argv[]="Test Page"
D [/Nov/::: +] [Job ] argv[]=""
D [/Nov/::: +] [Job ] argv[]="job-uuid=urn:uuid:fb232c3c-f68d-3701-7b64-7f034da35129 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1478851985 time-at-processing=1478851985"
D [/Nov/::: +] [Job ] argv[]="/var/spool/cups/d00023-001"
D [/Nov/::: +] [Job ] envp[]="CUPS_CACHEDIR=/var/cache/cups"
D [/Nov/::: +] [Job ] envp[]="CUPS_DATADIR=/usr/share/cups"
D [/Nov/::: +] [Job ] envp[]="CUPS_DOCROOT=/usr/share/cups/doc"
D [/Nov/::: +] [Job ] envp[]="CUPS_FONTPATH=/usr/share/cups/fonts"
D [/Nov/::: +] [Job ] envp[]="CUPS_REQUESTROOT=/var/spool/cups"
D [/Nov/::: +] [Job ] envp[]="CUPS_SERVERBIN=/usr/lib/cups"
D [/Nov/::: +] [Job ] envp[]="CUPS_SERVERROOT=/etc/cups"
D [/Nov/::: +] [Job ] envp[]="CUPS_STATEDIR=/run/cups"
D [/Nov/::: +] [Job ] envp[]="HOME=/var/spool/cups/tmp"
D [/Nov/::: +] [Job ] envp[]="PATH=/usr/lib/cups/filter:/usr/bin:/usr/bin:/bin:/usr/bin"
D [/Nov/::: +] [Job ] envp[]="SERVER_ADMIN=root@T7"
D [/Nov/::: +] [Job ] envp[]="SOFTWARE=CUPS/2.2.1"
D [/Nov/::: +] [Job ] envp[]="TMPDIR=/var/spool/cups/tmp"
D [/Nov/::: +] [Job ] envp[]="USER=root"
D [/Nov/::: +] [Job ] envp[]="CUPS_MAX_MESSAGE=2047"
D [/Nov/::: +] [Job ] envp[]="CUPS_SERVER=/run/cups/cups.sock"
D [/Nov/::: +] [Job ] envp[]="CUPS_ENCRYPTION=IfRequested"
D [/Nov/::: +] [Job ] envp[]="IPP_PORT=631"
D [/Nov/::: +] [Job ] envp[]="CHARSET=utf-8"
D [/Nov/::: +] [Job ] envp[]="LANG=en_US.UTF-8"
D [/Nov/::: +] [Job ] envp[]="PPD=/etc/cups/ppd/hp-m1216nfh.ppd"
D [/Nov/::: +] [Job ] envp[]="RIP_MAX_CACHE=128m"
D [/Nov/::: +] [Job ] envp[]="CONTENT_TYPE=application/vnd.cups-pdf-banner"
D [/Nov/::: +] [Job ] envp[]="DEVICE_URI=socket://172.168.10.98"
D [/Nov/::: +] [Job ] envp[]="PRINTER_INFO=HLYT-Printer-Black"
D [/Nov/::: +] [Job ] envp[]="PRINTER_LOCATION=HLYT"
D [/Nov/::: +] [Job ] envp[]="PRINTER=hp-m1216nfh"
D [/Nov/::: +] [Job ] envp[]="PRINTER_STATE_REASONS=none"
D [/Nov/::: +] [Job ] envp[]="CUPS_FILETYPE=document"
D [/Nov/::: +] [Job ] envp[]="FINAL_CONTENT_TYPE=application/vnd.cups-raster"
D [/Nov/::: +] [Job ] envp[]="AUTH_I****"
D [/Nov/::: +] [Job ] Started filter /usr/lib/cups/filter/bannertopdf (PID )
D [/Nov/::: +] [Job ] Started filter /usr/lib/cups/filter/pdftopdf (PID )
D [/Nov/::: +] [Job ] Started filter /usr/lib/cups/filter/gstoraster (PID )
D [/Nov/::: +] [Job ] Started filter /usr/lib/cups/filter/hpcups (PID )
D [/Nov/::: +] [Job ] Started backend /usr/lib/cups/backend/socket (PID )
D [/Nov/::: +] [Job ] pdftopdf: Last filter determined by the PPD: hpcups; FINAL_CONTENT_TYPE: application/vnd.cups-raster => pdftopdf will not log pages in page_log.
D [/Nov/::: +] [Job ] PDF template file doesn\'t have form. It\'s okay.
D [/Nov/::: +] [Job ] OUTFORMAT=\"(null)\", so output format will be CUPS/PWG Raster
D [/Nov/::: +] [Job ] PID (/usr/lib/cups/filter/bannertopdf) exited with no errors.
D [/Nov/::: +] [Job ] STATE: +connecting-to-device
D [/Nov/::: +] [Job ] Looking up \"172.168.10.98\"...
D [/Nov/::: +] [Job ] PID (/usr/lib/cups/filter/pdftopdf) exited with no errors.
D [/Nov/::: +] [Job ] Color Manager: Calibration Mode/Off
D [/Nov/::: +] [Job ] Calling FindDeviceById(cups-hp-m1216nfh)
D [/Nov/::: +] [Job ] Found device /org/freedesktop/ColorManager/devices/cups_hp_m1216nfh
D [/Nov/::: +] [Job ] Calling org.freedesktop.ColorManager.Device.Get(ProfilingInhibitors)
D [/Nov/::: +] [Job ] Calling FindDeviceById(cups-hp-m1216nfh)
D [/Nov/::: +] [Job ] Found device /org/freedesktop/ColorManager/devices/cups_hp_m1216nfh
D [/Nov/::: +] [Job ] Calling GetProfileForQualifiers(Gray.Plain....)
D [/Nov/::: +] [Job ] Failed to send: org.freedesktop.ColorManager.Device.NothingMatched:nothing matched expression \'Gray.Plain.,Gray.Plain.*,Gray.*.,Gray.*.*,*\'
D [/Nov/::: +] [Job ] Failed to get profile filename for cups-hp-m1216nfh
D [/Nov/::: +] [Job ] Color Manager: no profiles specified in PPD
D [/Nov/::: +] [Job ] Set job-printer-state-message to "Color Manager: no profiles specified in PPD", current level=INFO
D [/Nov/::: +] [Job ] Color Manager: ICC Profile: None
D [/Nov/::: +] [Job ] Ghostscript using Any-Part-of-Pixel method to fill paths.
D [/Nov/::: +] [Job ] Ghostscript command line: gs -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -dNOMEDIAATTRS -sstdout=%stderr -sOutputFile=%stdout -sDEVICE=cups -sMediaType=Plain -sOutputType= -r600x600 -dMediaPosition= -dDEVICEWIDTHPOINTS= -dDEVICEHEIGHTPOINTS= -dcupsBitsPerColor= -dcupsColorOrder= -dcupsColorSpace= -dcupsRowCount= -dcupsRowStep= -dcupsInteger0= -scupsPageSizeName=Letter -I/usr/share/cups/fonts -c \'<</.HWMargins[12.000000 12.000000 12.000000 12.000000] /Margins[0 0]>>setpagedevice\' -f -_
D [/Nov/::: +] [Job ] envp[]=\"CUPS_CACHEDIR=/var/cache/cups\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_DATADIR=/usr/share/cups\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_DOCROOT=/usr/share/cups/doc\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_FONTPATH=/usr/share/cups/fonts\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_REQUESTROOT=/var/spool/cups\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_SERVERBIN=/usr/lib/cups\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_SERVERROOT=/etc/cups\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_STATEDIR=/run/cups\"
D [/Nov/::: +] [Job ] envp[]=\"HOME=/var/spool/cups/tmp\"
D [/Nov/::: +] [Job ] envp[]=\"PATH=/usr/lib/cups/filter:/usr/bin:/usr/bin:/bin:/usr/bin\"
D [/Nov/::: +] [Job ] envp[]=\"SERVER_ADMIN=root@T7\"
D [/Nov/::: +] [Job ] envp[]=\"SOFTWARE=CUPS/2.2.1\"
D [/Nov/::: +] [Job ] envp[]=\"TMPDIR=/var/spool/cups/tmp\"
D [/Nov/::: +] [Job ] envp[]=\"USER=root\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_MAX_MESSAGE=2047\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_SERVER=/run/cups/cups.sock\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_ENCRYPTION=IfRequested\"
D [/Nov/::: +] [Job ] envp[]=\"IPP_PORT=631\"
D [/Nov/::: +] [Job ] envp[]=\"CHARSET=utf-8\"
D [/Nov/::: +] [Job ] envp[]=\"LANG=en_US.UTF-8\"
D [/Nov/::: +] [Job ] envp[]=\"PPD=/etc/cups/ppd/hp-m1216nfh.ppd\"
D [/Nov/::: +] [Job ] envp[]=\"RIP_MAX_CACHE=128m\"
D [/Nov/::: +] [Job ] envp[]=\"CONTENT_TYPE=application/vnd.cups-pdf-banner\"
D [/Nov/::: +] [Job ] envp[]=\"DEVICE_URI=socket://172.168.10.98\"
D [/Nov/::: +] [Job ] envp[]=\"PRINTER_INFO=HLYT-Printer-Black\"
D [/Nov/::: +] [Job ] envp[]=\"PRINTER_LOCATION=HLYT\"
D [/Nov/::: +] [Job ] envp[]=\"PRINTER=hp-m1216nfh\"
D [/Nov/::: +] [Job ] envp[]=\"PRINTER_STATE_REASONS=none\"
D [/Nov/::: +] [Job ] envp[]=\"CUPS_FILETYPE=document\"
D [/Nov/::: +] [Job ] envp[]=\"FINAL_CONTENT_TYPE=application/vnd.cups-raster\"
D [/Nov/::: +] [Job ] envp[]=\"AUTH_INFO_REQUIRED=none\"
D [/Nov/::: +] [Job ] Start rendering...
D [/Nov/::: +] [Job ] Set job-printer-state-message to "Start rendering...", current level=INFO
D [/Nov/::: +] [Job ] Processing page ...
D [/Nov/::: +] [Job ] Set job-printer-state-message to "Processing page 1...", current level=INFO
D [/Nov/::: +] [Job ] STATE: +hplip.plugin-error
D [/Nov/::: +] [Job ] prnt/hpcups/HPCupsFilter.cpp : m_Job initialization failed with error =
D [/Nov/::: +] [Job ] PID (/usr/lib/cups/filter/hpcups) stopped with status .
D [/Nov/::: +] [Job ] Hint: Try setting the LogLevel to "debug" to find out more.
D [/Nov/::: +] [Job ] hrDeviceDesc=\"HP LaserJet Professional M1216nfh MFP\"
D [/Nov/::: +] [Job ] prtGeneralCurrentLocalization type is , expected !
D [/Nov/::: +] [Job ] backendWaitLoop(snmp_fd=, addr=0x55740d4f2128, side_cb=0x55740bc95230)
D [/Nov/::: +] [Job ] Connecting to 172.168.10.98:
D [/Nov/::: +] [Job ] Connecting to printer.
D [/Nov/::: +] [Job ] STATE: -connecting-to-device
D [/Nov/::: +] [Job ] Connected to printer.
D [/Nov/::: +] [Job ] Connected to 172.168.10.98:...
D [/Nov/::: +] [Job ] backendRunLoop(print_fd=, device_fd=, snmp_fd=, addr=0x55740d4f2128, use_bc=, side_cb=0x55740bc95230)
D [/Nov/::: +] [Job ] STATE: +cups-waiting-for-job-completed
D [/Nov/::: +] [Job ] Waiting for printer to finish.
D [/Nov/::: +] [Job ] PID (/usr/lib/cups/backend/socket) exited with no errors.
D [/Nov/::: +] [Job ] Processing page ...
D [/Nov/::: +] [Job ] Rendering completed
D [/Nov/::: +] [Job ] PID (/usr/lib/cups/filter/gstoraster) exited with no errors.
D [/Nov/::: +] [Job ] End of messages
D [/Nov/::: +] [Job ] printer-state=(idle)
D [/Nov/::: +] [Job ] printer-state-message="Rendering completed"
D [/Nov/::: +] [Job ] printer-state-reasons=hplip.plugin-error
error_log
第六:直接使用hplip的工具安装,不使用cups
hp-setup -i 172.168.10.98
不需要指定驱动,自动识别,自动安装。
完成向导,打印测试页,好用!
总结:HP的打印机,就用HP的工具装,节约时间。: )
-------------------------------------------
后续:
因为并不知道为什么cups不好使,而小伙伴们都说重来没遇见过不好使的时候,所以我又尝试调查了一下,希望找到原因。
hp-setup之后,使用hp-check命令,可以查看到所以打印机的信息。成功添加的打印机使用了一个新生产的ppd,
/etc/cups/ppd/HP_LaserJet_Professional_M1216nfh_MFP.ppd
与原ppd比较如下:
(T7) ~/Src/tss/tss_sys
>>> diff
3c3
< *%%%% Created by the CUPS PPD Compiler CUPS v2.1.3.
---
> *%%%% Created by the CUPS PPD Compiler CUPS v2.2.1.
29c29
< *cupsVersion: 2.1
---
> *cupsVersion: 2.2
(T7) ~/Src/tss/tss_sys
>>>
所以,我一度以为是ppd里边这两行区别导致的问题,只要有了新ppd,就可以正常使用了(另外,这个新PPD是从哪来的?)
之后,我使用这个新ppd用cups重新加载了一次,未修复,现象与之前保持一致。
----------------------------------- Update @ 2016-11-30 ----------------------------------
即使安装好了打印机,并且一切使用正常,cupsd服务也是必然要开的。不然应用程序并不能正确的找到打印机。
可以每次使用打印机之前启动,或者保持常开。(目前我,选择每次打印前手动开,因为我并不常常打印)
[tong@T7:~/Src/tss/tss_sys/daemon/pktdump]
% systemctl enable org.cups.cupsd
[tong@T7:~/Src/tss/tss_sys/daemon/pktdump]
%
---------------------------------- Update @ 2016-12-12 ------------------------------------
上次把org.cups.cupsd服务disable掉了,今天start之后发现依然打印不了,enable之,下次再打。
/home/tong/tunnels [tong@T7] [:]
> sudo systemctl status org.cups.cupsd
● org.cups.cupsd.service - CUPS Scheduler
Loaded: loaded (/usr/lib/systemd/system/org.cups.cupsd.service; disabled; vendor preset: disabled)
Active: active (running) since Mon -- :: CST; 38s ago
Docs: man:cupsd()
Main PID: (cupsd)
Status: "Scheduler is running..."
Tasks: (limit: )
CGroup: /system.slice/org.cups.cupsd.service
└─ /usr/bin/cupsd -l Dec :: T7 systemd[]: Starting CUPS Scheduler...
Dec :: T7 systemd[]: Started CUPS Scheduler.
Dec 12 17:41:43 T7 hpcups[11469]: prnt/hpcups/HPCupsFilter.cpp 528: DEBUG: ppdOpenFile failed for /etc/cups/ppd/HP_LaserJet_Professional_M1216nfh_MFP.ppd
Dec 12 17:41:43 T7 hp[11470]: prnt/backend/hp.c 919: ERROR: null print job total=0 /home/tong/tunnels [tong@T7] [:]
> ll /etc/cups/ppd/HP_LaserJet_Professional_M1216nfh_MFP.ppd
-rw-r----- root root 11K Nov : /etc/cups/ppd/HP_LaserJet_Professional_M1216nfh_MFP.ppd /home/tong/tunnels [tong@T7] [:]
>
----------------------- Updated @ 2016-12-30 ----------------------
原来是因为打印机改了地址。再disable一次,重启之后下次有机会再试。
[daily][device] linux添加打印机的更多相关文章
-
[daily][device] linux挂载iphone
头几个月去旅游,亲戚的iphone照了好多照片,空间不足.就备份在了我的电脑上. 那么问题就是如何在linux系统里挂载iphone? 我找到了这篇文档,然而我没看. https://wiki.arc ...
-
linux添加新LUN,无需重启
linux添加新LUN,无需重启 在给存储增加新的Lun时,在linux下一般是: A.重启操作系统B.重启HBA卡驱动 1. kudzu添加完新硬盘后,运行命令kudzu重新扫描新的硬件设备,类似a ...
-
使用磁盘为Linux添加swap
一.SWAP 说明 1.SWAP 概述 当系统的物理内存不够用的时候,就需要将物理内存中的一部分空间释放出来,以供当前运行的程序使用.那些被释放的空间可能来自一些很长时间没有什么操作的程序,这些被释放 ...
-
Linux 添加网卡
Linux 添加网卡 1.写入网卡配置 vim /etc/sysconfig/network-scripts/ifcfg-eth1 # 网卡名字 DEVICE=eth1 # 网卡类型 TYPE=Eth ...
-
Virtualbox中Linux添加新磁盘并创建分区
原文:https://www.linuxidc.com/Linux/2017-01/139616.htm ----------------------------------------------- ...
-
VMware虚拟机中为Linux 添加虚拟硬盘(VirtualBox方法类似)
修改1:2014-06-24 11:38:21 Linux添加硬盘是在原来安装的硬盘空间不够或者需要使用其他硬盘上的东西时候的解决办法,因为大多数初学者习惯使用虚拟机,这里以在Vmware虚拟机中实现 ...
-
Linux添加硬盘创建新的逻辑卷方式
有同仁看了上文<Linux添加硬盘扩充已有分区存储空间方式>一文后,提出疑问,现在很多云服务器本来没有逻辑卷,添加数据盘后需要自行添加,如何处理? 此文将以某云服务器为例,详细进行解说. ...
-
HP网络打印机--如何添加打印机
HP网络打印机采用web服务形式,应添加打印机-通过Internet的打印机--填写网址http://192.168.1.10:80(从其他win7电脑-计算机-网络-网络设备中双击添加打印机,然后在 ...
-
Linux添加主机路由
Linux添加主机路由:参考:http://zhidao.baidu.com/link?url=50qQ232ZiJqq1iftHvBdPzZh-JlQGi1DZ8wvF-j9dvQYsKiNgc-6 ...
随机推荐
-
nginx正向代理,反向代理,透明代理(总结)
1正向代理 正向代理,也就是传说中的代理,他的工作原理就像一个跳板, 简单的说, 我是一个用户,我访问不了某网站,但是我能访问一个代理服务器 这个代理服务器呢,他能访问那个我不能访问的网站 于是我先连 ...
-
js兼容方法:通过样式名获取元素,byClass
function byClass(oParent,className){ if(document.getElementsByClassName){ //if it is Firefox return ...
-
编写一函数用来实现左右循环移位。函数原型为move(value,n);n>;0时右移n位,n<;0时左移|n|位。
#include<stdio.h> #include<stdlib.h> int main(){ setbuf(stdout,NULL); int move(int,int); ...
-
Android自定义radiobutton(文字靠左,选框靠右)
<RadioButton android:id="@+id/rb_never" android:layout_width="fill_parent" an ...
-
C++ 完美破解九宫格(数独)游戏
看到CSDN上有位大神用C#写了一个破解数独的程序(点击打开链接),不过我对C#也不懂,比较喜欢C++,就用标准C++也写了一个,希望各位喜欢.三纯程序,纯控制台程序,纯各人爱好,纯算法程序,无win ...
-
1 Introduction
1. Introduction 1.1. License Flowable is distributed under the Apache V2 license. 1.2. Download http ...
-
Windows Internals 笔记——字符和字符串处理
1.自Windows NT起,Windows的所有版本都完全用Unicode来构建,调用Windows函数时,如果向它传入一个ANSI字符串,那么函数首先会把字符串转换为Unicode,再把结果传给操 ...
-
vue 组件动态 循环
组件可以是动态的,记录如下 <div v-for="item in arrComponent"> <component v-bind:is="item. ...
-
day43 数据库学习egon的博客 索引
一 介绍 为何要有索引? 一般的应用系统,读写比例在10:1左右,而且插入操作和一般的更新操作很少出现性能问题,在生产环境中,我们遇到最多的,也是最容易出问题的,还是一些复杂的查询操作,因此对查询语句 ...
-
如何解决在Windows Server 2008 R2 上安装证书服务重启后出现 CertificationAuthority 91错误事件
很久都没写什么博客了,前一段时间学习2008 R2时,在自己的电脑上同时安装AD 和证书 往往会出现一个CertificationAuthority错误,如下: 产生问题的主要原因是: 证书服务器与D ...