Ubuntu – How to fix unmet dependencies for udev:amd64 error on Ubuntu 18.04

aptdependenciesdpkgpackage-managementudev

I am running Ubuntu 18.04.

As usual, I ran:

sudo apt-get update
sudo apt-get upgrade 

but then I got the following error:

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:
 udev : Depends: libudev1 (= 237-3ubuntu10.6) but 237-3ubuntu10.9 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

I tried sudo apt --fix-broken install but did not work and return this error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  udev
The following packages will be upgraded:
  udev
1 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/1,101 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
E: Invalid archive member header 
E: Prior errors apply to /var/cache/apt/archives/udev_237-3ubuntu10.9_amd64.deb
debconf: apt-extracttemplates failed: No such file or directory
(Reading database ... 212689 files and directories currently installed.)
Preparing to unpack .../udev_237-3ubuntu10.9_amd64.deb ...
Unpacking libudev1:amd64 (237-3ubuntu10.9) over (237-3ubuntu10.9) ...
Setting up libudev1:amd64 (237-3ubuntu10.9) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
W: APT had planned for dpkg to do more than it reported back (0 vs 6).
   Affected packages: udev:amd64

I also tried removing(to reinstall it from scratch) udev with sudo apt purge udev but I get this error message:

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:
 alsa-base : Depends: udev
 bluez : Depends: udev (>= 170-1)
 gnome-bluetooth : Depends: udev (>= 154)
 initramfs-tools-core : Depends: udev
 libsane1 : Depends: udev or
                     makedev but it is not going to be installed
 media-player-info : Depends: udev
 network-manager : Depends: udev
 plymouth : Depends: udev (>= 232-8~)
 snapd : Depends: udev
 ubuntu-drivers-common : Depends: udev (>= 204-0ubuntu4~)
 ubuntu-minimal : Depends: udev
 udisks2 : Depends: udev
 upower : Depends: udev
 xserver-xorg-core : Depends: udev (>= 149)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). 

I tried some other options that I found on similar problems(unmet dependencies) but one of these errors always comes up:

W: APT had planned for dpkg to do more than it reported back (0 vs 6).
   Affected packages: udev:amd64

or

The following packages have unmet dependencies:
 udev : Depends: libudev1 (= 237-3ubuntu10.6) but 237-3ubuntu10.9 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

I am getting a error mark on the menu bar because of this. How can I fix this?

[EDIT]
As requested by Mark J. Adams this is the output of apt rdepends --installed libudev1:

libudev1
Reverse Depends:
  Depends: udev (= 237-3ubuntu10.6)
  Depends: libgnome-desktop-3-17 (>= 196)
  Depends: libapt-pkg5.0 (>= 183)
  Depends: gstreamer1.0-vaapi (>= 183)
  Depends: xserver-xorg-core (>= 183)
  Depends: xserver-xephyr (>= 183)
  PreDepends: util-linux (>= 183)
  Depends: udev (= 237-3ubuntu10.9)
  Depends: snapd (>= 183)
  Depends: pulseaudio (>= 183)
  Depends: network-manager (>= 183)
  Depends: libplymouth4 (>= 183)
  Depends: libnm0 (>= 183)
  Depends: libmutter-2-0 (>= 183)
  Depends: libgnome-desktop-3-17 (>= 196)
  Depends: libbluetooth3 (>= 183)
  Depends: libapt-pkg5.0 (>= 183)
  Depends: initramfs-tools-bin (>= 183)
  Depends: bolt (>= 183)
  Depends: bluez (>= 196)
  Depends: gstreamer1.0-vaapi (>= 183)
  Depends: xserver-xorg-video-radeon (>= 183)
  Depends: xserver-xorg-video-qxl (>= 183)
  Depends: xserver-xorg-video-nouveau (>= 183)
  Depends: xserver-xorg-video-intel (>= 183)
  Depends: xserver-xorg-video-amdgpu (>= 183)
  Depends: xserver-xorg-input-wacom (>= 183)
  Depends: xserver-xorg-core (>= 183)
  Depends: xserver-xephyr (>= 183)
  PreDepends: util-linux (>= 183)
  Depends: udev (= 237-3ubuntu10)
  Depends: system-config-printer-udev (>= 183)
  Depends: snapd (>= 183)
  Depends: pulseaudio (>= 183)
  Depends: network-manager (>= 183)
  Depends: libusb-1.0-0 (>= 183)
  Depends: libqt5gui5 (>= 183)
  Depends: libplymouth4 (>= 183)
  Depends: libpci3 (>= 196)
  Depends: libnm0 (>= 183)
  Depends: libmutter-2-0 (>= 183)
  Depends: libgudev-1.0-0 (>= 199)
  Depends: libinput10 (>= 183)
  Depends: libinput-bin (>= 183)
  Depends: libgnome-desktop-3-17 (>= 196)
  Depends: libgnome-bluetooth13 (>= 196)
  Depends: libfreerdp-client2-2 (>= 183)
  Depends: libdevmapper1.02.1 (>= 183)
  Depends: libcolord2 (>= 196)
  Depends: libclutter-1.0-0 (>= 183)
  Depends: libbluetooth3 (>= 183)
  Depends: libblockdev-utils2 (>= 216)
  Depends: bolt (>= 183)
  Depends: libatasmart4 (>= 183)
  Depends: libapt-pkg5.0 (>= 183)
  Depends: initramfs-tools-bin (>= 183)
  Depends: dosfstools (>= 183)
  Depends: bluez (>= 196)

Best Answer

I was able to fix this by forcibly overwriting /var/cache/apt/archives/udev_237-3ubuntu10.9_amd64.deb

sudo dpkg -i --force-overwrite /var/cache/apt/archives/udev_237-3ubuntu10.9_amd64.deb
sudo apt purge udev
sudo apt-get update
sudo apt-get upgrade