我使用的是 Ubuntu 12.04。使用 apt-get 安装任何软件包时都会遇到错误。我尝试了各种论坛中给出的步骤,但无法解决错误。例如,如果我安装 kcachegrind,错误代码为:
[我已将 http:// 替换为 http//,以避免在发布问题时出现链接。因此,请在代码段中将 http// 读作 http://。]
lap471@admin:~/bin$ sudo apt-get install kcachegrind
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:
kcachegrind : Depends: kde-runtime but it is not going to be installed
Depends: libkdecore5 (>= 4:4.4.0) but it is not going to be installed
Depends: libkdeui5 (>= 4:4.3.4) but it is not going to be installed
Depends: libkio5 (>= 4:4.3.4) but it is not going to be installed
Recommends: valgrind but it is not going to be installed
Recommends: graphviz but it is not going to be installed
libcairo-perl : Depends: perlapi-5.14.2
libdbi-perl : Depends: perlapi-5.14.2
libglib-perl : Depends: perlapi-5.14.2
libgtk2-perl : Depends: perlapi-5.14.2
libpango-perl : Depends: perlapi-5.14.2
libperl5.14 : Depends: perl-base (= 5.14.2-6ubuntu2.4) but 5.10.0-24ubuntu4 is to be installed
libterm-readkey-perl : Depends: perlapi-5.14.2
libtext-charwidth-perl : Depends: perl-base (>= 5.14.2-3) but 5.10.0-24ubuntu4 is to be installed
Depends: perlapi-5.14.2
libtext-iconv-perl : Depends: perl-base (>= 5.14.2-6) but 5.10.0-24ubuntu4 is to be installed
Depends: perlapi-5.14.2
libuuid-perl : Depends: perl-base (>= 5.14.2-6ubuntu1) but 5.10.0-24ubuntu4 is to be installed
Depends: perlapi-5.14.2
perl : Depends: perl-base (= 5.14.2-6ubuntu2.4) but 5.10.0-24ubuntu4 is to be installed
E: Unmet dependencies.enter code here Try 'apt-get -f install' with no packages (or specify a solution).
如果我尝试sudo apt-get -f install
,仍然会出现错误:
lap471@admin:~/bin$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
libsensors3
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libdbd-mysql-perl liblocale-gettext-perl libmysqlclient18
mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server
mysql-server-5.5 mysql-server-core-5.5 perl-base
Suggested packages:
tinyca mailx
The following packages will be REMOVED:
mysql-client-5.1 mysql-server-5.1 mysql-server-core-5.1
The following NEW packages will be installed:
libmysqlclient18 mysql-client-5.5 mysql-client-core-5.5 mysql-server-5.5
mysql-server-core-5.5
The following packages will be upgraded:
libdbd-mysql-perl liblocale-gettext-perl mysql-common mysql-server
perl-base
5 upgraded, 5 newly installed, 3 to remove and 553 not upgraded.
13 not fully installed or removed.
Need to get 0 B/27.1 MB of archives.
After this operation, 43.4 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
mysql-client-core-5.5 mysql-client-5.5 mysql-server-core-5.5 mysql-common
mysql-server mysql-server-5.5 libmysqlclient18 libdbd-mysql-perl
perl-base liblocale-gettext-perl
Install these packages without verification [y/N]? y
/usr/bin/perl: symbol lookup error: /usr/lib/perl5/auto/Text/Iconv/Iconv.so: undefined symbol: Perl_xs_apiversion_bootcheck
(Reading database ... 147200 files and directories currently installed.)
Unpacking mysql-client-core-5.5 (from .../mysql-client-core-5.5_5.5.35-0ubuntu0.12.04.2_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/mysql-client-core-5.5_5.5.35-0ubuntu0.12.04.2_i386.deb (--unpack):
trying to overwrite '/usr/share/man/man1/mysqlcheck.1.gz', which is also in package mysql-client-5.1 5.1.37-1ubuntu5.5
No apport report written because MaxReports is reached already
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Processing triggers for man-db ...
Errors were encountered while processing:
/var/cache/apt/archives/mysql-client-core-5.5_5.5.35-0ubuntu0.12.04.2_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
sources.list 文件是:
lap471@admin:~/bin$ cat /etc/apt/sources.list
# deb cdrom:[Ubuntu 12.04.1 LTS _Precise Pangolin_ - Release i386 (20120817.3)]/ precise main restricted
# See http//help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http//in.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http//in.archive.ubuntu.com/ubuntu/ precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http//in.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http//in.archive.ubuntu.com/ubuntu/ precise-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http//in.archive.ubuntu.com/ubuntu/ precise universe
deb-src http//in.archive.ubuntu.com/ubuntu/ precise universe
deb http//in.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http//in.archive.ubuntu.com/ubuntu/ precise-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http//in.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http//in.archive.ubuntu.com/ubuntu/ precise multiverse
deb http//in.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http//in.archive.ubuntu.com/ubuntu/ precise-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http//in.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http//in.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http//security.ubuntu.com/ubuntu precise-security main restricted
deb-src http//security.ubuntu.com/ubuntu precise-security main restricted
deb http//security.ubuntu.com/ubuntu precise-security universe
deb-src http//security.ubuntu.com/ubuntu precise-security universe
deb http//security.ubuntu.com/ubuntu precise-security multiverse
deb-src http//security.ubuntu.com/ubuntu precise-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http//archive.canonical.com/ubuntu precise partner
# deb-src http//archive.canonical.com/ubuntu precise partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http//extras.ubuntu.com/ubuntu precise main
deb-src http//extras.ubuntu.com/ubuntu precise main
deb http//archive.canonical.com/ precise partner
deb-src http//archive.canonical.com/ precise partner
并且 sources.list.d/* 包含:
lap471@admin:~/bin$ cat /etc/apt/sources.list.d/*
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb http//dl.google.com/linux/chrome/deb/ stable main
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb http//dl.google.com/linux/chrome/deb/ stable main
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb http//dl.google.com/linux/talkplugin/deb/ stable main
# needed sources vor php5.2:
deb http//old-releases.ubuntu.com/ubuntu/ karmic main restricted
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic main restricted
deb http//old-releases.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic-updates main restricted
deb http//old-releases.ubuntu.com/ubuntu/ karmic universe
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic universe
deb http//old-releases.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic-updates universe
deb http//old-releases.ubuntu.com/ubuntu/ karmic multiverse
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic multiverse
deb http//old-releases.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic-updates multiverse
deb http//old-releases.ubuntu.com/ubuntu karmic-security main restricted
deb-src http//old-releases.ubuntu.com/ubuntu karmic-security main restricted
deb http//old-releases.ubuntu.com/ubuntu karmic-security universe
deb-src http//old-releases.ubuntu.com/ubuntu karmic-security universe
deb http//old-releases.ubuntu.com/ubuntu karmic-security multiverse
deb-src http//old-releases.ubuntu.com/ubuntu karmic-security multiverse
# needed sources vor php5.2:
deb http//old-releases.ubuntu.com/ubuntu/ karmic main restricted
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic main restricted
deb http//old-releases.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic-updates main restricted
deb http//old-releases.ubuntu.com/ubuntu/ karmic universe
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic universe
deb http//old-releases.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic-updates universe
deb http//old-releases.ubuntu.com/ubuntu/ karmic multiverse
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic multiverse
deb http//old-releases.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http//old-releases.ubuntu.com/ubuntu/ karmic-updates multiverse
deb http//old-releases.ubuntu.com/ubuntu karmic-security main restricted
deb-src http//old-releases.ubuntu.com/ubuntu karmic-security main restricted
deb http//old-releases.ubuntu.com/ubuntu karmic-security universe
deb-src http//old-releases.ubuntu.com/ubuntu karmic-security universe
deb http//old-releases.ubuntu.com/ubuntu karmic-security multiverse
deb-src http//old-releases.ubuntu.com/ubuntu karmic-security multiverse
任何帮助都将非常感谢。谢谢。
答案1
尝试以下命令,
sudo dpkg -P mysql-client-5.1
sudo apt-get install -f