Fix apt autoremove report Unmet dependencies
After upgrading my computer to Ubuntu 18.04, I wanna remove unused packages, so
I do an apt autoremove
, unfortunately it failed with below messages:
sudo apt autoremove
[sudo] password for fdbai:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libasan2-armhf-cross : Depends: libc6-armhf-cross (>= 2.27) but 2.23-0ubuntu3cross1 is installed
libasan4-armhf-cross : Depends: libc6-armhf-cross (>= 2.27) but 2.23-0ubuntu3cross1 is installed
libatomic1-armhf-cross : Depends: libc6-armhf-cross (>= 2.27) but 2.23-0ubuntu3cross1 is installed
libcilkrts5-armhf-cross : Depends: libc6-armhf-cross (>= 2.27) but 2.23-0ubuntu3cross1 is installed
libgcc1-armhf-cross : Depends: libc6-armhf-cross (>= 2.27) but 2.23-0ubuntu3cross1 is installed
libgomp1-armhf-cross : Depends: libc6-armhf-cross (>= 2.27) but 2.23-0ubuntu3cross1 is installed
libstdc++6-armhf-cross : Depends: libc6-armhf-cross (>= 2.27) but 2.23-0ubuntu3cross1 is installed
libubsan0-armhf-cross : Depends: libc6-armhf-cross (>= 2.27) but 2.23-0ubuntu3cross1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
I tried apt --fix-broken install
as suggested, but to no avail.
After a lot of Googling, I found an answer here:
# clean cached packages under '/var/cache/apt/archives/'
sudo apt clean
# rebuild dependency tree
sudo apt autoclean
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists/*
sudo rm /var/cache/apt/*.bin
After above steps completed, the broken packages can be removed with:
sudo apt --fix-broken install
Here is the possible output message:
Reading package lists... Done
Building dependency tree
xserver-xorg-input-evdev-hwe-16.04 xserver-xorg-input-synaptics-hwe-16.04 xserver-xorg-input-wacom-hwe-16.04 xserver-xorg-legacy-hwe-16.04 xserver-xorg-video-amdgpu-hwe-16.04
xserver-xorg-video-qxl-hwe-16.04 xserver-xorg-video-vesa-hwe-16.04
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
gcc-5-arm-linux-gnueabihf gcc-7-arm-linux-gnueabihf gcc-arm-linux-gnueabihf libasan2-armhf-cross libasan4-armhf-cross libatomic1-armhf-cross libcilkrts5-armhf-cross
libgcc-5-dev-armhf-cross libgcc-7-dev-armhf-cross libgcc1-armhf-cross libgomp1-armhf-cross libstdc++6-armhf-cross libubsan0-armhf-cross
0 upgraded, 0 newly installed, 13 to remove and 0 not upgraded.
13 not fully installed or removed.
After this operation, 55.3 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 328963 files and directories currently installed.)
Removing gcc-5-arm-linux-gnueabihf (5.5.0-12ubuntu1cross1) ...
Removing gcc-arm-linux-gnueabihf (4:7.4.0-1ubuntu2.3) ...
Removing gcc-7-arm-linux-gnueabihf (7.4.0-1ubuntu1~18.04.1cross1) ...
Removing libgcc-5-dev-armhf-cross (5.5.0-12ubuntu1cross1) ...
Removing libasan2-armhf-cross (5.5.0-12ubuntu1cross1) ...
Removing libgcc-7-dev-armhf-cross (7.4.0-1ubuntu1~18.04.1cross1) ...
Removing libasan4-armhf-cross (7.4.0-1ubuntu1~18.04.1cross1) ...
Removing libatomic1-armhf-cross (8.3.0-6ubuntu1~18.04.1cross1) ...
Removing libcilkrts5-armhf-cross (7.4.0-1ubuntu1~18.04.1cross1) ...
Removing libubsan0-armhf-cross (7.4.0-1ubuntu1~18.04.1cross1) ...
Removing libstdc++6-armhf-cross (8.3.0-6ubuntu1~18.04.1cross1) ...
Removing libgnomevfs2-0:amd64 (1:2.24.4-6.1ubuntu2) ...
Removing libgnomevfs2-common (1:2.24.4-6.1ubuntu2) ...
Removing liborbit-2-0:amd64 (1:2.14.19-4) ...
Removing ruby (1:2.5.1) ...
Removing ruby2.5 (2.5.1-1ubuntu1.5) ...
Removing libruby2.5:amd64 (2.5.1-1ubuntu1.5) ...
Removing ruby-test-unit (3.2.5-1) ...
Removing ruby-did-you-mean (1.2.0-2) ...
Removing ruby-minitest (5.10.3-1) ...
Removing ruby-net-telnet (0.1.1-2) ...
Removing ruby-power-assert (0.3.0-1) ...
Removing rubygems-integration (1.11) ...
Removing rake (12.3.1-1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...
Processing triggers for sgml-base (1.29) ...
Processing triggers for gnome-icon-theme (3.12.0-3) ...
Processing triggers for bamfdaemon (0.5.3+18.04.20180207.2-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu1.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1.1) ...
Processing triggers for fontconfig (2.12.6-0ubuntu2) ...
Processing triggers for gconf2 (3.2.6-4ubuntu1) ...