Public bug reported:

JAVA_HOME was set to "/usr", just because 
$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 May 26 17:01 /usr/bin/java -> /etc/alternatives/java
and not directly to anything in
# ls -l /usr/lib/jvm
total 12
lrwxrwxrwx 1 root root   14 May 17 14:55 default-java -> java-6-openjdk
lrwxrwxrwx 1 root root   18 May 17 14:55 java-1.5.0-gcj -> java-1.5.0-gcj-4.4
drwxr-xr-x 6 root root 4096 Jul  8 22:23 java-1.5.0-gcj-4.4
lrwxrwxrwx 1 root root   14 May 17 14:55 java-1.6.0-openjdk -> java-6-openjdk
drwxr-xr-x 7 root root 4096 May 26 15:55 java-6-openjdk
lrwxrwxrwx 1 root root   19 May 26 17:00 java-6-sun -> java-6-sun-1.6.0.20
drwxr-xr-x 8 root root 4096 May 26 17:00 java-6-sun-1.6.0.20
lrwxrwxrwx 1 root root   12 May 17 14:55 java-gcj -> java-gcj-4.4
lrwxrwxrwx 1 root root   18 May 17 14:55 java-gcj-4.4 -> java-1.5.0-gcj-4.4

But independent from that observation, it should be noted that the
structure of the code is erroneous. The lower half of the following
patch improves the situation. For the upper half, a readlink to
/usr/lib/jvm/default-java, if existing, to seed JAVA_HOME would however
possibly be preferable.

This was spotted in the debian 1.6.2 packages but might also apply to
Ubuntu's.

Steffen

--- eucalyptus-cloud.orig       2010-07-16 16:18:48.000000000 +0200
+++ eucalyptus-cloud    2010-07-16 16:43:55.000000000 +0200
@@ -189,17 +189,36 @@
 
        # to be sure we are using the right java/JAVA_HOME
        JAVA="$JAVA_HOME/jre/bin/java"
-
-       # let's see if we can find a decent java
-       if [ -x "$JAVA" ]; then
-               java_version=`$JAVA -version 2>&1 | grep "java version" | sed 
-e 's/.*java version "\(.*\)".*/\1/'`
-               if [ `expr $java_version "<" $java_min_version` -eq 0 ]; then
-                       export JAVA_HOME
-                       return 
+       for relpath in "jre/bin" bin; do
+               JAVA="$JAVA_HOME/$relpath/java"
+               if [ -x "$JAVA" ]; then
+                       break;
                fi
+       done
+
+       if [ "x$JAVA" == "x" ]; then
+               echo "Could not find Java executable underneath JAVA_HOME 
determined as $JAVA_HOME"
+               exit 1
+       fi
+
+       # version check
+
+       java_version=`$JAVA -version 2>&1 | grep "java version" | cut -f2 -d\"`
+       if [ -z "$java_version" ]; then
+               echo "Failed to determine Java version in init script."
+               exit 1
+       else
+               echo "Java version is '$java_version'"
+       fi
+       if [ `expr $java_version "<" $java_min_version` -eq 0 ]; then
+               export JAVA_HOME
+               return 
+       else
+               echo "Eucalyptus needs java version >= $java_min_version, found 
version \"$java_version\" of \"$JAVA\""
+               exit 1
        fi
 
-       echo "Eucalyptus needs java version >= $java_min_version"
+       echo "Error in init.d/eucaluptus-cloud, this statement should not be 
reached."
        exit 1
 }

** Affects: eucalyptus (Ubuntu)
     Importance: Undecided
         Status: New

-- 
debian /etc/init.d/eucalyptus-cloud needs help
https://bugs.launchpad.net/bugs/606953
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to eucalyptus in ubuntu.

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to