Packages depending on JRE might not have a usable JRE when configured

Bug #288616 reported by Thierry Carrez
10
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
Undecided
Unassigned
Intrepid
Invalid
Undecided
Unassigned
commons-daemon (Ubuntu)
Invalid
Low
Unassigned
Intrepid
Invalid
Undecided
Unassigned
java-common (Ubuntu)
Invalid
Undecided
Unassigned
Intrepid
Invalid
Undecided
Unassigned
openjdk-6 (Ubuntu)
Fix Released
Undecided
Unassigned
Intrepid
Invalid
Undecided
Unassigned
tomcat6 (Ubuntu)
Invalid
Low
Unassigned
Intrepid
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: tomcat6

In some cases Tomcat 6 fails to successfully start *during install*. This doesn't prevent the installation from succeeding and you can still run "sudo service tomcat6 start" to start it once it is installed.

If a JRE is not completely configured by the time Tomcat is started, Tomcat will fail to start. This can happen in some installation scenarios as Tomcat 6 doesn't formally "pre-depend" on a JRE.

For example, on a minimal system, the packages seem to be configured in that order (some lines removed for clarity):
$ sudo apt-get install tomcat6 tomcat6-examples tomcat6-admin tomcat6-user
Setting up default-jre-headless (1.6-30ubuntu3) ...
Setting up openjdk-6-jre-lib (6b12-0ubuntu4) ...
Setting up tomcat6 (6.0.18-0ubuntu3) ...
 * Starting Tomcat servlet engine tomcat6 ...fail!
Setting up openjdk-6-jre-headless (6b12-0ubuntu4) ...

However if you run:
$ sudo apt-get install tomcat6
Setting up openjdk-6-jre-lib (6b12-0ubuntu4) ...
Setting up default-jre-headless (1.6-30ubuntu3) ...
Setting up openjdk-6-jre-headless (6b12-0ubuntu4) ...
Setting up tomcat6 (6.0.18-0ubuntu3) ...
 * Starting Tomcat servlet engine tomcat6 [OK]

Related branches

Thierry Carrez (ttx)
Changed in tomcat6:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Thierry Carrez (ttx) wrote :

The problem is not a pre-depend one but rather a circular dependency in openjdk-6 (bug 291123) and sun-java6 (bug 291128). Those circular dependencies are arbitrarily broken at some point and may result in Tomcat trying to start while the JRE is not yet available...

Changed in tomcat6:
status: Confirmed → Invalid
Revision history for this message
Matthias Klose (doko) wrote :

I don't agree, the tomcat6 tries to use java in the postinst, before the -jre-headless package is configured.
jvm.cfg is a config file in openjdk-6-jre-headless, and this is only available after configuration.

Changed in tomcat6:
status: Invalid → New
Revision history for this message
Thierry Carrez (ttx) wrote :

The two circular dependencies in JVMs have been confirmed as WONTFIX so we need another solution.
Here are the candidates :

- Fix the apt bug that makes it break the circular dependency at a weird point
- Try making default-jre-headless depend on both openjdk-6-jre-lib and openjdk-6-jre-headless
- Use the same ugly workaround as in ca-certificates-java postinst
- Add a Pre-Depend (should be avoided)

Revision history for this message
Thierry Carrez (ttx) wrote :

A few details on the proposed solutions:

* Fix the apt bug that makes it break the circular dependency at a weird point
This is difficult because of the regression potential, should probably be avoided if we can fix it in the Depends themselves ?

* Try making default-jre-headless depend on both openjdk-6-jre-lib and openjdk-6-jre-headless
I tried this and it works : the dependency loop gets arbitrarily broken at that level rather than at tomcat6 level:
...
Setting up openjdk-6-jre-lib (6b12-0ubuntu6) ...
Setting up default-jre-headless (1.6-30ubuntu3.1) ...
Setting up openjdk-6-jre-headless (6b12-0ubuntu6) ...
...
Setting up tomcat6 (6.0.18-0ubuntu3) ...
The interesting thing is that this would fix any package depending on default-jre / default-jre-headless.

* Use the same ugly workaround as in ca-certificates-java postinst
The workaround is creating the missing /etc/$jvm/jvm.cfg file for the time it takes to start tomcat6:
if [ ! -f /etc/$jvm/jvm.cfg ]; then
  temp_jvm_cfg=/etc/$jvm/jvm.cfg
  mkdir -p /etc/$jvm
  printf -- "-server KNOWN\n" > $temp_jvm_cfg
fi
...
[ -z "$temp_jvm_cfg" ] || rm -f $temp_jvm_cfg

* Add a Pre-Depend
That one we already know, and want to avoid if possible.

Revision history for this message
Colin Watson (cjwatson) wrote :

For now, I would prefer making default-jre-headless depend on both openjdk-6-jre-lib and openjdk-6-jre-headless; that seems simple and non-invasive. Matthias?

I don't agree that we should avoid fixing bugs in apt, although we should probably work around them until they're fixed.

The ca-certificates-java workaround does not fill me with joy ...

Revision history for this message
Thierry Carrez (ttx) wrote :

Proposed patch.

java-common (0.30ubuntu5) jaunty; urgency=low

  * Make default-jre-headless depend on both *-jre-headless and *-jre-lib,
    except for gcj where it should just depend on java-gcj-compat-headless
    (fixes LP: #288616)

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

This bug was fixed in the package openjdk-6 - 6b14-0ubuntu3

---------------
openjdk-6 (6b14-0ubuntu3) jaunty; urgency=low

  * Update IcedTea build infrastructure (20081217).
  * Add support for PARISC.
  * Use a default jvm.cfg if the jvm.cfg doesn't yet exist after unpacking
    the runtime package. LP: #288616.

 -- Matthias Klose <email address hidden> Wed, 17 Dec 2008 09:58:26 +0100

Changed in openjdk-6:
status: New → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote :

jsvc (from commons-daemon) still can't find a JVM: it statically looks for "jvm.cfg", then tries various well-known libjvm.so locations (but unfortunately not the "server" one). It needs to be taught about that one so that it can find it.

Changed in java-common:
status: New → Invalid
status: New → Invalid
Changed in tomcat6:
status: New → Invalid
status: New → Invalid
Changed in commons-daemon:
assignee: nobody → tcarrez
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Thierry Carrez (ttx) wrote :

Hm, that will not be sufficient. Once jsvc is fixed, Tomcat finally needs the following defined in java.security to start:
  policy.expandProperties=true
  policy.allowSystemProperty=true
And java.security is also a conffile, so this is also available only after configuration. Not sure we have a workaround for that one.

Revision history for this message
Thierry Carrez (ttx) wrote :

So it can't be fixed by just working around it in commons-daemon. We need the JRE to be fully installed before it's put in use. Solutions left include:
1- PreDepend
2- Fix apt
3- Make default-jre-headless depend on both openjdk6-lib and openjdk6-jre-headless
Reopening tasks for apt and java-common, since I'm still unsure why (3) isn't the easiest solution.

Changed in commons-daemon:
assignee: ttx → nobody
status: Confirmed → Invalid
Changed in java-common:
status: Invalid → New
Changed in commons-daemon:
status: New → Invalid
Revision history for this message
Thierry Carrez (ttx) wrote :

For some reason this is no longer an issue on current karmic.
Both "apt-get install tomcat6 tomcat6-examples tomcat6-admin tomcat6-user" and "apt-get install tomcat6" work...
Will reopen if I can reproduce it.

Changed in apt (Ubuntu):
status: New → Invalid
Changed in java-common (Ubuntu):
status: New → Invalid
Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Intrepid Ibex reached end-of-life on 30 April 2010 so I am closing the
report. The bug has been fixed in newer releases of Ubuntu.

Changed in openjdk-6 (Ubuntu Intrepid):
status: New → Invalid
Changed in apt (Ubuntu Intrepid):
status: New → Invalid
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.