简体   繁体   中英

Error while attempting to install apache2 - E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)

When I try to install apache, I have got the following error.

sudo apt-get 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.13) but it is not going to be installed
           Depends: apache2-utils (>= 2.4) but it is not going to be installed
           Depends: apache2-data (= 2.4.18-2ubuntu3.13) but it is not going to be installed
           Recommends: ssl-cert but it is not going to be installed
 golang-1.6 : Depends: golang-1.6-go (>= 1.6.2-0ubuntu5~16.04.4) but it is not going to be installed
 golang-1.6-doc : Depends: golang-1.6-go but it is not going to be installed
 golang-go : Depends: golang-1.6-go but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

I have tried running

sudo apt-get update 

This also did not fix the issue.

Can anyone help me to understand this problem?

Try:

sudo apt-get -f install apache2

I just removed golang completely.

sudo find /var/lib/apt/lists -type f |xargs rm -f >/dev/null

sudo dpkg --remove golang-go

This link was useful: https://askubuntu.com/questions/252777/how-can-i-resolve-dpkg-dependency

After this, I did update. Then apache2 got installed successfully.

   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Fri 2019-10-18 11:50:14 UTC; 2min 3s ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/apache2.service
           ├─5661 /usr/sbin/apache2 -k start
           ├─5664 /usr/sbin/apache2 -k start
           └─5665 /usr/sbin/apache2 -k start

Thanks for all the responses!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM