8

I followed the following instructions to install Emacs 24 on my machine (borrowed from: http://www.mikeyboldt.com/2011/11/30/install-emacs-24-in-ubuntu/):

sudo add-apt-repository ppa:cassou/emacs
sudo apt-get update
sudo apt-get install emacs-snapshot

But I get the following errors:

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:
emacs-snapshot : Depends: libgnutls26 (>= 2.12.6.1-0) but 2.10.5-1ubuntu3 is to be installed
Depends: libmagickcore4 (>= 8:6.6.9.7) but it is not installable
Depends: libmagickwand4 (>= 8:6.6.9.7) but it is not installable
E: Unable to correct problems, you have held broken packages.
4
  • 1
    Try sudo apt-get install -f?
    – jrg
    Dec 28, 2011 at 21:20
  • No luck. After running sudo apt-get install -f and then sudo apt-get autoremove, I still get the same error. Dec 29, 2011 at 10:32
  • I'm facing this exact same problem. Apr 26, 2012 at 20:21
  • I just tried again after an update and it now worked! Apr 26, 2012 at 21:23

4 Answers 4

5

I had the same error yesterday. I tried installing every emacs package in the repository, and when that didn't work, it occurred to me that maybe conflicts were the problem. Since I didn't need emacs23 if emacs-snapshot would work, I did the following:

Uninstall All Emacs Packages

Before proceeding, have a look at what emacs packages might be installed by issuing `sudo apt-cache search emacs'. If you can sacrifice everything in the output, go ahead with the following suggestion.

sudo apt-get remove `apt-cache search emacs | awk '{print $1}'` --purge

If something else shows up in the output that you wish to keep, a quick way to get rid of the things you don't want is to redirect the output of the command to a file, edit that file, and then use the contents of that file for arguments to apt-get remove.

  1. sudo apt-cache search emacs > remove.txt
  2. Edit remove.txt by deleting the lines of packages you wish to keep. The goal here is to get rid of anything emacs-related, so leave those packages in the file.
  3. sudo cat remove.txt | xargs apt-get remove --purge

You may get some errors here since emacs-snapshot failed to install correctly. If you do, try uninstalling those packages manually by first force installing the broken packages and then remove-purging them.

sudo apt-get -f install # don't list packages here
sudo apt-get remove emacs-snapshot --purge

It's probably also a good idea to autoclean and autoremove.

sudo apt-get autoclean
sudo apt-get autoremove

Install Emacs 24

sudo apt-get install emacs-snapshot

This assumes that you have the PPA added correctly (I'm using the cassou PPA as well). Everything seems to work nicely now!

Try aptitude

Since originally writing this answer I've moved on the using aptitude to manage my packages on the command line. I don't like the graphical interface (ncurses) you get from issuing sudo aptitude, so I only use it when I need to resolve dependencies/conflicts leftover from experimenting with different desktop environments. Most of the time, I simply use it as a drop-in replacement for apt-get, as in sudo aptitude install [package].

Related: Is aptitude still considered superior to apt-get?

3
  • wouldn't do this on 12.04 sudo apt-get remove apt-cache search emacs | awk '{print $1}' --purge I started to do it but it wanted to remove half of ubuntu banshee unity geany and whole other 291mb of ubuntu.
    – sayth
    Jun 26, 2012 at 12:05
  • I agree it isn't desirable to do that blind. I've edited my answer to suggest checking the output of apt-cache search emacs before proceeding. For me, this was the only solution that fixed the problem. I don't recall having to reinstall anything, but if you make an error, it should be easy to correct with the package manager.
    – jrhorn424
    Jun 26, 2012 at 17:31
  • @jrhorn424 unable to execute this command "sudo apt-get remove apt-cache search emacs | awk '{print $1}' --purge".
    – legend
    Dec 18, 2016 at 18:22
2

I have Emacs installed from this PPA and I checked the dependencies. Ubuntu 11.10 works with this PPA out of the box so you shouldn't have any issues. Here is the list of dependencies for the emacs-snapshot:

emacs-snapshot-bin-common (= 1:20111227-1~ppa1~oneiric1)libasound2 (>> 1.0.24.1), libc6 (>= 2.11), libcairo2 (>= 1.2.4), libdbus-1-3 (>= 1.1.1), libfontconfig1 (>= 2.8.0), libfreetype6 (>= 2.2.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libgif4 (>= 4.1.4), libglib2.0-0 (>= 2.26.0), libgnutls26 (>= 2.9.11-0), libgpm2 (>= 1.20.4), libgtk-3-0 (>= 3.0.0), libice6 (>= 1:1.0.0), libjpeg62 (>= 6b1), libm17n-0 (>= 1.6.1), libmagickcore3 (>= 8:6.6.0.4), libmagickwand3 (>= 8:6.6.0.4), libncurses5 (>= 5.5-5~), libotf0 (>= 0.9.11), libpng12-0 (>= 1.2.13-4), librsvg2-2 (>= 2.14.4), libselinux1 (>= 1.32), libsm6, libtiff4, libtinfo5 (>= 5.6+20070908), libx11-6, libxft2 (>> 2.1.1), libxml2 (>= 2.7.4), libxpm4, libxrender1

Something is a muck in your dependencies. I would disable the PPA, do an apt-get update and upgrade then apt-get clean then re-enable the PPA again and try it.

1

Just for information, on Precise Pangolin 12.04 it can be simply done with

sudo add-apt-repository ppa:cassou/emacs
sudo apt-get update
sudo apt-get install emacs-snapshot

and it works out-of-the-box.

2
  • By "out-of-the-box", do you mean on a fresh install? Is emacs already present when you installed emacs-snapshot?
    – jrhorn424
    Jul 9, 2012 at 23:35
  • Sorry, I mean: once I have given those commands, it works without any other intervention. Jul 13, 2012 at 7:06
0

I think it may be helpful http://zabambo.com/blog/?p=45

although it 's for 24.1, you can change the version as you want.

1
  • Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Aug 23, 2013 at 11:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .