我尝试先使用 apt update,然后再使用 apt upgrade 来升级我的机器,在将 dash 升级到最新版本时出现错误
Preparing to unpack .../dash_0.5.11+git20210120+802ebd4-2_amd64.deb ...
dpkg: error: need an action option
Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
dpkg: warning: old dash package pre-removal script subprocess returned error exit status 2
dpkg: trying script from the new package instead ...
dpkg: error: need an action option
Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
dpkg: error processing archive /var/cache/apt/archives/dash_0.5.11+git20210120+8
02ebd4-2_amd64.deb (--unpack):
new dash package pre-removal script subprocess returned error exit status 2
dpkg: error: need an action option
Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
dpkg: error while cleaning up:
installed dash package post-installation script subprocess returned error exit
status 2
Errors were encountered while processing:
/var/cache/apt/archives/dash_0.5.11+git20210120+802ebd4-2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试了 apt purge dash,但出现同样的错误。
答案1
从以下链接获得解决方案-
https://phoenixnap.com/kb/fix-sub-process-usr-bin-dpkg-returned-error-code-1
链接中的“方法 5:删除帖子文件”起了作用。
mv /var/lib/dpkg/info/dash.* /tmp
这使得全新升级的 dash 不会出现错误。