apache2 installation error

Asked

Viewed 1,158 times

0

When executing the command sudo apt-get install apache2 the following error is returned:

Os pacotes a seguir têm dependências não satisfeitas:
apache2 : Depende: apache2-bin (= 2.4.7-1ubuntu4.9) mas não vai ser instalado
E: Não foi possível corrigir problemas, você tem pacotes mantidos (hold) estragados.

How to solve the problem?

I have tried the following commands to repair broken packages and nothing worked:

sudo apt-get clean && sudo apt-get update
dpkg --configure -a
sudo apt-get install -f

The version of Ubuntu is the 14.04 LTS.

Follow the file /etc/apt/sources.list:

deb http://pt.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty main restricted
deb http://pt.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb http://pt.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty universe
deb http://pt.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb http://pt.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://pt.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb http://pt.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main
  • @Guilhermenascimento added the data to the question.

  • @I’ve done so much that I can’t really remember what I did! I have already removed and reinstalled apache2 / php several times without problems, but now this problem occurs.

  • @Guilhermenascimento.

  • @Guilhermenascimento no, no error occurs.

  • This error occurred: Failed to get http://security.ubuntu.com/ubuntu/dists/trusty-security/main/i18n/Translation-en Hash verification code does not match

  • @Guilhermenascimento ok I did this, the error I posted in the comments does not occur but still gives the error I entered in the question.

  • @Guilhermenascimento solved the problem. In addition to using synaptic (thanks for the tip), I used the command "sudo aptitude install apache2".

  • put as answer, even if very simple the tip of aptitude is very powerful, I didn’t even remember this command :/

  • @Guilhermenascimento I did what you posted in the reply too and in the end I did the aptitude. You can supplement your answer with this tip, it gets more complete, so mark as certain.

Show 4 more comments

1 answer

0


Open the terminal and enter the following commands:

  • Rename the current sources.list (or remove):

    sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
    
  • Open the program software-properties-gtk:

    sudo software-properties-gtk
    

This was to restart the sources.list as in the reply from askubuntu, then select the options as in the image:

software-properties-gtk setup

Only that in the Download from select Other... and look for the repository of your country (I usually use the same American), this will generate a new sources.list.

Now run the following commands:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
sudo apt-get autoclean

Maybe some "important" things will be uninstalled, but you can reinstall again.

So try to run the:

sudo apt-get install apache2

If it fails again try to do the process again, instead of using the rename command do the following:

sudo apt-get clean
sudo mv /var/lib/apt/lists /var/lib/apt/lists.old
sudo rm -rf /var/lib/apt/lists/

Then open the software-properties-gtk and follow the same steps mentioned above.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.