Gangmax Blog

Dependency Error when running apt-get

Today I get the following error when running “apt-get”:

1
2
3
4
5
6
7
8
~> sudo apt-get update
[sudo] password for gang:
Hit:1 http://mirrors.aliyun.com/ubuntu xenial InRelease
Hit:2 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease
Hit:3 http://mirrors.aliyun.com/ubuntu xenial-backports InRelease
...
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
exit 100
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
~> sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-headers-generic (= 4.4.0.75.81); however:
Version of linux-headers-generic on system is 4.4.0.72.78.

dpkg: error processing package linux-generic (--configure):
dependency problems - leaving unconfigured
Setting up linux-image-4.4.0-75-generic (4.4.0-75.96) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-4.4.0-75-generic
vmlinuz(/boot/vmlinuz-4.4.0-75-generic
) points to /boot/vmlinuz-4.4.0-75-generic
(/boot/vmlinuz-4.4.0-75-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-4.4.0-75-generic.postinst line 491.
Examining /etc/kernel/postinst.d.
...
Found memtest86+ image: /boot/memtest86+.bin
done
Setting up linux-image-generic (4.4.0.75.81) ...
Setting up linux-image-extra-virtual (4.4.0.75.81) ...
Errors were encountered while processing:
linux-generic
exit 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
~> sudo apt-get update
Hit:1 http://mirrors.aliyun.com/ubuntu xenial InRelease
Hit:2 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease
Hit:3 http://mirrors.aliyun.com/ubuntu xenial-backports InRelease
...
Hit:25 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu xenial InRelease
Reading package lists... Done
~> sudo apt-get dist-upgrade
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:
linux-generic : Depends: linux-headers-generic (= 4.4.0.75.81) but 4.4.0.72.78 is installed
E: Unmet dependencies. Try using -f.
exit 100

It seems the following commands fix this problem finally:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
~> sudo apt-get -f install  
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
linux-headers-4.4.0-75 linux-headers-4.4.0-75-generic linux-headers-generic
The following NEW packages will be installed:
linux-headers-4.4.0-75-generic
The following packages will be upgraded:
linux-headers-4.4.0-75 linux-headers-generic
2 upgraded, 1 newly installed, 0 to remove and 29 not upgraded.
2 not fully installed or removed.
Need to get 0 B/10.7 MB of archives.
After this operation, 77.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 290587 files and directories currently installed.)
Preparing to unpack .../linux-headers-4.4.0-75_4.4.0-75.96_all.deb ...
Unpacking linux-headers-4.4.0-75 (4.4.0-75.96) over (4.4.0-75.96) ...
Selecting previously unselected package linux-headers-4.4.0-75-generic.
Preparing to unpack .../linux-headers-4.4.0-75-generic_4.4.0-75.96_amd64.deb ...
Unpacking linux-headers-4.4.0-75-generic (4.4.0-75.96) ...
Preparing to unpack .../linux-headers-generic_4.4.0.75.81_amd64.deb ...
Unpacking linux-headers-generic (4.4.0.75.81) over (4.4.0.72.78) ...
Setting up linux-headers-4.4.0-75 (4.4.0-75.96) ...
Setting up linux-headers-4.4.0-75-generic (4.4.0-75.96) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 4.4.0-75-generic /boot/vmlinuz-4.4.0-75-generic
Setting up linux-headers-generic (4.4.0.75.81) ...
Setting up linux-generic (4.4.0.75.81) ...

Comments