Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apt-get conflict in Ubuntu

I have tried to install mod_security, but it has the error, so I tried aptitude:

apt-get install libapache-mod-security
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libapache-mod-security : Depends: libapache2-modsecurity but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@srv16540:~# aptitude install libapache2-modsecurity
The following NEW packages will be installed:
  apache2.2-common{ab} libapache2-modsecurity modsecurity-crs{a}
0 packages upgraded, 3 newly installed, 0 to remove and 10 not upgraded.
Need to get 660 kB of archives. After unpacking 2,861 kB will be used.
The following packages have unmet dependencies:
 apache2 : Conflicts: apache2.2-common but 2.2.22-1ubuntu1.4 is to be installed.
 apache2.2-common : Depends: apache2.2-bin (= 2.2.22-1ubuntu1.4) but 2.4.6-2~precise+1 is installed.
 apache2-bin : Conflicts: apache2.2-common but 2.2.22-1ubuntu1.4 is to be installed.
 apache2-data : Conflicts: apache2.2-common but 2.2.22-1ubuntu1.4 is to be installed.
The following actions will resolve these dependencies:

     **Keep the following packages at their current version:**
1)     apache2.2-common [Not Installed]
2)     libapache2-modsecurity [Not Installed]
3)     modsecurity-crs [Not Installed]



Accept this solution? [Y/n/q/?] q
Abandoning all efforts to resolve these dependencies.

I do now know what Keep the following packages at their current version means.

I want to know what does happen if I press yes. Does it replace my current apache2? Do I need to back up before doing this?

like image 973
Ata Avatar asked Mar 23 '23 07:03

Ata


1 Answers

ANSWERS

I do now know what Keep the following packages at their current version mean

aptitude is trying to resolve the dependencies and possible conflicts to satisfy your installation request. It then proposes a solution. In your particular case the first solution it finds is to keep everything as it actually is, that's what keep at their current version + [Not installed] means.

I want to know what does happen if I press yes , does it replace my current apache2 ?

No, that solution will basically do nothing.

Do I need back up before ?

As boring as it sounds, backups are a good strategy to save time in the long run. If you're messing with important data then it should be even more important for you.


CONTEXT

I've seen other scenarios make aptitute propose solutions with combinations like these:

  • Remove the following packages
  • Keep the following packages at their current version
  • Leave the following dependencies unresolved
  • The following packages have been kept back
  • The following packages will be upgraded
  • The following packages were automatically installed and are no longer required
  • The following extra packages will be installed
  • Suggested packages
  • The following packages will be REMOVED
  • (and probably others)

In your case if instead of accepting the solution (or quitting), you reject it by pressing n, then aptitude will try to figure out another scenario that could be useful and propose it to you again. You can iterate through the solutions doing that and if any of them satisfies you then you can accept it.


SOLUTION (?)

As far as I can see by your output:

apache2.2-common : Depends: apache2.2-bin (= 2.2.22-1ubuntu1.4) but 2.4.6-2~precise+1 is installed.

Your problem is that you have apache2-2.4.6-2~precise+1 installed which isn't available from standard Ubuntu precise repositories (most probably installed from this PPA), and you're requesting a package which conflicts with that other one.

I'd take a look at the answers on how to remove PPAs and after you have removed that source I'd reinstall apache 2.2 from the standard repos with this command:

sudo aptitude install apache2
like image 59
Sebastian Cruz Avatar answered Mar 24 '23 20:03

Sebastian Cruz