Ubuntu 16.04 Apache of dpkg: error processing package linux-generic
1、sudo apt install apache2
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: apache2 : Depends: apache2-bin (= 2.4.18-2ubuntu3.5) but it is not going to be installed Depends: apache2-utils (>= 2.4) Depends: apache2-data (= 2.4.18-2ubuntu3.5) but it is not going to be installed Recommends: ssl-cert but it is not going to be installed linux-generic : Depends: linux-headers-generic (= 4.4.0.96.101) but 4.4.0.81.87 is to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
提示已经安装好了,但自己并没在机器上发现相关的服务信息,试试提示的 apt-get -f install 吧
2、sodu apt-get -f install
Preparing to unpack .../linux-headers-4.4.0-96-generic_4.4.0-96.119_amd64.deb ... dpkg: unrecoverable fatal error, aborting: unable to create '/var/lib/dpkg/updates/tmp.i': No space left on device E: Sub-process /usr/bin/dpkg returned an error code (2)
提示 No space left on device ,既然是在 updates 的问题,通常我的解决办法是升级下
3、sudo apt-get update
Hit:1 http://cn.archive.ubuntu.com/ubuntu xenial InRelease Hit:2 http://cn.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:3 http://cn.archive.ubuntu.com/ubuntu xenial-backports InRelease Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB] Fetched 102 kB in 1s (64.9 kB/s) E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. root@xx# sudo dpkg --configure -a dpkg: dependency problems prevent configuration of linux-generic: linux-generic depends on linux-headers-generic (= 4.4.0.96.101); however: Version of linux-headers-generic on system is 4.4.0.81.87. dpkg: error processing package linux-generic (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: linux-generic
又报错了,按提示来 sudo dpkg --configure -a
4、sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of linux-generic: linux-generic depends on linux-headers-generic (= 4.4.0.96.101); however: Version of linux-headers-generic on system is 4.4.0.81.87. dpkg: error processing package linux-generic (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: linux-generic
可还是报错,最后经过尝试,将 linux-generic 先 remove,然后就不会报错,,可以成功执行了
5、sudo apt-get remove linux-generic
After this operation, 13.3 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 522867 files and directories currently installed.) Removing linux-generic (4.4.0.96.101) ... Removing linux-headers-4.4.0-96-generic (4.4.0-96.119) ...
在去执行 update 操作,成功
6、sudo apt-get update
Hit:1 http://cn.archive.ubuntu.com/ubuntu xenial InRelease Hit:2 http://cn.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:3 http://cn.archive.ubuntu.com/ubuntu xenial-backports InRelease Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB] Fetched 102 kB in 2s (45.0 kB/s) Reading package lists... Done
7、sudo apt install apache2 OK
浙公网安备 33010602011771号