Cannot install libevent for tor

21,263

Solution 1

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

Solution 2

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!

Share:
21,263

Related videos on Youtube

user258532
Author by

user258532

Updated on September 18, 2022

Comments

  • user258532
    user258532 almost 2 years

    When I try to install Tor, APT complains about libevent:

    $ sudo apt install tor
    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:
     tor : Depends: libevent-2.1-6 (>= 2.0.10-stable) but it is not installable
    

    I use Xubuntu 17.10 with the 4.13.8 kernel (4.13.0 prevents my computer from properly shutting down.) I have added these lines to my sources.list

    deb http://deb.torproject.org/torproject.org artful main
    deb http://deb.torproject.org/torproject.org zesty main
    

    and I've tried apt update, apt dist-upgrade and apt autoremove, without success.

    How can I install the required version of libevent?

    Update:

    When I try sudo apt install libevent*, I get the following error:

    libevent-2.1-6 is already the newest version (2.1.8-stable-4).
    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:
     libevent1-dev : Conflicts: libevent-dev but 2.1.8-stable-4 is to be installed
    E: Unable to correct problems, you have held broken packages.
    
    • xR34P3Rx
      xR34P3Rx over 6 years
      What distribution do you have? And version? Possible that the library is not supported on your system. Otherwise you could try installing it from source.
    • user258532
      user258532 over 6 years
      As I wrote, Xubuntu 17.10.
    • Admin
      Admin over 6 years
      Alternatively, you can use the TOR Bundle, no installation required (but this isn't an answer to your question, obviously, just a suggestion).
  • galoget
    galoget over 6 years
    Thanks for your comment @Zanna, I already extended the answer explaining the conflict issue in text and with screenshots proving how the issue was caused and how to solve it. =)
  • Zanna
    Zanna over 6 years
    upvoted, although I don't recommend showing screenshots of the terminal, unless you want to show something that cannot be shown by copying and pasting the text and formatting as code (eg text formatting features)
  • galoget
    galoget over 6 years
    Ok, I'll consider it for next answers, thanks for the advice.
  • Jeff
    Jeff over 5 years
    welcome to askubuntu. please don't post screenshots of the terminal instead copy the text and past it into your post.
  • workwise
    workwise over 4 years
    I was facing the sample problem. Had mistakenly used urls for ubuntu 18 instead of 16 that I have on my laptop. This fixed it!