Linux – Installing Mercurial on Debian using apt-get

apt-getdebianlinuxmercurial

I am trying to install Mercurial using apt-get on a web server running Debian. I would prefer to have the latest stable version of Mercurial but I would be happy with anything reasonably recent. I tried entering the command sudo apt-get install mercurial and I got the following response:

Reading package lists... Done
Building dependency tree... Done
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
  mercurial: Depends: libc6 (>= 2.4) but 2.3.6.ds1-13etch10 is to be installed
             Depends: python (>= 2.5) but 2.4.4-2 is to be installed
             Depends: python-support (>= 0.90.0) but 0.5.6 is to be installed
             Depends: mercurial-common (= 1.7.5-1) but it is not going to be installed
  trac: Depends: python-genshi but it is not installable
W: Couldn't stat source package list http://debian.newdream.net etch/main Packages (/var/lib/apt/lists/debian.newdream.net_dists_etch_main_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://debian.newdream.net etch/non-free Packages (/var/lib/apt/lists/debian.newdream.net_dists_etch_non-free_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://debian.newdream.net etch/contrib Packages (/var/lib/apt/lists/debian.newdream.net_dists_etch_contrib_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://www.backports.org etch-backports/main Packages (/var/lib/apt/lists/www.backports.org_debian_dists_etch-backports_main_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://volatile.debian.org etch/volatile/main Packages (/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_main_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://volatile.debian.org etch/volatile/contrib Packages (/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_contrib_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://volatile.debian.org etch/volatile/non-free Packages (/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_non-free_binary-amd64_Packages) - stat (2 No such file or directory)
W: You may want to run apt-get update to correct these problems
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

I tried running sudo apt-get -f install and got some more stat-related errors and a suggestion to run apt-get update. (Let me know if you need to know more details)

I tried sudo apt-get update and got several 404 errors followed by this:

Reading package lists... Done
W: GPG error: http://debian.di.newdream.net etch Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8E4BD8EB613A210F
W: Couldn't stat source package list http://debian.newdream.net etch/main Packages (/var/lib/apt/lists/debian.newdream.net_dists_etch_main_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://debian.newdream.net etch/non-free Packages (/var/lib/apt/lists/debian.newdream.net_dists_etch_non-free_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://debian.newdream.net etch/contrib Packages (/var/lib/apt/lists/debian.newdream.net_dists_etch_contrib_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://www.backports.org etch-backports/main Packages (/var/lib/apt/lists/www.backports.org_debian_dists_etch-backports_main_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://volatile.debian.org etch/volatile/main Packages (/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_main_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://volatile.debian.org etch/volatile/contrib Packages (/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_contrib_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://volatile.debian.org etch/volatile/non-free Packages (/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_non-free_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://debian.newdream.net etch/main Packages (/var/lib/apt/lists/debian.newdream.net_dists_etch_main_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://debian.newdream.net etch/non-free Packages (/var/lib/apt/lists/debian.newdream.net_dists_etch_non-free_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://debian.newdream.net etch/contrib Packages (/var/lib/apt/lists/debian.newdream.net_dists_etch_contrib_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://www.backports.org etch-backports/main Packages (/var/lib/apt/lists/www.backports.org_debian_dists_etch-backports_main_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://volatile.debian.org etch/volatile/main Packages (/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_main_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://volatile.debian.org etch/volatile/contrib Packages (/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_contrib_binary-amd64_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://volatile.debian.org etch/volatile/non-free Packages (/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_non-free_binary-amd64_Packages) - stat (2 No such file or directory)
W: You may want to run apt-get update to correct these problems
E: Some index files failed to download, they have been ignored, or old ones used instead.

Am I doing something wrong? How can I install Mercurial?

Best Answer

You are running Etch which is not one but two versions out of date. Etch has been removed from all the official mirrors. Additionally backports.org has moved to backports.debian.org and volatile has been discontinued.

If you want a recent version of mercurial without having to compile it yourself, I suggest you upgrade from etch to lenny, and then from lenny to squeeze.

Also from what you posted I noticed this "Depends: mercurial-common (= 1.7.5-1)" and that is the version from unstable. What kind of franken-system are you running with both etch and sid mixed?

Related Question