I was running sudo apt update ; sudo apt upgrade -y
and midway through the installation my computer ran out of battery and shut down abruptly. Side note - I'm using the Windows Subsystem for Linux on Windows 10.
Now when I run sudo apt upgrade
I'm getting errors that I can't figure out how to work around. Here's what I get:
~$ sudo apt upgrade -y
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:
libpam-systemd : Depends: systemd (= 229-4ubuntu21.6) but 229-4ubuntu21.4 is installed
systemd : Depends: libsystemd0 (= 229-4ubuntu21.4) but 229-4ubuntu21.6 is installed
E: Unmet dependencies. Try using -f.
So I try that and here's what I get:
~$ sudo apt upgrade -y -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
Calculating upgrade... Done
The following NEW packages will be installed:
ubuntu-advantage-tools
The following packages will be upgraded:
apt-transport-https cloud-init curl distro-info-data dpkg-dev friendly-recovery gettext-base kmod libasprintf0v5 libcurl3 libcurl3-gnutls libdpkg-perl libgs9 libgs9-common libkmod2 libmspack0 libpam-systemd libsystemd0 libudev1
linux-libc-dev openssh-client openssh-server openssh-sftp-server python3-cryptography python3-requests python3-update-manager systemd systemd-sysv tzdata ubuntu-minimal ubuntu-standard udev update-manager-core yarn
34 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 5,245 kB/17.6 MB of archives.
After this operation, 531 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpam-systemd amd64 229-4ubuntu21.8 [115 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libudev1 amd64 229-4ubuntu21.8 [54.1 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 udev amd64 229-4ubuntu21.8 [993 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libsystemd0 amd64 229-4ubuntu21.8 [204 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 systemd amd64 229-4ubuntu21.8 [3,775 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 systemd-sysv amd64 229-4ubuntu21.8 [11.6 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libasprintf0v5 amd64 0.19.7-2ubuntu3.1 [6,568 B]
Get:8 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 gettext-base amd64 0.19.7-2ubuntu3.1 [48.0 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libmspack0 amd64 0.5-1ubuntu0.16.04.3 [37.4 kB]
Fetched 5,245 kB in 15s (333 kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 60877 files and directories currently installed.)
Preparing to unpack .../libpam-systemd_229-4ubuntu21.8_amd64.deb ...
Unpacking libpam-systemd:amd64 (229-4ubuntu21.8) over (229-4ubuntu21.6) ...
Preparing to unpack .../libudev1_229-4ubuntu21.8_amd64.deb ...
Unpacking libudev1:amd64 (229-4ubuntu21.8) over (229-4ubuntu21.4) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Setting up libudev1:amd64 (229-4ubuntu21.8) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
(Reading database ... 60877 files and directories currently installed.)
Preparing to unpack .../udev_229-4ubuntu21.8_amd64.deb ...
Unpacking udev (229-4ubuntu21.8) over (229-4ubuntu21.4) ...
Preparing to unpack .../libsystemd0_229-4ubuntu21.8_amd64.deb ...
Unpacking libsystemd0:amd64 (229-4ubuntu21.8) over (229-4ubuntu21.6) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Setting up libsystemd0:amd64 (229-4ubuntu21.8) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
(Reading database ... 60877 files and directories currently installed.)
Preparing to unpack .../systemd_229-4ubuntu21.8_amd64.deb ...
Unpacking systemd (229-4ubuntu21.8) over (229-4ubuntu21.4) ...
dpkg: error processing archive /var/cache/apt/archives/systemd_229-4ubuntu21.8_amd64.deb (--unpack):
unable to make backup symlink for './lib/systemd/system/checkroot-bootclean.service': No such file or directory
No apport report written because the error message indicates an issue on the local system
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for dbus (1.10.6-1ubuntu3.3) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
/var/cache/apt/archives/systemd_229-4ubuntu21.8_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I also tried running sudo apt-get -f install
and got:
~$ sudo apt-get -f install
[sudo] password for andre:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
systemd
Suggested packages:
systemd-ui systemd-container
The following packages will be upgraded:
systemd
1 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.
3 not fully installed or removed.
Need to get 0 B/3,775 kB of archives.
After this operation, 8,192 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 60877 files and directories currently installed.)
Preparing to unpack .../systemd_229-4ubuntu21.8_amd64.deb ...
Unpacking systemd (229-4ubuntu21.8) over (229-4ubuntu21.4) ...
dpkg: error processing archive /var/cache/apt/archives/systemd_229-4ubuntu21.8_amd64.deb (--unpack):
unable to make backup symlink for './lib/systemd/system/checkroot-bootclean.service': No such file or directory
No apport report written because the error message indicates an issue on the local system
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for dbus (1.10.6-1ubuntu3.3) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
/var/cache/apt/archives/systemd_229-4ubuntu21.8_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
How do I fix this and get my package manager back to a healthy state?
sudo apt-get -f install
? – Sherif Salah Nov 12 '18 at 20:21