如何清除并修复旧机器/玩具机器上损坏的 apt-get 系统,而无需重新格式化硬盘?

如何清除并修复旧机器/玩具机器上损坏的 apt-get 系统,而无需重新格式化硬盘?

我正在尝试修复apt-get一台旧玩具机,以便可以再次安装程序包。

我得到这个之后sudo apt-get install -f

$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 avahi-daemon : Depends: upstart-job
                Depends: upstart (>= 0.6.7-4) but it is not installed
 cron : Depends: upstart-job
 dbus : Depends: upstart-job
        Depends: upstart (>= 0.6.3-6) but it is not installed
 hostname : PreDepends: upstart-job
 ifupdown : Depends: upstart-job
 initscripts : Depends: upstart but it is not installed
 module-init-tools : Depends: upstart-job
 mysql-server-5.1 : Depends: upstart-job
                    Depends: upstart (>= 0.6.7-3) but it is not installed
 netbase : Depends: upstart-job
 openssh-server : Depends: upstart-job
 plymouth : Depends: upstart-job
            Depends: mountall (>= 2.0) but it is not installed
            Recommends: plymouth-theme-ubuntu-text but it is not installed or
                        plymouth-theme
 procps : Depends: upstart-job
 rsyslog : Depends: upstart-job
 screen : Depends: upstart-job
 udev : Depends: upstart-job
 ufw : Depends: upstart-job
 ureadahead : Depends: libnih1 (>= 1.0.0) but it is not installed
              Depends: upstart (>= 0.6.0) but it is not installed
 util-linux : Depends: upstart-job
 vsftpd : Depends: upstart-job
 x11-common : Depends: upstart-job
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

但是当我尝试安装时upstart-job我得到:

$ sudo apt-get install upstart-job
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'upstart' instead of 'upstart-job'
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 plymouth : Depends: mountall (>= 2.0) but it is not going to be installed
            Recommends: plymouth-theme-ubuntu-text but it is not going to be installed or
                        plymouth-theme
 upstart : Depends: libnih-dbus1 (>= 1.0.0) but it is not going to be installed
           Depends: libnih1 (>= 1.0.0) but it is not going to be installed
           Depends: mountall but it is not going to be installed
 ureadahead : Depends: libnih1 (>= 1.0.0) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

更新作品:

$ sudo apt-get update
Hit:1 http://mirrors.linode.com/ubuntu impish InRelease
Get:2 http://mirrors.linode.com/ubuntu impish-updates InRelease [110 kB]
Get:3 http://mirrors.linode.com/ubuntu impish-backports InRelease [101 kB]
Get:4 http://security.ubuntu.com/ubuntu impish-security InRelease [110 kB]
Fetched 321 kB in 1s (498 kB/s)
Reading package lists... Done

因为这是一台玩具机器,所以我愿意接受激进的方法/想法。

谢谢!

答案1

解决此问题的最简单方法是使用另一台机器(或者这台,如果可以的话)写入 Ubuntu Live 拇指驱动器,从该机器重新启动,然后选择“安装 Ubuntu”。

安装程序不会关心您是否有空白硬盘、损坏的 Ubuntu、损坏或正常运行的 Windows、损坏或正常运行的任何其他系统,只要硬件功能正常且有足够的存储空间(加上其余的系统要求),您几乎每次都会得到一个可以正常运行的系统(“几乎”只是因为有少数系统配备了某种不受支持的硬件)。

当然,如果您有需要保留的数据,请在开始之前备份这些数据。如果您将数据/home放在单独的分区上,这个过程会大大简化;即使(谨慎起见)您在重新安装后使用新的登录名,您输入的所有旧数据都/home将位于旧登录名下的文件夹中(或安全地保存在您的备份中)。

相关内容