![升级 Ubuntu 14.04 中与第三方存储库相关的问题](https://linux22.com/image/1138492/%E5%8D%87%E7%BA%A7%20Ubuntu%2014.04%20%E4%B8%AD%E4%B8%8E%E7%AC%AC%E4%B8%89%E6%96%B9%E5%AD%98%E5%82%A8%E5%BA%93%E7%9B%B8%E5%85%B3%E7%9A%84%E9%97%AE%E9%A2%98.png)
这是我尝试安装新升级后得到的图像。我想从 16.04 升级到 14.04,但之后什么都没有发生。我是 Ubuntu 新手,不知道下一步该怎么做。
我尝试过以下命令:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -f
这是我使用这三个代码后最终得到的结果:
sparsh@sparsh-Inspiron-3558:~$ sudo apt-get update
[sudo] password for sparsh:
Ign http://dl.google.com stable InRelease
Ign http://oem.archive.canonical.com trusty-oem InRelease
Hit http://dl.google.com stable Release.gpg
Ign http://archive.ubuntu.com trusty InRelease
Hit http://oem.archive.canonical.com trusty-oem Release.gpg
Hit http://oem.archive.canonical.com trusty-oem Release
Hit http://dl.google.com stable Release
Hit http://archive.ubuntu.com trusty-updates InRelease
Hit http://oem.archive.canonical.com trusty-oem/public Sources
Hit http://dl.google.com stable/main amd64 Packages
Hit http://archive.ubuntu.com trusty-backports InRelease
Hit http://oem.archive.canonical.com trusty-oem/public amd64 Packages
Hit http://oem.archive.canonical.com trusty-oem/public i386 Packages
Hit http://archive.ubuntu.com trusty Release.gpg
Hit http://archive.ubuntu.com trusty-updates/restricted Sources
Hit http://archive.ubuntu.com trusty-updates/main Sources
Hit http://archive.ubuntu.com trusty-updates/universe Sources
Hit http://archive.ubuntu.com trusty-updates/multiverse Sources
Hit http://archive.ubuntu.com trusty-updates/restricted amd64 Packages
Ign http://oem.archive.canonical.com trusty-oem/public Translation-en_IN
Hit http://archive.ubuntu.com trusty-updates/main amd64 Packages
Ign http://oem.archive.canonical.com trusty-oem/public Translation-en
Ign http://dl.google.com stable/main Translation-en_IN
Hit http://archive.ubuntu.com trusty-updates/universe amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/multiverse amd64 Packages
Ign http://dl.google.com stable/main Translation-en
Hit http://archive.ubuntu.com trusty-updates/restricted i386 Packages
Hit http://archive.ubuntu.com trusty-updates/main i386 Packages
Hit http://archive.ubuntu.com trusty-updates/universe i386 Packages
Hit http://archive.ubuntu.com trusty-updates/multiverse i386 Packages
Hit http://archive.ubuntu.com trusty-updates/main Translation-en
Hit http://archive.ubuntu.com trusty-updates/multiverse Translation-en
Hit http://archive.ubuntu.com trusty-updates/restricted Translation-en
Hit http://archive.ubuntu.com trusty-updates/universe Translation-en
Hit http://archive.ubuntu.com trusty-backports/restricted Sources
Hit http://archive.ubuntu.com trusty-backports/universe Sources
Hit http://archive.ubuntu.com trusty-backports/multiverse Sources
Hit http://archive.ubuntu.com trusty-backports/main Sources
Hit http://archive.ubuntu.com trusty-backports/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/universe amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/multiverse amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/main amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/restricted i386 Packages
Hit http://archive.ubuntu.com trusty-backports/universe i386 Packages
Hit http://archive.ubuntu.com trusty-backports/multiverse i386 Packages
Hit http://archive.ubuntu.com trusty-backports/main i386 Packages
Ign http://archive.canonical.com trusty InRelease
Hit http://archive.canonical.com trusty Release.gpg
Hit http://archive.ubuntu.com trusty-backports/main Translation-en
Hit http://archive.canonical.com trusty Release
Hit http://archive.ubuntu.com trusty-backports/multiverse Translation-en
Hit http://archive.canonical.com trusty/partner Sources
Hit http://archive.canonical.com trusty/partner amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/restricted Translation-en
Hit http://archive.canonical.com trusty/partner i386 Packages
Hit http://archive.canonical.com trusty/partner Translation-en
Hit http://archive.ubuntu.com trusty-backports/universe Translation-en
Hit http://archive.ubuntu.com trusty Release
Hit http://archive.ubuntu.com trusty/restricted Sources
Hit http://archive.ubuntu.com trusty/main Sources
Hit http://archive.ubuntu.com trusty/universe Sources
Hit http://archive.ubuntu.com trusty/multiverse Sources
Hit http://archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty/main amd64 Packages
Hit http://archive.ubuntu.com trusty/universe amd64 Packages
Hit http://archive.ubuntu.com trusty/multiverse amd64 Packages
Hit http://archive.ubuntu.com trusty/restricted i386 Packages
Hit http://archive.ubuntu.com trusty/main i386 Packages
Hit http://security.ubuntu.com trusty-security InRelease
Hit http://security.ubuntu.com trusty-security/restricted Sources
Hit http://archive.ubuntu.com trusty/universe i386 Packages
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://archive.ubuntu.com trusty/multiverse i386 Packages
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/multiverse Sources
Hit http://security.ubuntu.com trusty-security/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty/main Translation-en
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/multiverse amd64 Packages
Hit http://archive.ubuntu.com trusty/multiverse Translation-en
Hit http://security.ubuntu.com trusty-security/restricted i386 Packages
Hit http://security.ubuntu.com trusty-security/main i386 Packages
Hit http://security.ubuntu.com trusty-security/universe i386 Packages
Hit http://archive.ubuntu.com trusty/restricted Translation-en
Hit http://security.ubuntu.com trusty-security/multiverse i386 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/multiverse Translation-en
Hit http://security.ubuntu.com trusty-security/restricted Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://archive.ubuntu.com trusty/universe Translation-en
Ign http://archive.ubuntu.com trusty/main Translation-en_IN
Ign http://archive.ubuntu.com trusty/multiverse Translation-en_IN
Ign http://archive.ubuntu.com trusty/restricted Translation-en_IN
Ign http://archive.ubuntu.com trusty/universe Translation-en_IN
Ign http://dell.archive.canonical.com trusty-dell InRelease
Hit http://dell.archive.canonical.com trusty-dell Release.gpg
Hit http://dell.archive.canonical.com trusty-dell Release
Hit http://dell.archive.canonical.com trusty-dell/public Sources
Hit http://dell.archive.canonical.com trusty-dell/public amd64 Packages
Hit http://dell.archive.canonical.com trusty-dell/public i386 Packages
Ign http://dell.archive.canonical.com trusty-dell/public Translation-en_IN
Ign http://dell.archive.canonical.com trusty-dell/public Translation-en
Reading package lists... Done
sparsh@sparsh-Inspiron-3558:~$ 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:
initramfs-tools : Depends: initramfs-tools-bin (>= 0.103ubuntu4.3) but 0.103ubuntu4 is installed
E: Unmet dependencies. Try using -f.
sparsh@sparsh-Inspiron-3558:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
initramfs-tools-bin
The following packages will be upgraded:
initramfs-tools-bin
1 upgraded, 0 newly installed, 0 to remove and 264 not upgraded.
6 not fully installed or removed.
Need to get 0 B/9,172 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
E: Invalid archive signature
E: Internal error, could not locate member control.tar.{gzbz2xzlzma}
E: Prior errors apply to /var/cache/apt/archives/initramfs-tools-bin_0.103ubuntu4.3_amd64.deb
debconf: apt-extracttemplates failed: No such file or directory
dpkg-deb: error: `/var/cache/apt/archives/initramfs-tools-bin_0.103ubuntu4.3_amd64.deb' is not a debian format archive
dpkg: error processing archive /var/cache/apt/archives/initramfs-tools-bin_0.103ubuntu4.3_amd64.deb (--unpack):
subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/initramfs-tools-bin_0.103ubuntu4.3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
sparsh@sparsh-Inspiron-3558:~$
当我尝试以下命令时
sudo apt-get install synaptic
我得到了以下关于未满足的依赖项和 initramfs 的结果
sparsh@sparsh-Inspiron-3558:~$ sudo apt-get install synaptic
[sudo] password for sparsh:
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:
initramfs-tools : Depends: initramfs-tools-bin (>= 0.103ubuntu4.3) but 0.103ubuntu4 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
sparsh@sparsh-Inspiron-3558:~$ sudo apt-get -f install synaptic
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:
initramfs-tools : Depends: initramfs-tools-bin (>= 0.103ubuntu4.3) but 0.103ubuntu4 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
sparsh@sparsh-Inspiron-3558:~$
我不知道如何解决这个 initramfs 问题
应用命令后,我最终收到某种错误
insserv: warning: script 'K02delllctservice' missing LSB tags and overrides
insserv: Service mountdevsubfs has to be enabled to start service hwclock
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
dpkg: error processing package util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
E: Sub-process /usr/bin/dpkg returned an error code (1)
我该如何解决这个错误?
答案1
警告:继续操作之前请备份所有数据。
问题几乎毫无疑问是您在尝试升级时使用了第三方存储库。每个 Linux 发行版在执行此操作时似乎都会崩溃。因此,解决方案是禁用这些存储库,删除所有软件,升级,然后重新添加所需的任何存储库和软件。根据崩溃的程度,您可能只需要备份所有数据并进行全新安装。我已经多次处理过这种情况,通常归结为后者。以下是尝试修复问题并升级而不是进行全新安装的建议。YMMV。
首先,我将指导您阅读这些内容,以便您更好地理解这个问题。在尝试本文中的其他内容之前,请随意按照他们所说的去做。 https://help.ubuntu.com/community/Upgrades https://help.ubuntu.com/community/CleanUpgrade
现在让我们开始吧。
禁用所有自定义存储库。在终端中输入以下命令:
sudo mv /etc/apt/sources.list.d /etc/apt/sources.list.d.old
sudo mkdir /etc/apt/sources.list.d
/etc/apt/sources.list 中也可能有自定义存储库。因此,我们将备份旧存储库并创建一个新存储库。
sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
sudo gedit /etc/apt/sources.list
现在您的屏幕上应该有一个空白文档。您要在其中输入什么?要回答这个问题,请转到https://repogen.simplylinux.ch/并选择您的国家和 Ubuntu 版本。然后,选择以下内容:
注意:源代码库是可选的,因此如果您不打算编译或编程任何内容,则可以跳过它们。
Ubuntu 分支:全部。
Ubuntu 更新:仅限安全和更新。
Ubuntu 合作伙伴存储库:这些存储库提供专有软件,可以在您安装 Ubuntu 时启用或禁用;仅当您愿意时才启用它们。
Ubuntu Extras Repos:以上都不是。
第三方存储库:不,不,不!不要启用其中任何一个。
转到页面底部,点击“生成列表”。将第一个小窗口中的内容复制并粘贴到空白文本文档中,然后保存。它应该看起来像这样,其中包含源和合作伙伴存储库:
#------------------------------------------------------------------------------#
# OFFICIAL UBUNTU REPOS #
#------------------------------------------------------------------------------#
###### Ubuntu Main Repos
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
###### Ubuntu Update Repos
deb http://us.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
清理本地缓存:
sudo apt-get clean
更新本地缓存:
sudo apt-get update
我们即将降级并删除不应该存在的内容。这可能会损坏您的系统或需要进行一些真正深入的修复。 如果您尚未备份所有内容,请立即备份。
安装 aptitude 并删除本地/过时的软件包(不再在存储库中)
sudo apt-get install aptitude
sudo aptitude remove ?obsolete
修复现在缺少的所有依赖项:
sudo apt-get install -f
确保你仍有一个可正常运行的 Ubuntu 安装:
sudo apt-get install ubuntu-desktop
安装并使用 deborphan 来删除孤立的软件包。
sudo apt-get install deborphan
sudo deborphan | xargs sudo apt-get remove
再次修复现在缺少的所有依赖项:
sudo apt-get install -f
再次确保您的 Ubuntu 安装仍然有效:
sudo apt-get install ubuntu-desktop
扔掉所有无缘无故存在的东西:
sudo apt-get autoremove
现在,再次尝试升级。仅在绝对必要时才查找并重新添加额外的存储库及其软件。
祝你好运!