[LONG] Re: "Exec format error" bugs

Jean-Baptiste Lallement jeanbaptiste.lallement at gmail.com
Tue Jan 26 17:46:07 GMT 2010

2010/1/19 Chow Loong Jin <hyperair at ubuntu.com>:
> On Tuesday 19,January,2010 02:45 PM, Reinhard Tartler wrote:
>> [...]
>>> I've seen a few cases where this was caused by the post-install script
>>> being an empty file, maybe caused by I/O errors during install
>> Can we do better than closing the bugs with "we believe that your
>> computer has hardware problems, please retry with reinstallation of
>> ubuntu and reopen if you still experience this issue"?
> Shouldn't dpkg realize if there are I/O errors while unpacking the
> {pre,post}{inst,rm} scripts? Perhaps this warning should be put there instead,
> and dpkg should probably abort and roll back whatever it was doing.
> This is probably related to the out of disk space error -- dpkg creates the file
> and tries to write but cannot because there is no more space.

I reviewed around 50 of these reports and here is the result.

Firstly, nearly half of the reports are not in english. It's not easy
to find a pattern to identify and process those reports. The following
messages are the same error in different languages:
 - Erreur de format pour exec()
 - Error de formato ejecutable
 - Errore di formato di exec
 - Exec format error
 - Formatfel på körbar fil
 - Érvénytelen végrehajtható fájlformátum
 - Exec formátum hiba
 - Verkeerd uitvoerbaar bestand
 - Exec 格式错误

Other symptoms are : dpkg exits with status 2 and sometimes an
ldconfig error : "/sbin/ldconfig.real: File /usr/lib/libSatLib.so.4 is
empty, not checked".

This error is due to an empty or corrupted installation/removal script
( /var/lib/dpkg/info/PACKAGE.p* ) .
It's very easy to reproduce (but don't do what I say), simply run:
$ sudo :> /var/lib/dpkg/info/PACKAGE.postinst

Regarding the causes of the failure:
 - 54% Installation aborted due to : power failure - AC unplugged - ,
hardware failure, hardware lock, hard reboot, ... Clearly a data loss
 - 29% No unpack : Only the dpkg configure step is executed and no
dpkg unpack is shown in the log files.
In other words, the following sequence is shown in the term.log:
Log started: 2009-10-31  22:26:39
* nothing in the log file about the package libntfs-3g54 *
Processing triggers for python-support ...
Setting up libntfs-3g54 (1:2009.4.4-1ubuntu4) ...
dpkg (subprocess): unable to execute installed post-installation
script: Exec format error
dpkg: error processing libntfs-3g54 (--configure):
 subprocess installed post-installation script returned error exit status 2
The package has been unpacked but no information written to disk. A
system crash is likely to blame.
 - 7% Bus error or Segmentation fault during installation of the package.
 - 10% : I don't know

This tends to show that most of the errors (90%) are caused by a
system failure during a previous installation and not related to an
I/O error, lack of disk space or apt bug.

The really bad point is that the next runs of dpkg will trigger the
error and there is no easy way to recover from it for the common user.

What could be done ? Some suggestions:
 - package manager : try to unpack the archive again in order to
overwrite the faulty files, if it's not found fetch then unpack the
archive, and try performing the requested operation again. If that
fails, then really cancel the installation. But the package manager
need to know it's an "exec format error" and that's not easy due to
the comments above. Another option could be to ask to the user if he
wants to try the workaround.
 - dpkg : add a 'force' option to 'vanish' the package if the removal
script fails during a removal and/or configuration purging ( with a
BIG RED warning that it can seriously damage the user's installation)
instead of running abort-remove or leaving the package half-installed.
But I don't know the dpkg internals to know if it's a valid option.

Finally, I filed a master report as bug 512096 [1], explaining the
error and workarounds, so please mark any related report you may find
as duplicate of that one.
This issue is documented on the bugsquad's wiki page  [2] Feel free to
add additional informations.

Additional note: The same symptom exists for dkms with the following pattern
    run-parts: failed to exec /etc/kernel/postinst.d/dkms: Exec format error
    run-parts: /etc/kernel/postinst.d/dkms exited with return code 1
This is due to /etc/kernel/postinst.d/dkms being empty. Don't mark it
as duplicate of bug 512096 because the error is not with one the
installation script.

[1] https://bugs.edge.launchpad.net/ubuntu/+source/dpkg/+bug/512096
[2] https://wiki.ubuntu.com/DebuggingInstallationIssues#Exec%20format%20error


 - JB

More information about the ubuntu-devel mailing list