Ubuntu 19.04 安装升级时出现问题

Ubuntu 19.04 安装升级时出现问题

尝试更新时收到错误消息

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 

但是当我尝试运行此命令时,屏幕完全变黑,什么也没有发生。据我所知,发生这种情况时,它正在尝试安装 Linux 标头。这是不到一周的全新安装。目前我无法安装任何新内容或更新任何内容。我该如何解决这个问题?

日志档案:

12:50:16 systemd-journal: Journal stopped
12:50:16 kernel: Sending SIGTERM to remaining processes...
12:50:16 kernel: Syncing filesystems and block devices.
12:50:16 kernel: printk: systemd-shutdow: 78 output lines suppressed due to ratelimiting
12:50:16 systemd: Shutting down.
12:50:15 NetworkManager: <info>  [1565373015.4510] exiting (success)
12:50:15 systemd: Stopped Raise network interfaces.
12:50:15 NetworkManager: <info>  [1565373015.4124] caught SIGTERM, shutting down normally.
12:50:15 systemd: Stopping Network Manager...
12:50:15 pulseaudio: E: [alsa-sink-HDMI 1] alsa-sink.c: Error opening PCM device hdmi:0,1: No such file or directory
12:50:15 systemd: Stopped D-Bus User Message Bus.
12:50:15 systemd-logind: Removed session 2.
12:50:15 systemd: Stopping D-Bus User Message Bus...
12:50:15 gdm-x-session: (II) Server terminated successfully (0). Closing log file.
12:50:14 systemd: Stopped ACPI event daemon.
12:50:14 (sd-pam): pam_unix(systemd-user:session): session closed for user gdm
12:50:14 systemd: gdm.service: Succeeded.
12:50:14 gdm3: Child process -1517 was already dead.
12:50:14 systemd: Started Exit the Session.
12:50:14 gdm3: Child process -1517 was already dead.
12:50:14 systemd: systemd-exit.service: Succeeded.
12:50:14 gdm-x-session: (II) systemd-logind: releasing fd for 13:65
12:50:14 systemd: Stopped sandboxed app permission store.
12:50:14 systemd-logind: Removed session c2.
12:50:14 gdm-x-session: (II) systemd-logind: releasing fd for 13:64
12:50:14 systemd: Stopping User Manager for UID 123...
12:50:14 gdm-x-session: (II) Server terminated successfully (0). Closing log file.
12:50:13 gdm3: Freeing conversation 'gdm-launch-environment' with active job
12:50:13 systemd: Stopped Network Manager Wait Online.
12:50:13 dbus-daemon: [system] Activation via systemd failed for unit 'accounts-daemon.service': Refusing activation, D-Bus is shutting down.
12:50:13 systemd: Stopped target Network is Online.
12:50:13 gdm3: Tried to look up non-existent conversation gdm-launch-environment
12:50:13 gdm-x-session: (II) systemd-logind: releasing fd for 13:68
12:50:13 avahi-daemon: avahi-daemon 0.7 exiting.
12:50:13 dbus-daemon: [system] Activating via systemd: service name='org.freedesktop.Accounts' unit='accounts-daemon.service' requested by ':1.478' (uid=0 pid=3680 comm="gdm-session-worker [pam/gdm-launch-environment] " label="unconfined")
12:50:13 systemd: Stopped CUPS Scheduler.
12:50:13 gdm3: Failed to list cached users: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.7 was not provided by any .service files
12:50:13 systemd: Stopped PackageKit Daemon.
12:50:13 udisksd: udisks daemon version 2.8.2 exiting
12:50:13 systemd: Stopped Accounts Service.
12:50:13 apport:    ...done.
12:50:13 systemd: Stopped LSB: Record successful boot for GRUB.
12:50:13 dbus-daemon: [session uid=1000 pid=3647] AppArmor D-Bus mediation is enabled
12:50:13 systemd: Stopping Authorization Manager...
12:50:13 avahi-daemon: Leaving mDNS multicast group on interface lo.IPv4 with address 127.0.0.1.
12:50:13 systemd: Stopped target Host and Network Name Lookups.
12:50:13 avahi-daemon: Leaving mDNS multicast group on interface enp7s0.IPv4 with address 192.58.0.150.
12:50:13 systemd-logind: Session c2 logged out. Waiting for processes to exit.
12:50:13 systemd: Stopping CUPS Scheduler...
12:50:13 avahi-daemon: Leaving mDNS multicast group on interface enp7s0.IPv6 with address fe80::fd7:6a47:d5ba:6c3c.
12:50:13 systemd-logind: Session 2 logged out. Waiting for processes to exit.

答案1

我建议如下:

选项1:

尝试通过在终端中运行以下命令来修复丢失的软件包:

sudo dpkg --configure -a && sudo apt update --fix-missing && sudo apt install -f && sudo apt full-upgrade

如果遇到错误,请尝试通过在终端中运行以下命令来删除 apt 锁:

sudo rm /var/lib/apt/lists/lock

然后:

sudo rm /var/cache/apt/archives/lock

然后再次运行命令:

sudo dpkg --configure -a && sudo apt update --fix-missing && sudo apt install -f && sudo apt full-upgrade

如果这不能解决问题,请转到下面的选项2。

选项 # 2:

要在恢复模式下尝试修复损坏的软件包,请按照以下步骤操作(建议通过以下方式将您的机器连接到互联网以太网电缆在你开始之前 ):

  1. 重新启动系统。

  2. 经过 BIOS 徽标后立即按住该Shift键进入GRUB 启动菜单。您可能需要重复步骤 1 和 2 几次才能最终成功。

  3. 看到选项屏幕后,选择Ubuntu 的高级选项并按Enter

    在此处输入图片描述

  4. 在下一个屏幕中选择第二行(恢复模式)并按Enter

    在此处输入图片描述

  5. 等待初始启动过程完成,然后会出现带有选项的第二个屏幕。选择启用网络并按Enter

    在此处输入图片描述

  6. 如果出现“是/否”屏幕,请选择是的并按Enter

    在此处输入图片描述

  7. 如果一切顺利,您现在应该已连接到互联网。当选项屏幕再次出现时,您将知道它是否成功。现在选择修复损坏的包并按Enter

    在此处输入图片描述

  8. 如果出现“是/否”屏幕,请选择是的并按Enter

    在此处输入图片描述

  9. 当您在命令提示符下看到你想继续吗?类型并按Enter

    在此处输入图片描述

  10. 如果一切顺利,选项屏幕将再次出现:

    在此处输入图片描述

  11. 重新启动机器。

相关内容