升级时出错

升级时出错

使用终端升级 Ubuntu 12.10 时sudo apt-get upgrade出现此错误

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 libtinyxml-dev : Depends: libtinyxml (= 2.6.2-2~ppa1) but it is not installed
E: Unmet dependencies. Try using -f.

我尝试了所有方法,但无法解决问题。以下是适当命令的结果。我试过了sudo apt-cache search libtinyxml,结果是:

root@nadirhajiyev:/home/nadirhajiyev# sudo apt-cache search libtinyxml
libtinyxml-dev - TinyXml library - header and static library
libtinyxml-doc - TinyXml library - documentation files
libtinyxml2-0.0.0 - C++ XML parsing library
libtinyxml2-dev - TinyXML2 library - header and static library
libtinyxml2.6.2 - C++ XML parsing library
libtinyxml2.6.2-dbg - TinyXml library - debug files
libtinyxml2.5.3 - dummy transitional package from libtinyxml2.5.3 to libtinyxml
libtinyxml2.5.3-dbg - dummy transitional package from libtinyxml2.5.3-dbg to libtinyxml-dbg
libtinyxml - C++ XML parsing library
libtinyxml-dbg - TinyXml library - debug files

然后apt-get install -y libtinyxml libtinyxml-dev

root@nadirhajiyev:/home/nadirhajiyev# apt-get install -y libtinyxml libtinyxml-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libtinyxml-dev is already the newest version.
libtinyxml-dev set to manually installed.
The following packages were automatically installed and are no longer required:
  erlang-base erlang-crypto erlang-syntax-tools libqt4-webkit:i386 libsctp1 linux-headers-3.5.0-17 lksctp-tools
  ros-groovy-orocos-kinematics-dynamics 
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  libtinyxml
0 upgraded, 1 newly installed, 0 to remove and 249 not upgraded.3 not fully installed or removed.
Need to get 0 B/35.4 kB of archives.
After this operation, 139 kB of additional disk space will be used.
(Reading database ... 260756 files and directories currently installed.) 
Unpacking libtinyxml (from .../libtinyxml_2.6.2-2~ppa1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/libtinyxml_2.6.2-2~ppa1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/libtinyxml.so.2.6.2', which is also in package libtinyxml2.6.2 2.6.2-1build1
Errors were encountered while processing:
 /var/cache/apt/archives/libtinyxml_2.6.2-2~ppa1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

然后apt-get install -y --reinstall libtinyxml libtinyxml-dev

root@nadirhajiyev:/home/nadirhajiyev# apt-get install -y libtinyxml libtinyxml-dev --reinstall
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  erlang-base erlang-crypto erlang-syntax-tools libqt4-webkit:i386 libsctp1 linux-headers-3.5.0-17 lksctp-tools
  ros-groovy-orocos-kinematics-dynamics
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  libtinyxml
0 upgraded, 1 newly installed, 1 reinstalled, 0 to remove and 249 not upgraded.
3 not fully installed or removed.
Need to get 0 B/35.4 kB of archives. 
After this operation, 139 kB of additional disk space will be used.
E: Internal Error, No file name for libtinyxml-dev:amd64

最后我尝试删除它但是得到:

root@nadirhajiyev:/home/nadirhajiyev# apt-get purge -y libtinyxml libtinyxml-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'libtinyxml' is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
  ros-groovy-nodelet : Depends: libtinyxml-dev but it is not going to be installed
  ros-groovy-pluginlib : Depends: libtinyxml-dev but it is not going to be installed
  ros-groovy-rospack : Depends: libtinyxml-dev but it is not going to be installed
  ros-groovy-simulator-gazebo : Depends: libtinyxml-dev but it is not going to be installed
  ros-groovy-srdf : Depends: libtinyxml-dev but it is not going to be installed
  ros-groovy-srdfdom : Depends: libtinyxml-dev but it is not going to be installed
  ros-groovy-urdfdom : Depends: libtinyxml-dev but it is not going to be installed
  ros-groovy-urdfdom-headers : Depends: libtinyxml-dev but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

答案1

您的系统缺少一些依赖项,您应该修复它。尝试运行以下命令序列:

$ sudo apt-get update && sudo apt-get -f install -y && sudo apt-get upgrade

如果它不起作用并且您仍然会收到此错误消息,请尝试运行:

$ sudo apt-get -m upgrade

它会忽略丢失的包裹,但可能有点冒险。

答案2

最后我终于解决了这个问题。问题出在依赖关系中断上。所以我先重新构建了它,sudo apt-get build-dep然后通过检查了它sudo apt-get check。它构建了中断的依赖关系,然后我就可以成功使用了sudo apt-get upgrade:)

相关内容