![HPLIP 驱动程序在 Ubuntu 20.04 上安装失败](https://linux22.com/image/1173415/HPLIP%20%E9%A9%B1%E5%8A%A8%E7%A8%8B%E5%BA%8F%E5%9C%A8%20Ubuntu%2020.04%20%E4%B8%8A%E5%AE%89%E8%A3%85%E5%A4%B1%E8%B4%A5.png)
我最近将 18.04 版本升级到了 20.04(我知道这还早),删除了我手动安装的“hplip”软件包(3.16.11),并安装了该版本中的官方软件包(3.20.3+dgfsg0-2)。所有似乎一切都很好,直到我开始收到更新驱动程序的消息。确保今天没有其他东西要打印,我按照说明操作,结果“hp-plugin”命令无法下载插件,并出现以下回溯...
Traceback (most recent call last):
File "/usr/share/hplip/ui5/plugindialog.py", line 248, in NextButton_clicked
status, download_plugin_file, error_str = self.pluginObj.download(self.plugin_path,self.plugin_download_callback)
File "/usr/share/hplip/installer/pluginhandler.py", line 254, in download
core = core_install.CoreInstall()
File "/usr/share/hplip/installer/core_install.py", line 239, in __init__
self.passwordObj = password.Password(ui_mode)
File "/usr/share/hplip/base/password.py", line 88, in __init__
self.__readAuthType() # self.__authType
File "/usr/share/hplip/base/password.py", line 110, in __readAuthType
distro_name = get_distro_name().lower()
File "/usr/share/hplip/base/password.py", line 78, in get_distro_name
return distro.linux_distribution(full_distribution_name=False)[0]
File "/usr/lib/python3/dist-packages/distro.py", line 122, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/usr/lib/python3/dist-packages/distro.py", line 677, in linux_distribution
self.version(),
File "/usr/lib/python3/dist-packages/distro.py", line 737, in version
self.lsb_release_attr('release'),
File "/usr/lib/python3/dist-packages/distro.py", line 899, in lsb_release_attr
return self._lsb_release_info.get(attribute, '')
File "/usr/lib/python3/dist-packages/distro.py", line 552, in __get__
ret = obj.__dict__[self._fname] = self._f(obj)
File "/usr/lib/python3/dist-packages/distro.py", line 1012, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
手动下载插件程序并尝试以此方式安装它会产生相同的结果。这是怎么回事?似乎没有缺少 lsb_release 模块,并且运行/usr/bin/lsb_release -a
正常且没有返回任何错误。
$ apt-cache policy hplip-gui
hplip-gui:
Installed: 3.20.3+dfsg0-2
Candidate: 3.20.3+dfsg0-2
Version table:
*** 3.20.3+dfsg0-2 500
500 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu focal/universe i386 Packages
100 /var/lib/dpkg/status
$ dpkg -l | grep -i hplip
ii hplip 3.20.3+dfsg0-2 amd64 HP Linux Printing and Imaging System (HPLIP)
ii hplip-data 3.20.3+dfsg0-2 all HP Linux Printing and Imaging - data files
ii hplip-doc 3.20.3+dfsg0-2 all HP Linux Printing and Imaging - documentation
ii hplip-gui 3.20.3+dfsg0-2 all HP Linux Printing and Imaging - GUI utilities (Qt-based)
从命令行运行 hp-plugin 命令会打印两次堆栈,并且第一次迭代还有一些抱怨......
File "/usr/lib/python3.8/subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 144, in apport_excepthook
with os.fdopen(os.open(pr_filename,
PermissionError: [Errno 13] Permission denied: '/var/crash/_usr_share_hplip_plugin.py.1000.crash'
我以普通用户身份在 /var/crash 中写入文件没有任何问题,所以我不确定问题出在哪里。
我曾提到,lsb_release -a
从命令行运行正常,但却忽略了提供其输出......
$ lsb_release -a
LSB Version: core-11.1.0ubuntu2-noarch:printing-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal
$ echo $?
0
运行hp-plugin -i -g
似乎表明真正的问题出在hp方面......
hp-plugin[310176]: debug: /usr/bin/wget --cache=off --tries=3 --timeout=60 --output-document=- http://www.hp.com --spider -S
hp-plugin[310176]: debug: Spider mode enabled. Check if remote file exists.
--2020-05-31 09:36:45-- http://www.hp.com/
Resolving www.hp.com (www.hp.com)... 15.73.200.23, 15.73.200.22
Connecting to www.hp.com (www.hp.com)|15.73.200.23|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 301 Moved Permanently
Server: Apache
X-Frame-Options: SAMEORIGIN
Cache-Control: no-store, no-cache, must-revalidate, max-age=0, max-age=7200
Location: http://www-redirect.ext.hp.com
Expires: Sun, 31 May 2020 15:36:45 GMT
Vary: Accept-Encoding
Content-Type: text/html; charset=iso-8859-1
Accept-Ranges: bytes
Date: Sun, 31 May 2020 13:36:45 GMT
X-Varnish: 1131355252
Age: 0
Via: 1.1 varnish
Connection: keep-alive
X-Varnish-Origin: g2t3073.austin.hp.com
X-Cache: MISS
Location: http://www-redirect.ext.hp.com [following]
Spider mode enabled. Check if remote file exists.
--2020-05-31 09:36:45-- http://www-redirect.ext.hp.com/
Resolving www-redirect.ext.hp.com (www-redirect.ext.hp.com)... 96.7.23.193
Connecting to www-redirect.ext.hp.com (www-redirect.ext.hp.com)|96.7.23.193|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 301 Moved Permanently
Server: AkamaiGHost
Content-Length: 0
Location: https://www8.hp.com/us/en/home.html
Cache-Control: max-age=0
Expires: Sun, 31 May 2020 13:36:45 GMT
Date: Sun, 31 May 2020 13:36:45 GMT
Connection: keep-alive
Location: https://www8.hp.com/us/en/home.html [following]
Spider mode enabled. Check if remote file exists.
--2020-05-31 09:36:45-- https://www8.hp.com/us/en/home.html
Resolving www8.hp.com (www8.hp.com)... 184.24.150.205
Connecting to www8.hp.com (www8.hp.com)|184.24.150.205|:443... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Server: Apache
Last-Modified: Sun, 31 May 2020 13:01:01 GMT
Access-Control-Allow-Headers: Access-Control-Allow-Origin, Origin, X-Requested-With, Content-Type, Accept
Access-Control-Allow-Methods: GET, OPTIONS, POST, PUT, DELETE
Access-Control-Allow-Origin: *
X-Powered-By: Servlet/2.5 JSP/2.1
Access-Control-Max-Age: 3600
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=UTF-8
Cache-Control: max-age=1448
Expires: Sun, 31 May 2020 14:00:53 GMT
Date: Sun, 31 May 2020 13:36:45 GMT
Connection: keep-alive
Vary: Accept-Encoding
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.
hp-plugin[310176]: debug: wget returned: 0
[...] rest of error was the same.
但后来我手动下载了该文件并得到了这个......
-----------------------------------------
| PLUG-IN INSTALLATION FOR HPLIP 3.20.3 |
-----------------------------------------
Option Description
---------- --------------------------------------------------
d Download plug-in from HP (recommended)
p Specify a path to the plug-in (advanced)
q Quit hp-plugin (skip installation)
Enter option (d=download*, p=specify path, q=quit) ? p
Enter the path to the 'hplip-3.20.3-plugin.run' file (q=quit) : hplip-3.20.3-plugin.run
---------------
| COPY PLUGIN |
---------------
Downloading plug-in from: file:///home/users/jason/Downloads/hplip-3.20.3-plugin.run
Downloading plug-in: [\ ] 0% Traceback (most recent call last):
[...] rest of error the same.
这也是正确的道路。
更新:我设法让它工作了,但这不是一个真正的“答案”,甚至不是一个真正的“解决方案”。我想看看 Python 调试器是否会告诉我任何新东西,所以我hp-plugin
从那里运行,使用命令pdb3 /usr/share/hplip/plugin.py -i -g
,呃,它只是简单地工作了。它仍然不起作用没有调试器,但至少我能够让我的打印机再次工作。我仍然无法告诉你哪里出了问题(这里仍然有问题),但也许更多的数据会有所帮助。
答案1
调试选项对我来说有效,但第二步我必须输入“cont”并按下Return才能运行所示的过程。
答案2
我遇到了同样的问题,我可以确认使用调试选项可以安装扫描仪插件。
pdb3 /usr/share/hplip/plugin.py -i -g
答案3
我目前正在运行 Ubuntu 20.04。我有一台 HP LaserJet Pro MFP M226dw。这是一款支持打印和扫描的多功能打印机。我在扫描方面也遇到了困难。幸运的是,我能够更早地开始打印工作。
我已经hplip-3.21.2.run
在系统中安装了。我认为问题出在扫描仪插件上。上面显示的下载插件的自动命令不起作用。因此,我手动下载了最新脚本来自 HPLip 网站。
然后,我运行此命令来安装插件:
sh hplip-3.21.2-plugin.run
这帮我修好了扫描仪。现在我可以毫无问题地进行扫描了。