我正在手动将 .deb 文件(我不维护)安装到我的 Ubuntu 系统上。
该软件包有一个安装后脚本,该脚本错误地失败了,因此该软件包被视为已损坏。
dpkg: error processing astah-community (--configure):
subprocess installed post-installation script returned error exit status 127
此软件包实际上已正确安装并且运行良好(安装后脚本不正确)。当我在系统上执行任何 apt 操作时,它现在会抱怨软件包已损坏;我该如何解决这个问题?
这没有帮助:
sudo dpkg -i /path/to/the.deb --force-all
答案1
您可以编辑安装后脚本,/var/lib/dpkg/info/astah-community.postinst
注释掉失败的部分。或者您可以重命名/删除该文件,以防止 dpkg 运行它。
完成其中一个后,您可以使用dpkg --configure astah-community
dpkg 重试配置过程,并希望能够成功。
答案2
根据@qqx的回答,我能够修复displaylink-driver
在从其网站安装最新的 displaylink 驱动程序后,在 ubuntu 23.04 上,我收到错误,但进一步的操作还说驱动程序已安装并需要重新启动。重新启动后,连接到我的 USB-C 扩展坞的显示器工作正常。但当我去安装其他软件包时,apt
我再次收到该错误的一部分:
# apt install ./sublime-text_build-3211_amd64.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'sublime-text' instead of './sublime-text_build-3211_amd64.deb'
sublime-text is already the newest version (3211).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up displaylink-driver (5.7.0-129) ...
Reboot required
DisplayLink driver installed successfully.
Please reboot your computer to ensure the proper functioning of the software.
logname: no login name
logname: no login name
dpkg: error processing package displaylink-driver (--configure):
installed displaylink-driver package post-installation script subprocess return
ed error exit status 1
Errors were encountered while processing:
displaylink-driver
E: Sub-process /usr/bin/dpkg returned an error code (1)
所以我编辑/var/lib/dpkg/info/displaylink-driver.postinst
并将此行更改
xorg_or_tty_running && exit 0
为:
exit 0
并且apt install
日志现在很干净。