Ubuntu 12.04.2 LTS 用apt-get安装软件总是会出错?

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
yaoike
帖子: 4
注册时间: 2013-06-18 9:55
系统: ubuntu 12.04.2

Ubuntu 12.04.2 LTS 用apt-get安装软件总是会出错?

#1

帖子 yaoike » 2013-06-20 15:12

大家好,我是Ubuntu新手,初来乍到,遇到一些问题,还请大家指点一下,谢谢!

最近在VMware上安装了Ubuntu 12.04.2 LTS,刚开始使用的时候一切都很正常,但是,最近,不知道怎么回事,一安装软件就会出错,我上google查了相关的出错信息,也按照上面的步骤去做了一遍,都无济于事,所以,在此向各位达人寻求帮助,请各位达人帮忙分析一下原因及如何解决?

问题描述如下:比如,我想安装dnsutils:

yaob@yaob-virtual-machine:~$ sudo apt-get install dnsutils
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:
dnsutils : Depends: libbind9-80 (= 1:9.8.1.dfsg.P1-4ubuntu0.6) but 1:9.8.1.dfsg.P1-4ubuntu0.5 is to be installed
Depends: libdns81 (= 1:9.8.1.dfsg.P1-4ubuntu0.6) but 1:9.8.1.dfsg.P1-4ubuntu0.5 is to be installed
Depends: libisc83 (= 1:9.8.1.dfsg.P1-4ubuntu0.6) but 1:9.8.1.dfsg.P1-4ubuntu0.5 is to be installed
Depends: libisccfg82 (= 1:9.8.1.dfsg.P1-4ubuntu0.6) but 1:9.8.1.dfsg.P1-4ubuntu0.5 is to be installed
Depends: liblwres80 (= 1:9.8.1.dfsg.P1-4ubuntu0.6) but 1:9.8.1.dfsg.P1-4ubuntu0.5 is to be installed
libc6 : Recommends: libc6-i686
Breaks: locales (< 2.17) but 2.13+git20120306-3 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
yaob@yaob-virtual-machine:~$

此外,我试过google到的sudo apt-get clean; sudo apt-get update;方法
刚开始还很顺利,但到后面就出错了,这是出错信息。

Hit http://archive.ubuntu.com precise-security/restricted Translation-en
Hit http://archive.ubuntu.com precise-security/universe Translation-en
Fetched 6,791 kB in 5min 37s (20.1 kB/s)
W: There is no public key available for the following key IDs:
8B48AD6246925553
W: GPG error: http://archive.ubuntu.com precise-backports Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <[email protected]>
W: Size of file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise-backports_main_source_Sources is not what the server reported 0 121605
W: Failed to fetch cdrom://Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release i386 (20130214)/dists/precise/main/binary-i386/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs

W: Failed to fetch cdrom://Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release i386 (20130214)/dists/precise/restricted/binary-i386/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs

W: Failed to fetch http://http.us.debian.org/debian/dists/ ... kagesIndex MD5Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_precise_main_source_Sources Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.
yaob@yaob-virtual-machine:~$
头像
zhw2101024
帖子: 1849
注册时间: 2009-03-28 16:10
系统: Arch debian win7
联系:

Re: Ubuntu 12.04.2 LTS 用apt-get安装软件总是会出错?

#2

帖子 zhw2101024 » 2013-06-20 15:59

有没有自己修改过源列表?
yaoike
帖子: 4
注册时间: 2013-06-18 9:55
系统: ubuntu 12.04.2

Re: Ubuntu 12.04.2 LTS 用apt-get安装软件总是会出错?

#3

帖子 yaoike » 2013-06-20 16:38

修改过:这是我的/etc/apt/sources.list文件内容:

# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release i386 (20130214)]/ precise main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release i386 (20130214)]/ precise main restricted
deb http://archive.ubuntu.com/ubuntu precise main restricted
deb-src http://archive.ubuntu.com/ubuntu precise main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted
deb-src http://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://archive.ubuntu.com/ubuntu precise universe
deb-src http://archive.ubuntu.com/ubuntu precise universe
deb http://archive.ubuntu.com/ubuntu precise-updates universe
deb-src http://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://archive.ubuntu.com/ubuntu precise multiverse
deb-src http://archive.ubuntu.com/ubuntu precise multiverse
deb http://archive.ubuntu.com/ubuntu precise-updates multiverse
deb-src http://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://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu precise-security main restricted
deb-src http://archive.ubuntu.com/ubuntu precise-security main restricted
deb http://archive.ubuntu.com/ubuntu precise-security universe
deb-src http://archive.ubuntu.com/ubuntu precise-security universe
deb http://archive.ubuntu.com/ubuntu precise-security multiverse
deb-src http://archive.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://http.us.debian.org/debian testing main non-free contrib
deb-src http://http.us.debian.org/debian testing main
头像
zhw2101024
帖子: 1849
注册时间: 2009-03-28 16:10
系统: Arch debian win7
联系:

Re: Ubuntu 12.04.2 LTS 用apt-get安装软件总是会出错?

#4

帖子 zhw2101024 » 2013-06-21 8:56

deb http://http.us.debian.org/debian testing main non-free contrib
deb-src http://http.us.debian.org/debian testing main
ubuntu怎么加了debian的源?真是乱来。
ubuntu确实是从debian构建的,但是不代表就能混在一起用啊
yaoike
帖子: 4
注册时间: 2013-06-18 9:55
系统: ubuntu 12.04.2

Re: Ubuntu 12.04.2 LTS 用apt-get安装软件总是会出错?

#5

帖子 yaoike » 2013-06-21 16:21

你好,现在我把源改为163的,但是,sudo apt-get update还是会出错,请问是怎么回事?

# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release i386 (20130214)]/ precise main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release i386 (20130214)]/ precise main restricted
deb http://mirrors.163.com/ubuntu/ precise main restricted
deb-src http://mirrors.163.com/ubuntu/ precise main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.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://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.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://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.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://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ precise-security main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted
deb http://mirrors.163.com/ubuntu/ precise-security universe
deb-src http://mirrors.163.com/ubuntu/ precise-security universe
deb http://mirrors.163.com/ubuntu/ precise-security multiverse
deb-src http://mirrors.163.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



我尝试做了一个上午的操作,结果都不行,试了好多种方法:
cd /var/lib/apt
sudo mv lists lists.old
sudo mkdir -p lists/partial
sudo apt-get update

结果出错:
Hit http://mirrors.163.com precise/multiverse i386 Packages
Get:7 http://mirrors.163.com precise-security/multiverse i386 Packages/DiffIndex [121 kB]
W: GPG error: http://extras.ubuntu.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192
W: GPG error: http://mirrors.163.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
W: GPG error: http://mirrors.163.com precise-updates Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
W: GPG error: http://mirrors.163.com precise-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
W: GPG error: http://mirrors.163.com precise-security Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
E: Unable to parse package file /var/lib/apt/lists/mirrors.163.com_ubuntu_dists_precise-security_multiverse_binary-i386_Packages.IndexDiff (1)

然后我:
yaob@yaob-virtual-machine:/var/lib/apt$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.d19XKZZpPB --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192
gpg: requesting key 3E5C1192 from hkp server keyserver.ubuntu.com
gpg: key 3E5C1192: public key "Ubuntu Extras Archive Automatic Signing Key <[email protected]>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1


yaob@yaob-virtual-machine:/var/lib/apt$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.8JeuehvPTZ --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
gpg: requesting key 437D05B5 from hkp server keyserver.ubuntu.com
gpg: key 437D05B5: public key "Ubuntu Archive Automatic Signing Key <[email protected]>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1

yaob@yaob-virtual-machine:/var/lib/apt$


都成功导入了,但为什么
再次update,还是会出错:
yaob@yaob-virtual-machine:/var/lib/apt$ sudo apt-get update
...
Hit http://mirrors.163.com precise-security/universe Translation-en
Get:12 http://mirrors.163.com precise-security/main Translation-en [140 kB]
Fetched 5,648 kB in 1min 5s (85.9 kB/s)
W: GPG error: http://mirrors.163.com precise-security Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <[email protected]>
W: Failed to fetch http://mirrors.163.com/ubuntu/dists/pre ... i18n/Index

W: Failed to fetch http://mirrors.163.com/ubuntu/dists/pre ... i18n/Index No Hash entry in Release file /var/lib/apt/lists/partial/mirrors.163.com_ubuntu_dists_precise-security_restricted_i18n_Index

E: Some index files failed to download. They have been ignored, or old ones used instead.

前面那一个命令不是已经成功把40976EAF437D05B5给导入进去了吗?
请问我要怎么解决这个问题呢?我没有使用任何代理,深圳电信的网络。
非常感谢你前面的解答!
头像
zhw2101024
帖子: 1849
注册时间: 2009-03-28 16:10
系统: Arch debian win7
联系:

Re: Ubuntu 12.04.2 LTS 用apt-get安装软件总是会出错?

#6

帖子 zhw2101024 » 2013-06-22 10:14

BADSIG 40976EAF437D05B5
可能这个是debian源里的public key,在ubuntu的源里没找到,所以报错了。只是猜测,现在已经不用ubuntu了
帮你顶一下,希望有人愿意测试一下吧
头像
luojie-dune
帖子: 22033
注册时间: 2007-07-30 18:28
系统: Linux
来自: 空气中

Re: Ubuntu 12.04.2 LTS 用apt-get安装软件总是会出错?

#7

帖子 luojie-dune » 2013-06-22 10:16

重装就好了,反正是虚拟机。
『这个世界都是我的 ,我爱你们』

ENTP ⥂ INTP ⥄ INFP ⇦ INTJ

在此发布的文章使用 Creative Commons Attribution-ShareAlike 4.0 协议
yaoike
帖子: 4
注册时间: 2013-06-18 9:55
系统: ubuntu 12.04.2

Re: Ubuntu 12.04.2 LTS 用apt-get安装软件总是会出错?

#8

帖子 yaoike » 2013-06-24 10:37

哦,好的。我再装一次。主要是之前都是因为同样的问题重装了3次,每次都不知道原因。现在知道原因了,那就再装一次吧,多谢!
回复