我尝试从 Ubuntu 14.04 升级到 15.04,但出现错误:
@ubuntu14:/etc/apt$ 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:
perl : Depends: perl-modules (>= 5.20.2-2ubuntu0.1) but 5.18.2-2ubuntu1.1 is installed
Recommends: rename but it is not installed
E: Unmet dependencies. Try using -f.
然后尝试“sudo apt-get -f install”:
@ubuntu14:/etc/apt$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libguice-java libidl-common libidl0 liborbit2
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libalgorithm-c3-perl libcgi-fast-perl libcgi-pm-perl libclass-c3-perl
libclass-c3-xs-perl libcpan-meta-perl libdata-optlist-perl
libdata-section-perl libfcgi-perl libmodule-build-perl
libmodule-signature-perl libmro-compat-perl libpackage-constants-perl
libparams-util-perl libpod-readme-perl libregexp-common-perl
libsoftware-license-perl libsub-exporter-perl libsub-install-perl
libtext-template-perl perl-modules
Suggested packages:
libb-lint-perl libcpanplus-dist-build-perl libcpanplus-perl
libfile-checktree-perl liblog-message-perl libobject-accessor-perl
The following NEW packages will be installed:
libalgorithm-c3-perl libcgi-fast-perl libcgi-pm-perl libclass-c3-perl
libclass-c3-xs-perl libcpan-meta-perl libdata-optlist-perl
libdata-section-perl libfcgi-perl libmodule-build-perl
libmodule-signature-perl libmro-compat-perl libpackage-constants-perl
libparams-util-perl libpod-readme-perl libregexp-common-perl
libsoftware-license-perl libsub-exporter-perl libsub-install-perl
libtext-template-perl
The following packages will be upgraded:
perl-modules
1 upgraded, 20 newly installed, 0 to remove and 208 not upgraded.
23 not fully installed or removed.
Need to get 0 B/3,585 kB of archives.
After this operation, 2,588 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up util-linux (2.25.2-4ubuntu3) ...
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)
cat /etc/lsb-release
ubuntu14:/etc/apt$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=15.04
DISTRIB_CODENAME=vivid
DISTRIB_DESCRIPTION="Ubuntu 15.04"
知道如何修复吗?
答案1
通过下载 Ubuntu Server 16.04 ISO 来解决,并安装在旧的错误的 Ubuntu 安装上。
没有格式化 /dev/sda1 系统分区,重新指定为根分区,因此我保留了 /home/user 内容,没有丢失它们。我不得不重新创建 /etc/fstab,因为它被覆盖了。
因此,我保存了几乎所有数据,除了 /etc 中的设置和之前安装的软件包(必须再次安装)。
我希望这个解决方案能够帮助其他遇到类似问题的人。