DebuggingEmacs

Available languages : Italiano,

Debugging Central

This page is part of the debugging series — pages with debugging details for a variety of Ubuntu packages.

Introduction

There are multiple Emacs packages, collectively referred to as "Emacsen". They all depend on a package called emacsen-common, and they are divided into "flavors". The main flavors are GNU Emacs (AKA FSF Emacs; emacs24 and emacs23 etc) and xemacs21. These in turn are divided into multiple packages, in order to separate architecture-independent components (for which only one package is needed) from architecture-dependent ones (which need to be built separately for each architecture), and mandatory components from optional ones.

If you only need one Emacs flavor, the stable GNU Emacs (currently emacs24) is recommended. At one point, Ubuntu provided an emacs-snapshot package containing a relatively recent non-release version of the developer sources; you can still find a PPA with what at least at some point contained the really latest and greatest. Finally, xemacs21 is rather old and not very actively maintained, but if you are an Xemacs fan, it's still available.

There is a plethora of Emacs add-on packages. Most of these are supported on all flavors, but there are notable exceptions. Some add-ons are not needed on some flavors, and some add-ons provide newer and / or different versions of components which are also included with a base Emacs install (e.g. Gnus).

Debugging procedure

If Emacs doesn't behave like you expect, try running emacs -Q and see if the problem goes away. This disables the reading of your .emacs file and other local modifications. If the problem goes away, the problem is most likely in a local customization.

If you get an error message from Emacs, you may be able to trigger a backtrace which shows which Lisp functions were being processed when the error hit. Enable backtraces with M-: (setq debug-on-error t) and attach the *Backtrace* buffer to your bug report.

Installation Logs

For many installation problems, you need to examine the installation logs.

When you install with Synaptic or Update-Manager, the terminal log is not necessarily shown to you. You will need to examine your system's log files and dig out the useful information.

TODO: move this stuff to a dedicated page?

If the problematic installation was part of an upgrade of your Ubuntu installation, the log file is /var/log/dist-upgrade/term.log; otherwise look for /var/log/apt/term.log. You will probably need sudo to access these read-protected files, or add yourself to the group adm).

Package Installation Errors

Apparent Emacs errors are often caused by an add-on package which contains a bug or incompatibility with the installed Emacs flavor.

If dpkg prints an error message indicating that the package postinst failed, the actual error message is probably a few lines before this message in the dpkg output.

emacs-install: /usr/lib/emacsen-common/packages/install/ecb emacs23
     failed at /usr/lib/emacsen-common/emacs-install line 28, <TSORT> line 17.
dpkg: error processing emacs23 (--configure):
 subprocess installed post-installation script returned error exit status 1

This points to ecb as the culprit (bug 466531).

dpkg: dependency problems prevent configuration of emacs:
 emacs depends on emacs23 | emacs23-lucid | emacs23-nox; however:
  Package emacs23 is not configured yet.
  Package emacs23-lucid is not installed.
  Package emacs23-nox is not installed.
dpkg: error processing emacs (--configure):
 dependency problems - leaving unconfigured

This particular snippet just means that an earlier problem prevented Emacs from installing successfully. You need to go further back in the log file to see what's wrong.

Byte Compilation Errors

A particular type of installation error is the byte compilation error. With emacs22 and emacs-snapshot the terminal log will contain a message like this:

!! Byte-compilation for <<flavor>> failed!
!! This indicates a bug in one of the add-on packages
!! installed on your system, or a bug in Emacs itself.
!! Please file a bug report against <<flavor>>
!! and attach the file /tmp/<<flavor>>.<<suffix>>

The file name will be different each time. This file is required in order to analyze the problem.

How to file bugs

You can file bugs against Emacs using Apport.

There is also the built-in M-x emacs-bug-report but it is not fully customized for sending bug reports to Ubuntu.

Bug tags

(Developers: please update this section)

How to Triage

Apport bugs are generally triggered by a package failing to install, and usually include DpkgTerminalLog or VarDistUpgradeTermLog as an attachment; this log file is usually the first one to examine. If it's missing, see the section "Installation Logs" above.

Typically, it will contain an error message near the end which indicate which package failed installation and why.

If this file is missing, it should be requested. See a canned reply below for example.

If the message indicates a byte-compilation error in an add-on package (see above), the temporary file in the error message should be attached to the bug report. If it is not, it should be requested. See a canned reply below for example.

Stock Replies

TODO How to produce and attach a backtrace

Missing Terminal Log

Thank you for taking the time to report this bug and helping to make Ubuntu better. In order for us to be able to analyze this problem, we would like you to attach the contents of the file /var/log/apt/term.log to this bug report. Please note that you will normally need sudo privileges to read or copy this file.

If you got this error during an upgrade from an earlier version of Ubuntu, the log file's name will instead be /var/log/dist-upgrade/apt-term.log

Thanks in advance!

Missing Byte Compilation Log

If you still have this file on your system, please attach it to this bug report. However, files in the /tmp directory are purged on reboot; if the file has already been removed from your system, you may be able to recreate a similar file by attempting to repeat the operation which failed when you got the error message. Note that the name of the generated temporary file will be slightly different each time; refer to near the end of your /var/log/apt/term.log to see the exact generated file name. You will need sudo privileges to read the terminal log file.

TODO The Bugs/Responses page should include these replies.

How to Forward

The ultimate upstream for GNU Emacs bugs is http://debbugs.gnu.org/ which is running the same software as the Debian BTS. The Ubuntu packages are generally merged from Debian, so Debian is generally a suitable upstream; and of course, for packaging bugs, Debian is usually the sole upstream.

Known bugs

Description of known bug reports that may receive duplicates and how to recognise them. This information should be obtained by looking for bugs tagged as 'metabug'.

Open

Bug

Subject

Symptom

466531

ecb: incompatible with emacs23, breaks installation / upgrade

The typical symptom is just the emacs23 post-install exiting with a non-zero exit code (but of course this is not the only reason that could happen; see triage tips above)

Closed

Bug

Subject

Symptom

467446

update-alternatives: error: alternative path /usr/bin/xemacs21 doesn't exist

Fixed in a recent version of xemacs21 but still affects people runnng older Ubuntu releases

464587

ocaml-mode: Invalid syntax description flag: "()1n"

Fixed in a recent version of ocaml but still affects people runnng older Ubuntu releases and xemacs21

222870

anjsp: Wrong number of arguments: require, 3

anjsp is not compatible with xemacs21. It no longer ships with Ubuntu but still affects people running older Ubuntu releases

396038

Group staff missing; Emacs installation failed

This rare error was never properly debugged, but it did occur more than once

Non-bugs

To the best of our knowledge, this is not an Emacs bug, but it appears to manifest a lot when installing Emacs:

Bug

Subject

Symptom

512096

Exec format error: package failed to install/remove

Seems to often affect emacsen-common -- 00debian-vars.el or similar file missing even though package apparently installed. See also bug #582341


CategoryBugSquad CategoryDebugging

DebuggingEmacs (last edited 2012-09-27 09:26:51 by era)