Ubuntu – Ubuntu 19.04 problems install upgrades

19.04upgrade

When trying to update I get an error message

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

But when I try to run this command the screen goes completely black and nothing happens. From what I can tell it is trying to install Linux headers when this happens. This is a fresh install of less than a week old. At this time I can not install anything new or update anything. How do I solve this issue?

Log File:

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.

Best Answer

I would suggest the following:

Option # 1:

Try fixing the missing packages by running the following command in the terminal:

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

If errors are encountered, try removing the the apt lock by running the following in the terminal:

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

Then:

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

Then run the command again:

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

If this does not solve the problem, please move to option # 2 below.

Option # 2:

To attempt to repair broken packages in the recovery mode, please follow these steps ( It is advised to connect your machine to Internet via Ethernet cable before you start ):

  1. Reboot your system.

  2. Hold the Shift key as soon as you pass the BIOS logo to enter the GRUB boot menu. You might need to repeat steps 1 and 2 a few times before you finally succeed.

  3. Once you see the options screen, select Advanced options for Ubuntu and press Enter:

    enter image description here

  4. In the next screen select the second line (the on with recovery mode) and press Enter:

    enter image description here

  5. Wait for the initial boot process to finish and a second screen with options appears. Select Enable networking and press Enter:

    enter image description here

  6. If presented with a yes/no screen, choose yes and press Enter:

    enter image description here

  7. If all goes well, you should be now connected to the Internet. You will know if it succeeds when the options screen shows up again. Now select Repair broken packages and press Enter:

    enter image description here

  8. If presented with a yes/no screen, choose yes and press Enter:

    enter image description here

  9. When you see at the command prompt Do you want to continue? type Y and press Enter:

    enter image description here

  10. If all goes well, the options screen will show up again:

    enter image description here

  11. Reboot your machine.

Related Question