Cannot install libevent for tor

Solution 1:

About your question, here is how I fixed the problem, I extended the answer because in the comments some users ask for that:

First, your error is a problem caused by a previous installation (for another package or update), the tor package doesn't depend on that library, I have Xubuntu 17.10 a FRESH INSTALL, and here is the output of installing tor:

sudo apt install tor

As you see, there is no requirement for libevent*, but you have to fix that error before installing tor, I suggest you to try executing the following commands:

sudo apt install libevent-dev
sudo apt install libevent1-dev
sudo apt install libevent-2.1-6

Here there is a screenshot of the output of every command (Installing the dependencies in this way produces NO ERRORS):

sudo apt install libevent-dev # This library is required for the libevent-2.1.6, Xubuntu 17.10 already comes with this version of libevent.

sudo apt install libevent-dev

sudo apt install libevent1-dev # This library is required for the libevent-1.4-2, but Xubuntu 17.10 already comes with libevent-2.1.6 so that is the cause of the conflict. I suggest you to install it, just if you really need it, otherwise, use the latest version.

sudo apt install libevent1-dev

And the last command will be sudo apt install libevent-2.1-6, this is just to prove that Xubuntu 17.10 comes with this library:

sudo apt install libevent-2.1-6

These commands will install dependencies one by one in a separate way, avoiding the conflict, because if you use sudo apt install libevent*, that command is the cause of the error message, see the image below. You're trying to install two versions of the same library at the same time.

sudo apt install libevent*

After executing those commands, I didn't get any errors and the dependencies are now correctly installed.

Finally, if you want, you can execute sudo apt autoremove, to delete the unnecesary packages.

sudo apt autoremove

Hope it helps, good luck!

Solution 2:

I encountered the same issue installing tor on Ubuntu 17.10. It turned out to be the problem with apt repository version.

I had the repo for 16.04 (Xenial) instead of 17.10 (Artful) in my /etc/apt/sources.list. After corrected it, everything works fine. You may want to double check that.

For 17.10:

deb http://deb.torproject.org/torproject.org artful main
deb-src http://deb.torproject.org/torproject.org artful main