![E: 子进程 /usr/bin/dpkg 返回错误代码 (2)](https://linux22.com/image/841233/E%3A%20%E5%AD%90%E8%BF%9B%E7%A8%8B%20%2Fusr%2Fbin%2Fdpkg%20%E8%BF%94%E5%9B%9E%E9%94%99%E8%AF%AF%E4%BB%A3%E7%A0%81%20(2).png)
当我尝试运行sudo apt-get upgrade
我的计算机时,它返回一个错误,我不知道该如何修复。不久前,我尝试卸载 Wine,但显然事情没有按预期进行。我之前安装了 PlayOnLinux,但一直无法正常工作。有人能解决这个问题吗?
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
intel-linux-graphics-installer libopenscenegraph80
The following packages will be upgraded:
activity-log-manager-common activity-log-manager-control-center apport apport-gtk bamfdaemon command-not-found command-not-found-data
gir1.2-dbusmenu-glib-0.4 gir1.2-dbusmenu-gtk-0.4 gnome-control-center-unity gnome-screenshot google-chrome-stable libbamf3-1
libdbusmenu-glib4 libdbusmenu-gtk3-4 libdbusmenu-gtk4 libdvdnav4 libplymouth2 libunity-2d-private0 libunity-core-6.0-5 libwhoopsie0
lsb-base lsb-release passwd plymouth plymouth-label plymouth-theme-ubuntu-logo plymouth-theme-ubuntu-text python-apport
python-problem-report python3-apport python3-commandnotfound python3-problem-report unity unity-2d unity-2d-common unity-2d-panel
unity-2d-shell unity-2d-spread unity-common unity-lens-applications unity-services whoopsie
43 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B/47.4 MB of archives.
After this operation, 3,360 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Extracting templates from packages: 100%
dpkg: parse error, in file '/var/lib/dpkg/status' near line 4794 package 'wine1.6-i386':
`Depends' field, invalid package name `wine1.6:any': character `:' not allowed (only letters, digits and characters `-+._')
E: Sub-process /usr/bin/dpkg returned an error code (2)
答案1
看起来 wine 包的格式无效,但是 dpkg 在安装时没有捕获到它,并将一些信息写入包数据库,现在无法读取这些信息。
/var/lib/dpkg/status
在文本编辑器中编辑该文件:
sudoedit /var/lib/dpkg/status
转到第 4794 行并更改Package: wine1.6:any
为Package: wine1.6
检查目录/var/lib/dpkg/info
中是否有以 开头的文件wine1.6:any
。如果有,请重命名它们以删除该:any
部分。然后 dpkg 应该会正常运行,并且您应该能够删除该wine1.6
软件包。
如果其他软件包也包含该虚假的:any
,则对它们执行相同操作。如果:any
出现在依赖项行(Depends: … wine1.6:any …
或Recommends: …
或Suggests: …
或Conflicts: …
)中,则也将其删除。