我正在使用 ubuntu 12,我无法从 unix 或 linux 安装软件,我收到以下错误
reiki@reiki ~ $ sudo apt-get install preload
[sudo] password for reiki:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
preload
0 upgraded, 1 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
Need to get 35.6 kB of archives.
After this operation, 138 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ quantal/universe preload i386 0.6.4-2 [35.6 kB]
Fetched 35.6 kB in 1s (34.8 kB/s)
Selecting previously unselected package preload.
(Reading database ... 262032 files and directories currently installed.)
Unpacking preload (from .../preload_0.6.4-2_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up opera (12.15.1748-1linuxmint) ...
ERROR:root:DebFileApplication import
Traceback (most recent call last):
File "/usr/share/software-center/softwarecenter/db/__init__.py", line 4, in <module>
from debfile import DebFileApplication, DebFileOpenError
File "/usr/share/software-center/softwarecenter/db/debfile.py", line 25, in <module>
from softwarecenter.db.application import Application, AppDetails
File "/usr/share/software-center/softwarecenter/db/application.py", line 27, in <module>
import softwarecenter.distro
File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 197, in <module>
distro_instance = _get_distro()
File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 172, in _get_distro
module = __import__(distro_module_name, globals(), locals(), [], -1)
ImportError: No module named linuxmint
Traceback (most recent call last):
File "/usr/sbin/update-software-center", line 38, in <module>
from softwarecenter.db.update import rebuild_database
File "/usr/share/software-center/softwarecenter/db/update.py", line 33, in <module>
from softwarecenter.backend.scagent import SoftwareCenterAgent
File "/usr/share/software-center/softwarecenter/backend/scagent.py", line 28, in <module>
from softwarecenter.distro import get_distro, get_current_arch
File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 197, in <module>
distro_instance = _get_distro()
File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 172, in _get_distro
module = __import__(distro_module_name, globals(), locals(), [], -1)
ImportError: No module named linuxmint
dpkg: error processing opera (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up preload (0.6.4-2) ...
* Starting Adaptive readahead daemon preload [ OK ]
Processing triggers for menu ...
Processing triggers for ureadahead ...
Errors were encountered while processing:
opera
E: Sub-process /usr/bin/dpkg returned an error code (1)
reiki@reiki ~ $
当我尝试删除 opera 时出现以下错误
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
opera
0 upgraded, 0 newly installed, 1 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 45.0 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 261623 files and directories currently installed.)
Removing opera ...
ERROR:root:DebFileApplication import
Traceback (most recent call last):
File "/usr/share/software-center/softwarecenter/db/__init__.py", line 4, in <module>
from debfile import DebFileApplication, DebFileOpenError
File "/usr/share/software-center/softwarecenter/db/debfile.py", line 25, in <module>
from softwarecenter.db.application import Application, AppDetails
File "/usr/share/software-center/softwarecenter/db/application.py", line 27, in <module>
import softwarecenter.distro
File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 197, in <module>
distro_instance = _get_distro()
File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 172, in _get_distro
module = __import__(distro_module_name, globals(), locals(), [], -1)
ImportError: No module named linuxmint
Traceback (most recent call last):
File "/usr/sbin/update-software-center", line 38, in <module>
from softwarecenter.db.update import rebuild_database
File "/usr/share/software-center/softwarecenter/db/update.py", line 33, in <module>
from softwarecenter.backend.scagent import SoftwareCenterAgent
File "/usr/share/software-center/softwarecenter/backend/scagent.py", line 28, in <module>
from softwarecenter.distro import get_distro, get_current_arch
File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 197, in <module>
distro_instance = _get_distro()
File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 172, in _get_distro
module = __import__(distro_module_name, globals(), locals(), [], -1)
ImportError: No module named linuxmint
dpkg: error processing opera (--remove):
subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Processing triggers for menu ...
Errors were encountered while processing:
opera
E: Sub-process /usr/bin/dpkg returned an error code (1)
现在我无法删除 opera
答案1
这不是一个很好的解决方案,但在类似情况下应该有效
sudo /bin/rm /var/lib/dpkg/info/opera*.postrm
sudo dpkg -P opera
您的问题是,从软件包中删除后脚本不起作用,因此这就是卸载失败的原因。如果删除 postrm 脚本不起作用,请尝试将空的 bash 脚本放入此文件中,然后再次执行软件包卸载。
答案2
我发现了一些信息这一页这可能会帮助你解决问题。
看起来,您无法仅通过终端删除 opera。似乎您可能需要手动编辑地位文件内/var/lib/dpkg目录。
因此,在尝试下一步之前,首先要做的是备份名为地位, 像这样。
将目录更改为软件包:
cd /var/lib/dpkg
列出文件以确保地位通过键入以下内容,文件位于该目录中ls. 如果您看到一个名为地位,制作备份(我通常会添加“_bak“在我要备份的文件末尾)只是为了安全起见。现在在终端中输入:
mv status status_bak
您可以使用 vim、gedit 或 nano 打开状态文件。我本人比较喜欢gedit,不过每个人都有自己的喜好。
现在编辑地位在终端中输入以下内容:
sudo gedit /var/lib/dpkg/status
将会弹出一个页面,显示不同的包以及有关每个包的信息。
接下来找到歌剧在包列表中的包并删除与 opera 相关的整个信息块,然后单击“保存”。
现在在你的终端中输入以下内容:
sudo apt-get 更新
然后输入:
sudo apt-get 升级
看看之后是否收到任何错误消息。如果没有,请尝试安装您最初尝试安装的软件。