使用我的 BananaPi 作为打印机服务器(Armbian Debian 10 (buster))
运行以下命令:
- aptitude 安装 cups
- aptitude 安装打印机驱动程序 escpr
- aptitude 安装 hplip
- aptitude 安装 hpcups
打印机通过 webgui 添加到 CUPS 服务器。 Epson 打印机可以工作,但将作业发送到 HP 打印机会导致以下错误:(stopped "Filter failed"
我曾经在我的树莓派上运行过此功能,但在 apt-get 更新/升级之后,它开始出现过滤器错误,所以我删除了操作系统并在新设备上开始新的操作)
我能找到的针对此问题的所有解决方案似乎都表明我需要新的驱动程序。
我找到了该打印机(hp m1319f)的两个驱动程序源:
- https://developers.hp.com/hp-linux-imaging-and-printing/gethplip(最新:3.20.6)
- https://www.openprinting.org/driver/foo2zjs-z1
aptitude 安装的驱动程序是 3.18.12。据我所知,包管理器中没有旧版本/新版本可供选择。
我尝试手动下载最新的 hplip 并执行 .run 文件,但结果是:
Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 70, in <module>
import traceback
ValueError: bad marshal data (unknown type code)
Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 70, in <module>
import traceback
ValueError: bad marshal data (unknown type code)
./hplip-install: line 20: [: : integer expression expected
Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 70, in <module>
import traceback
ValueError: bad marshal data (unknown type code)
如果我手动执行,./configure
我会得到以下输出:
...
checking for python3 version... 3.7
checking for python3 platform... linux
checking for python3 script directory... ${prefix}/lib/python3.7/site-packages
checking for python3 extension module directory... ${exec_prefix}/lib/python3.7/site-packages
checking for path to Python.h... Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'distutils.sysconfig'
"using .... python3.7/Python.h"
checking python3.7/Python.h usability... no
checking python3.7/Python.h presence... no
checking for python3.7/Python.h... no
checking python3.7mu/Python.h usability... no
checking python3.7mu/Python.h presence... no
checking for python3.7mu/Python.h... no
checking python3.7m/Python.h usability... no
checking python3.7m/Python.h presence... no
checking for python3.7m/Python.h... no
configure: error: cannot find python-devel support
但是 python-dev 已经安装,并且 python-devel 不存在。
sudo aptitude install python-dev
python-dev is already installed at the requested version (2.7.16-1)
python-dev is already installed at the requested version (2.7.16-1)
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
/var/log/cups/error_log:
E [04/Aug/2020:11:33:01 -0400] [Job 12] Job stopped due to filter errors; please consult the /var/log/cups/error_log file for details.
D [04/Aug/2020:11:33:01 -0400] [Job 12] The following messages were recorded from 11:32:38 AM to 11:33:01 AM
D [04/Aug/2020:11:33:01 -0400] [Job 12] Applying default options...
D [04/Aug/2020:11:33:01 -0400] [Job 12] Adding start banner page "none".
D [04/Aug/2020:11:33:01 -0400] [Job 12] Adding end banner page "none".
D [04/Aug/2020:11:33:01 -0400] [Job 12] File of type application/vnd.cups-pdf-banner queued by "bananapi".
D [04/Aug/2020:11:33:01 -0400] [Job 12] hold_until=0
D [04/Aug/2020:11:33:01 -0400] [Job 12] Queued on "HP_LaserJet_M1319f_MFP" by "bananapi".
D [04/Aug/2020:11:33:01 -0400] [Job 12] time-at-processing=1596555158
D [04/Aug/2020:11:33:01 -0400] [Job 12] 4 filters for job:
D [04/Aug/2020:11:33:01 -0400] [Job 12] bannertopdf (application/vnd.cups-pdf-banner to application/pdf, cost 32)
D [04/Aug/2020:11:33:01 -0400] [Job 12] pdftopdf (application/pdf to application/vnd.cups-pdf, cost 66)
D [04/Aug/2020:11:33:01 -0400] [Job 12] gstoraster (application/vnd.cups-pdf to application/vnd.cups-raster, cost 99)
D [04/Aug/2020:11:33:01 -0400] [Job 12] hpcups (application/vnd.cups-raster to printer/HP_LaserJet_M1319f_MFP, cost 0)
D [04/Aug/2020:11:33:01 -0400] [Job 12] job-sheets=none,none
D [04/Aug/2020:11:33:01 -0400] [Job 12] argv[0]="HP_LaserJet_M1319f_MFP"
D [04/Aug/2020:11:33:01 -0400] [Job 12] argv[1]="12"
D [04/Aug/2020:11:33:01 -0400] [Job 12] argv[2]="bananapi"
D [04/Aug/2020:11:33:01 -0400] [Job 12] argv[3]="Test Page"
D [04/Aug/2020:11:33:01 -0400] [Job 12] argv[4]="1"
D [04/Aug/2020:11:33:01 -0400] [Job 12] argv[5]="job-uuid=urn:uuid:adfed0df-3ddc-3aa7-4824-6e3bd8baa838 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1596555158 time-at-processing=1596555158"
D [04/Aug/2020:11:33:01 -0400] [Job 12] argv[6]="/var/spool/cups/d00012-001"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[0]="CUPS_CACHEDIR=/var/cache/cups"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[1]="CUPS_DATADIR=/usr/share/cups"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[2]="CUPS_DOCROOT=/usr/share/cups/doc-root"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[3]="CUPS_FONTPATH=/usr/share/cups/fonts"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[4]="CUPS_REQUESTROOT=/var/spool/cups"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[5]="CUPS_SERVERBIN=/usr/lib/cups"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[6]="CUPS_SERVERROOT=/etc/cups"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[7]="CUPS_STATEDIR=/run/cups"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[8]="HOME=/var/spool/cups/tmp"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[9]="PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[10]="SERVER_ADMIN=root@bananapi"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[11]="SOFTWARE=CUPS/2.2.10"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[12]="TMPDIR=/var/spool/cups/tmp"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[13]="USER=root"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[14]="CUPS_MAX_MESSAGE=2047"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[15]="CUPS_SERVER=/run/cups/cups.sock"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[16]="CUPS_ENCRYPTION=IfRequested"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[17]="IPP_PORT=631"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[18]="CHARSET=utf-8"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[19]="LANG=en_US.UTF-8"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[20]="PPD=/etc/cups/ppd/HP_LaserJet_M1319f_MFP.ppd"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[21]="RIP_MAX_CACHE=128m"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[22]="CONTENT_TYPE=application/vnd.cups-pdf-banner"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[23]="DEVICE_URI=hp:/usb/HP_LaserJet_M1319f_MFP?serial=N810GF4"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[24]="PRINTER_INFO=HP LaserJet M1319f MFP"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[25]="PRINTER_LOCATION="
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[26]="PRINTER=HP_LaserJet_M1319f_MFP"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[27]="PRINTER_STATE_REASONS=none"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[28]="CUPS_FILETYPE=document"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[29]="FINAL_CONTENT_TYPE=application/vnd.cups-raster"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[30]="AUTH_I****"
D [04/Aug/2020:11:33:01 -0400] [Job 12] Started filter /usr/lib/cups/filter/bannertopdf (PID 2147)
D [04/Aug/2020:11:33:01 -0400] [Job 12] Started filter /usr/lib/cups/filter/pdftopdf (PID 2148)
D [04/Aug/2020:11:33:01 -0400] [Job 12] Started filter /usr/lib/cups/filter/gstoraster (PID 2149)
D [04/Aug/2020:11:33:01 -0400] [Job 12] Started filter /usr/lib/cups/filter/hpcups (PID 2150)
D [04/Aug/2020:11:33:01 -0400] [Job 12] Started backend /usr/lib/cups/backend/hp (PID 2151)
D [04/Aug/2020:11:33:01 -0400] [Job 12] pdftopdf: Last filter determined by the PPD: hpcups; FINAL_CONTENT_TYPE: application/vnd.cups-raster => pdftopdf will not log pages in page_log.
D [04/Aug/2020:11:33:01 -0400] [Job 12] OUTFORMAT=\"(null)\", so output format will be CUPS/PWG Raster
D [04/Aug/2020:11:33:01 -0400] [Job 12] PDF template file doesn\'t have form. It\'s okay.
D [04/Aug/2020:11:33:01 -0400] [Job 12] PID 2147 (/usr/lib/cups/filter/bannertopdf) exited with no errors.
D [04/Aug/2020:11:33:01 -0400] [Job 12] PID 2148 (/usr/lib/cups/filter/pdftopdf) exited with no errors.
D [04/Aug/2020:11:33:01 -0400] [Job 12] Color Manager: Calibration Mode/Off
D [04/Aug/2020:11:33:01 -0400] [Job 12] Calling FindDeviceById(cups-HP_LaserJet_M1319f_MFP)
D [04/Aug/2020:11:33:01 -0400] [Job 12] Failed to send: org.freedesktop.DBus.Error.ServiceUnknown:The name org.freedesktop.ColorManager was not provided by any .service files
D [04/Aug/2020:11:33:01 -0400] [Job 12] Failed to get find device cups-HP_LaserJet_M1319f_MFP
D [04/Aug/2020:11:33:01 -0400] [Job 12] Calling FindDeviceById(cups-HP_LaserJet_M1319f_MFP)
D [04/Aug/2020:11:33:01 -0400] [Job 12] Failed to send: org.freedesktop.DBus.Error.ServiceUnknown:The name org.freedesktop.ColorManager was not provided by any .service files
D [04/Aug/2020:11:33:01 -0400] [Job 12] Failed to get device cups-HP_LaserJet_M1319f_MFP
D [04/Aug/2020:11:33:01 -0400] [Job 12] Color Manager: no profiles specified in PPD
D [04/Aug/2020:11:33:01 -0400] [Job 12] Set job-printer-state-message to "Color Manager: no profiles specified in PPD", current level=INFO
D [04/Aug/2020:11:33:01 -0400] [Job 12] Color Manager: ICC Profile: None
D [04/Aug/2020:11:33:01 -0400] [Job 12] Ghostscript using Any-Part-of-Pixel method to fill paths.
D [04/Aug/2020:11:33:01 -0400] [Job 12] Ghostscript command line: gs -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -dNOMEDIAATTRS -dShowAcroForm -sstdout=%stderr -sOutputFile=%stdout -sDEVICE=cups -sMediaType=Plain -sOutputType=0 -r600x600 -dMediaPosition=7 -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792 -dcupsBitsPerColor=1 -dcupsColorOrder=0 -dcupsColorSpace=3 -dcupsRowCount=1 -dcupsRowStep=2 -dcupsInteger0=1 -scupsPageSizeName=Letter -I/usr/share/cups/fonts -c \'<</.HWMargins[18.000000 15.500000 18.000000 15.500000] /Margins[0 0]>>setpagedevice\' -f -_
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[0]=\"CUPS_CACHEDIR=/var/cache/cups\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[1]=\"CUPS_DATADIR=/usr/share/cups\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[2]=\"CUPS_DOCROOT=/usr/share/cups/doc-root\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[3]=\"CUPS_FONTPATH=/usr/share/cups/fonts\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[4]=\"CUPS_REQUESTROOT=/var/spool/cups\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[5]=\"CUPS_SERVERBIN=/usr/lib/cups\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[6]=\"CUPS_SERVERROOT=/etc/cups\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[7]=\"CUPS_STATEDIR=/run/cups\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[8]=\"HOME=/var/spool/cups/tmp\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[9]=\"PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[10]=\"SERVER_ADMIN=root@bananapi\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[11]=\"SOFTWARE=CUPS/2.2.10\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[12]=\"TMPDIR=/var/spool/cups/tmp\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[13]=\"USER=root\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[14]=\"CUPS_MAX_MESSAGE=2047\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[15]=\"CUPS_SERVER=/run/cups/cups.sock\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[16]=\"CUPS_ENCRYPTION=IfRequested\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[17]=\"IPP_PORT=631\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[18]=\"CHARSET=utf-8\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[19]=\"LANG=en_US.UTF-8\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[20]=\"PPD=/etc/cups/ppd/HP_LaserJet_M1319f_MFP.ppd\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[21]=\"RIP_MAX_CACHE=128m\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[22]=\"CONTENT_TYPE=application/vnd.cups-pdf-banner\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[23]=\"DEVICE_URI=hp:/usb/HP_LaserJet_M1319f_MFP?serial=N810GF4\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[24]=\"PRINTER_INFO=HP LaserJet M1319f MFP\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[25]=\"PRINTER_LOCATION=\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[26]=\"PRINTER=HP_LaserJet_M1319f_MFP\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[27]=\"PRINTER_STATE_REASONS=none\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[28]=\"CUPS_FILETYPE=document\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[29]=\"FINAL_CONTENT_TYPE=application/vnd.cups-raster\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] envp[30]=\"AUTH_INFO_REQUIRED=none\"
D [04/Aug/2020:11:33:01 -0400] [Job 12] Start rendering...
D [04/Aug/2020:11:33:01 -0400] [Job 12] Set job-printer-state-message to "Start rendering...", current level=INFO
D [04/Aug/2020:11:33:01 -0400] [Job 12] Processing page 1...
D [04/Aug/2020:11:33:01 -0400] [Job 12] Set job-printer-state-message to "Processing page 1...", current level=INFO
D [04/Aug/2020:11:33:01 -0400] [Job 12] STATE: +connecting-to-device
D [04/Aug/2020:11:33:01 -0400] [Job 12] STATE: +hplip.plugin-error
D [04/Aug/2020:11:33:01 -0400] [Job 12] prnt/hpcups/HPCupsFilter.cpp 489: m_Job initialization failed with error = 48
D [04/Aug/2020:11:33:01 -0400] [Job 12] double free or corruption (!prev)
D [04/Aug/2020:11:33:01 -0400] [Job 12] PID 2150 (/usr/lib/cups/filter/hpcups) crashed on signal 6.
D [04/Aug/2020:11:33:01 -0400] [Job 12] Hint: Try setting the LogLevel to "debug" to find out more.
D [04/Aug/2020:11:33:01 -0400] [Job 12] Processing page 2...
D [04/Aug/2020:11:33:01 -0400] [Job 12] STATE: -connecting-to-device
D [04/Aug/2020:11:33:01 -0400] [Job 12] STATE: -media-empty-error,media-jam-error,hplip.plugin-error,cover-open-error,toner-empty-error,other
D [04/Aug/2020:11:33:01 -0400] [Job 12] Rendering completed
D [04/Aug/2020:11:33:01 -0400] [Job 12] PID 2149 (/usr/lib/cups/filter/gstoraster) exited with no errors.
D [04/Aug/2020:11:33:01 -0400] [Job 12] prnt/backend/hp.c 376: read new pjl status: 10023
D [04/Aug/2020:11:33:01 -0400] [Job 12] prnt/backend/hp.c 378: read pjl job_end: 0
D [04/Aug/2020:11:33:01 -0400] [Job 12] prnt/backend/hp.c 376: read new pjl status: 10001
D [04/Aug/2020:11:33:01 -0400] [Job 12] ready to print
D [04/Aug/2020:11:33:01 -0400] [Job 12] PID 2151 (/usr/lib/cups/backend/hp) exited with no errors.
D [04/Aug/2020:11:33:01 -0400] [Job 12] End of messages
D [04/Aug/2020:11:33:01 -0400] [Job 12] printer-state=3(idle)
D [04/Aug/2020:11:33:01 -0400] [Job 12] printer-state-message="ready to print"
D [04/Aug/2020:11:33:01 -0400] [Job 12] printer-state-reasons=none
openprinting 的 ppd 也不能解决问题。
我注意到的一个奇怪现象是驱动程序说我的打印机是彩色的:( HP LaserJet m1319f MFP, hpcups 3.18.12, requires proprietary plugin (color, 2-sided printing)
)
我很困惑。我看到了这个针对错误元帅数据的解决方案,但我认为它不适用于我的情况:https://stackoverflow.com/questions/30861493/how-to-fix-python-valueerrorbad-marshal-data
答案1
wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz
tar zxf foo2zjs.tar.gz
cd foo2zjs
make
sudo make install
sudo make cups
这解决了这个问题。 http://foo2zjs.rkkda.com/
答案2
您必须检查系统日志,与 hpcups 版本相比,该插件可能已经过时:
hpcups[1888334]: common/utils.c 140: validate_plugin_version() Plugin version[3.21.2] mismatch with HPLIP version[3.22.10]
hpcups[1888334]: common/utils.c 173: Plugin version is not matching
hpcups[1888334]: prnt/hpcups/HPCupsFilter.cpp 505: m_Job initialization failed with error = 48
hpcups[1888334]: common/utils.c 244: Invalid Library handler pLibHandler = NULL.
在这种情况下,您只需运行hp-setup -i
即可更新它。您不需要切换到foo2zjs
驱动程序或类似的东西,就像其他答案建议的那样......