我一直尝试将我的 Ubuntu 版本从 9.10 升级到 10.04(最终升级到最新版本),但是我遇到了软件包损坏的问题。
我试过了:
- apt-get 更新
- apt-get 升级
- apt-get dist-upgrade
- dpkg --configure -a(不确定为什么)
我不确定什么是相关的,所以我要转储我所拥有的内容:
升级尝试的输出:
$ sudo do-release-upgrade
Checking for a new ubuntu release
Done Upgrade tool signature
Done Upgrade tool
Done downloading
extracting 'lucid.tar.gz'
authenticate 'lucid.tar.gz' against 'lucid.tar.gz.gpg'
tar: Removing leading `/' from member names
Reading cache
Checking package manager
Reading package lists: Done
Reading state information: Done
Reading state information: Done
Reading state information: Done
Done downloading
Reading package lists: Done
Reading state information: Done
Reading state information: Done
Reading state information: Done
Updating repository information
WARNING: Failed to read mirror file
Done downloading
Checking package manager
Reading package lists: Donelucid-security/multiverse Packages: 96 gutsy/restricted Packages: 02
Reading state information: Done
Reading state information: Done
Reading state information: Done
Calculating the changes
Calculating the changes
Could not calculate the upgrade
An unresolvable problem occurred while calculating the upgrade:
E:Unable to correct problems, you have held broken packages.
This can be caused by:
* Upgrading to a pre-release version of Ubuntu
* Running the current pre-release version of Ubuntu
* Unofficial software packages not provided by Ubuntu
If none of this applies, then please report this bug against the
'update-manager' package and include the files in
/var/log/dist-upgrade/ in the bug report.
Restoring original system state
Aborting
Reading package lists: Donekarmic-security/multiverse Packages: 95 utsy/restricted Packages: 02
Reading state information: Done
Reading state information: Done
Reading state information: Done
/etc/apt/sources.list(删除了大部分注释)
$ cat sources.list
# deb cdrom:[Ubuntu 9.10 _Karmic Koala_ - Release i386 (20091028.5)]/ karmic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted
deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic main restricted
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ karmic multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
# deb http://us.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu karmic partner
deb-src http://archive.canonical.com/ubuntu karmic partner
deb http://security.ubuntu.com/ubuntu karmic-security main restricted
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted
deb http://security.ubuntu.com/ubuntu karmic-security universe
deb-src http://security.ubuntu.com/ubuntu karmic-security universe
deb http://security.ubuntu.com/ubuntu karmic-security multiverse
deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse
## Packages for Chrome
#deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
#deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
## Latest PHP packages
#deb http://php53.dotdeb.org stable all
#deb-src http://php53.dotdeb.org stable all
#deb http://security.ubuntu.com/ubuntu jaunty-security main
/var/log/dist-upgrade/main.log 的最后几行
2011-08-02 19:21:54,211 DEBUG entry 'deb-src http://security.ubuntu.com/ubuntu lucid-security multiverse' updated to new dist
2011-08-02 19:21:54,246 DEBUG running doUpdate() (showErrors=True)
2011-08-02 19:22:24,895 DEBUG openCache()
2011-08-02 19:22:24,895 DEBUG failed to SystemUnLock() (E:Not locked)
2011-08-02 19:22:29,991 DEBUG /openCache(), new cache size 30853
2011-08-02 19:22:29,991 DEBUG needServerMode(): run in 'desktop' mode, (because of pkg 'ubuntu-desktop')
2011-08-02 19:26:29,025 DEBUG Installing 'upstart-logd' (priority in required set 'required' but not scheduled for install)
2011-08-02 19:26:30,695 ERROR Dist-upgrade failed: 'E:Unable to correct problems, you have held broken packages.'
2011-08-02 19:26:30,696 DEBUG abort called
2011-08-02 19:26:30,697 DEBUG openCache()
2011-08-02 19:26:30,698 DEBUG failed to SystemUnLock() (E:Not locked)
2011-08-02 19:26:33,728 DEBUG /openCache(), new cache size 29182
2011-08-02 19:26:33,728 DEBUG enabling apt cron job
答案1
我会尝试删除 Gutsy CD 行:
deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted
答案2
我认为线索就在错误信息中 -
它抱怨 Gutsy 的存在。在您的 sources.list 文件中,您有 CDROM 作为deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted d
使用软件源窗口 - 取消勾选 CDROM。或者,只需在 sources.list 文件中的此行后面添加一个 # 即可。
答案3
您的问题很可能是由于您的机器上安装了 PPA 软件包。由于 PPA 的软件包比官方存储库的软件包更新,因此升级不知道如何替换它们。幸运的是,使用 ppa-purge 可以轻松解决这个问题。查看下面的文章,或者直接谷歌 ppa-purge 了解更多信息。
http://bigbrovar.aoizora.org/index.php/2010/01/10/how-to-safely-remove-ppa-repository-from-ubuntu/
答案4
如果你有 aptitude,sudo aptitude search ~b
它会给你损坏的软件包列表。你很可能知道应该删除哪些 ppa/软件包。
您可以在删除 PPA 后通过安装旧版本来删除它们,(apt-get install package=version
)或者您可以使用 dpkg force remove 强制删除它。
由于它没有解决问题,您可以采用更符合 Debian 的方式。用 ubuntu 10.04 sources.list 替换 sources.list 内容并执行 aptitude dist-upgrade。您可能会得到几个损坏的软件包,但您可以通过重新安装它们轻松修复它(如果您没有手动配置任何重要内容,您可以清除这些软件包并安装它们)。
如果它不起作用还有另一种选择(但很难看):
我在从 8.04 升级到 8.10 时出了事故(软件包损坏,升级中途停止),我用来恢复的解决方案是删除所有内容ubuntu-minimal
(以及一些相关的东西,主要是 wifi 驱动程序,你可以在 ncurses ui 中轻松完成 aptitude 的输入,只需输入sudo aptitude
任何参数即可)并ubuntu-desktop
在切换到新的 sources.list 并通过 dist-upgrade 升级系统后进行安装。
它会起作用,因为升级最小系统非常容易,并且它会保留大多数内容的配置。
但是此时,如果您的/home/
目录位于单独的分区上,并且没有手动配置任何重要内容(尤其是/etc/
目录),那么安装您喜欢的任何新 Ubuntu 的全新副本都会容易得多。