invalid file (bad magic number): Exec format error

Bug #1498832 reported by Calendros
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
ditaa (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Hello,

The package contains debian/links file which links /usr/share/ditaa/ditaa.jar to /usr/bin/ditaa. In my ubuntu version, the jar can not be executed directly, "/usr/bin/ditaa" results in the following error:

 invalid file (bad magic number): Exec format error

After creating a simple wrapper:

 #!/bin/sh
 exec java -jar /usr/share/ditaa/ditaa.jar

works for me.

My package version is: 0.9+ds1-3 but it the link file (in debian/*) is still present in version ditaa_0.10+ds1-1.debian.tar.xz.

I'm on Ubuntu 15.04.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ditaa (Ubuntu):
status: New → Confirmed
Revision history for this message
smithfarm (presnypreklad) wrote :

This bug is present on Trusty, too.

Revision history for this message
Janet (bugzilla-kerridis) wrote :

It doesn't seem to be a ditaa problem but an openjdk problem? I also get the error when I try to start other java apps on 14.04 without exec - but on 15.10 (openjdk version "1.8.0_91") it is ok.

Revision history for this message
Kevin Locke (kevinoid) wrote :

I just ran into this issue with a self-compiled jar file and confirmed that I have the same issue with ditaa on Debian. Checking the binfmt_misc configuration may be useful. To see what interpreters will be tried by binfmt_misc, run `/usr/sbin/update-binfmts --find /usr/bin/ditaa`. Then try running the interpreter with the jar file directly (e.g. `/usr/bin/jarwrapper /usr/bin/ditaa`) to see if it works.

If update-binfmts does not print anything, that suggests either corruption of the JAR file (check `od -An -tx1 -N4 /usr/share/ditaa/ditaa.jar` is `50 4b 03 04`) or that jarwrapper is not correctly registered (check `/usr/sbin/update-binfmts --display jarwrapper` prints `jarwrapper (enabled)`).

If update-binfmts prints `/usr/bin/jexec` (or anything else) in addition to `jarwrapper` and those interpreters do not work, this suggests conflicting binfmt_misc registrations. Check the output of `/usr/sbin/update-binfmts --display` to find out which package installed it. You can then remove it by running something like `sudo update-binfmts --package openjdk-8 --remove jar /usr/bin/jexec`.

The issue, as it appeared on my system, was that the openjdk packages (e.g. openjdk-8-jre-headless) install /usr/bin/jexec as a binfmt_misc handler but jexec doesn't work with this jar. Java version mismatch perhaps? I found the issue of jexec/jarwrapper conflict has been raised before at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=136993#82 without response. Perhaps it's time to raise it again? I'd reassign this bug to openjdk-8-jre-headless.

Revision history for this message
Kevin Locke (kevinoid) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.