Bug 461199

Summary: System gets stuck on jexec
Product: [openSUSE] openSUSE 11.1 Reporter: Forgotten User qVxYNNuhfW <forgotten_qVxYNNuhfW>
Component: JavaAssignee: E-mail List <bnc-team-java>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None CC: alberto.passalacqua, bruno.fs.antunes, cooperfan, davejplater, forgotten_lMRCKDTytB, k.e.wagner, mmarek, rguenther, stefan.kunze, taha.bensalah, vkrevs
Version: Final   
Target Milestone: ---   
Hardware: All   
OS: openSUSE 11.1   
Whiteboard:
Found By: Community User Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: contains boot.msg, boot.omsg and messages

Description Forgotten User qVxYNNuhfW 2008-12-20 15:56:38 UTC
On opensuse 11.1 amd64

My system never completely boots - I do get to KDE

However I cannot login by using ctrl+alt+F1,(F2,etc) .

crtl+al+f1 screen reads  starting jexec services

I have removed openjdk1.6 - as many many web applications to not work.

I have just installed the newly released sun java 1.6 amd64 version - which now includes firefox plugin...

- not sure if that is related.
Comment 1 Forgotten User qVxYNNuhfW 2008-12-20 15:58:16 UTC
FYI - in case it helps......

suse64:/home/morgan # java -version
java version "1.6.0_12-ea"
Java(TM) SE Runtime Environment (build 1.6.0_12-ea-b02)
Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode)

64bit web plugin works really good !
Comment 2 Alberto Passalacqua 2008-12-21 03:00:15 UTC
I have the same problem, and it appeared AFTER I installed SUN Java 1.6.0_12-ea.

Regards,
A.
Comment 3 Alberto Passalacqua 2008-12-21 03:12:44 UTC
The "solution" is to downgrade to either SUN Java provided in the OSS repository, or IcedTea.

Probably this bug should go upstream to SUN. What do you think?

Regards,
Alberto
Comment 4 Alberto Passalacqua 2008-12-21 03:16:18 UTC
I meant, non-OSS repository, sorry.
Comment 5 Forgotten User qVxYNNuhfW 2008-12-27 21:50:36 UTC
Hi.

When I first reported this i wasn't aware that it was the sun jre that did this - not the opensuse packages ...

I think the bug should be reduced in importance ?

However the sun java packages should be upgraded for opensuse 11.1 amd64 as a major priority.

There are so many java sites that do not work with the default iced tea plugin - i.e - www.jmeeting.com 

The new plugin with the new amd64 jre from sun is 100% compatible.
Comment 6 Taha BEN SALAH 2008-12-28 11:15:56 UTC
I'im encountering the same issue for x86 (32) too on 2 machines (laptop+PC).
Although i still believe this is a SUN Java (jdk 6) issue, a service that hangs should not freeze the system!!
so this is an OpenSuse issue as well.
I used to play with official SUN Java because the bundled one has always several incompatibilities whith some of the apps i'm using.
I Think this is a VERY SERIOUS problem for the stability of the Os and should be corrected ASAP.
This is not the first time opensuse has problems with the official Java (in 10.3 i had a problem that was said to be related to the AWT implementation of SUN....)
We should test ALWAYS the Official Java before releasing a such promising OS as it is Official.
Regards,
Taha BEN SALAH
Comment 7 Alberto Passalacqua 2008-12-28 14:38:28 UTC
The official SUN java provided with openSUSE _does_not_cause_any_problem, so it is hardly a SUSE responsibility.

The problem comes only when Java 1.6.0_12-ea is installed. 
Comment 8 Michal Vyskocil 2009-01-06 09:47:37 UTC
Well I don't understand your problem, so there are some notices:

1.) @morgan.cox, Alberto Passalacqua Sun Java 1.6.0_12-ea - the EA means Early Access and it is *not* an official release, nor distributed in openSUSE. If you installed it and got some error, then it is your problem ;-)

2.) @morgan.cox: what's the exactly problem with jexec? Can you be more verbose and exact? Any error message, or log? Which application did you installed? I cannot imagine situation in which can JVM problem freeze the boot completelly. Without it is your report useless.

3.) @morgan.cox: yes, there're many plugins which do not work with current openjdk plugin. You can try the newest version in Java:openjdk6:Factory, but the best think is wait until Sun released u12 with native 64bit plugin.

4.) @Taha BEN SALAH: if you have any problem with Sun Java distributed in openSUSE feel free to open a bug in bugzilla. Without it we cannot help you.
Comment 9 Bruno Antunes 2009-01-07 18:49:54 UTC
This problem also happened, after upgrading from openSUSE 11.0 to 11.1 (x86), with Sun Java SE 6 Update 10 and 11 installed
Comment 10 Dave Plater 2009-01-21 08:55:47 UTC
Just upgraded via 11.1 retail dvd from 11.1 rc1 and having to boot from rescue system via kexec due to broken bootloader my 32 bit system also hangs on jexec and I have to alt/sysrq/e to get a login screen and then init3 and init5 gives a functional gui system. What logs or other info can I supply before I try a clean install?
I have the following installed :-
java-1_6_0-sun-1.6.0.u11-1.1
java-1_6_0-openjdk-1.2_b11-22.13
java-1_5_0-gcj-compat-devel-1.5.0.0-56.61
java-1_6_0-openjdk-plugin-1.2_b11-22.13
java-1_5_0-gcj-compat-1.5.0.0-56.61

My system already had the latest online updates prior to dvd update and I already had the version of sun java that is on the dvd installed.
Comment 11 Dave Plater 2009-01-21 09:14:26 UTC
Just to add to the above comment, all I can see in the logs is that jexec is actually running through an alt/sysrq/t trace. The boot process hangs on "Staring jexec services" It might not even be jexec that causes the hang.
I am going to reboot with jexec service disabled and will report back.
Comment 12 Dave Plater 2009-01-21 09:37:48 UTC
Created attachment 266443 [details]
contains boot.msg, boot.omsg and messages
Comment 13 Dave Plater 2009-01-21 09:41:02 UTC
Lost comment between 11 and 12 :-
I rebooted with jexec service disabled with no problems, therefore jexec is the problem.
Any other info you need please ask.
Comment 14 Forgotten User lMRCKDTytB 2009-01-21 15:58:58 UTC
I ran "bash -v jexec start"
 
and saw it crashed at: `mount_service`

Did a little more debugging, and found it crashes at this command:

mount -t binfmt_misc none proc/sys/fs/binfmt_misc

Now mind you, once I type in that command, I can't CTRL-C it.  Looking at the process list I find:

danny@traveler:~> ps aux | grep  mount
root      4796  0.0  0.0  12760   860 pts/2    D    09:51   0:00 mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
root      4799  0.0  0.0  11436  1412 ?        S    09:51   0:00 sh -c /sbin/modprobe --ignore-install binfmt_misc && { mount -t binfmt_misc none /proc/sys/fs/binfmt_misc; }
root      4804  0.0  0.0  12480   756 ?        S    09:51   0:00 mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
root      4852  0.0  0.0  12760   856 pts/2    S    10:05   0:00 mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
... ad nauseum

I had removed Sun 1.6 and 1.5 and am left with OpenJDK -- always with the problem.
Comment 15 Forgotten User lMRCKDTytB 2009-01-21 16:36:55 UTC
PS:  I believe the Java thing is a red herring
Comment 16 Forgotten User lMRCKDTytB 2009-01-21 17:34:22 UTC
(In reply to comment #15)
> PS:  I believe the Java thing is a red herring

Sorry, I re-read the definition of "red herring", the term implies intentionally misleading and I'm sure that's not the case.  I think the Java thing is misleading, and obfuscates the real problem though.
Comment 17 Richard Biener 2009-01-21 20:07:09 UTC
Can we have the offending jexec script attached?
Comment 18 Forgotten User lMRCKDTytB 2009-01-21 20:24:49 UTC
Certainly, here's the whole thing.  I do have a couple extra "echos" for debugging.  Funny, I didn't expect to see you had a novell email address.


#!/bin/sh
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
#
# @(#)jexec     1.1 05/05/24
#
# A script for supporting the direct execution of binary formats through
# binfmt_misc.
#
# More information about binfmt_misc is available at the binfmt_misc homepage:
#
#     http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html
#
#
### BEGIN INIT INFO
# Provides: binfmt_misc
# Required-Start: $local_fs
# Default-Start: 1 2 3 4 5
# Default-Start: 0 6
# chkconfig: 12345 95 05
# Description: Supports the direct execution of binary formats.
### END INIT INFO
#

BINFMT_MISC=/proc/sys/fs/binfmt_misc
JEXEC=/usr/java/default/lib/jexec
PKMAGIC="PK\x03\x04"
PKMAGICHEX="504b0304"
NAME=jexec
TYPE=M
OFFSET=
MAGIC=${PKMAGIC}
MASK=
INTERP=${JEXEC}

ENABLED=enabled
DISABLED=disabled


#
# LSB compliant error values
SUCCESS=0
UNSPECIFIED=1
INVALID_ARGUMENT=2
ARG_NOT_SUPPORTED=3
INSUFFICIENT_PRIVILEGE=4
NO_BINFMT_MISC_SUPPORT=5
FAILED_TO_ENABLE=7
SERVICE_ENABLED=${SUCCESS}
SERVICE_DISABLED=151
SERVICE_NOT_MOUNTED=152
REGISTERED_ENABLED=153
REGISTERED_DISABLED=154
NOT_REGISTERED=155
MAGIC_IN_USE=156


#
# LSB compliant status values
STATUS_RUNNING=0
STATUS_NOT_RUNNING=3

#
# Checks that the binfmt_misc service is mounted and enabled.
#
# Output:
#    This function writes the return value to stdout.
#
# Returns:
#     0   : the service is mounted and enabled.
#     151 : the service is mounted but disabled.
#     152 : the binfmt_misc service is not mounted.
#
check_binfmt_misc() {
    result=${SERVICE_NOT_MOUNTED}

    if [ -e ${BINFMT_MISC}/register ] && [ -e ${BINFMT_MISC}/status ]; then
        if [ "`cat ${BINFMT_MISC}/status`" = "enabled" ]; then
            result=${SERVICE_ENABLED}
        else
            result=${SERVICE_DISABLED}
        fi
    fi

    echo ${result}
}


#
# Mounts the service for use.  If binfmt_misc is not already mounted, this
# function will attempt to mount it, creating the /proc subdirs if necessary.
#
# Output:
#    This function writes the return value to stdout.
#
# Returns:
#     0   : Success.
#     4   : insufficient privileges to create the mount point.
#     5   : the binfmt_misc service is not supported.
#
mount_service() {
    result=${NO_BINFMT_MISC_SUPPORT}

echo ${result} >> temp
    if [ ! -e ${BINFMT_MISC}/register ] || [ ! -e ${BINFMT_MISC}/status ]; then
        mkdir -p ${BINFMT_MISC} 2>> temp #/dev/null

echo ${BINFMT_MISC} >> temp
        if [ -d ${BINFMT_MISC} ]; then
            mount -t binfmt_misc none ${BINFMT_MISC} 2>> temp #/dev/null
        else
            result=${INSUFFICIENT_PRIVILEGE}
        fi
    fi

    if [ -e ${BINFMT_MISC}/register ] && [ -e ${BINFMT_MISC}/status ]; then
        result=${SUCCESS}
    fi

    echo ${result}
}


#
# Registers the jexec interpreter with the PK-ZIP binary type.  This function
# first checks to see if any other interpreter is registered and enabled for
# the PK-ZIP binary type.  If nothing else is currently enabled for the PK-ZIP
# binary type then the jexec entry is created.  If the jexec entry exists, but
# is disabled, then it is enabled.
#
# Output:
#    This function writes the return value to stdout.
#
# Returns:
#     0   : Success.
#     4   : insufficient privileges to enable the jexec interpreter.
#     156 : another interpreter is registered for the PK-ZIP binary type.
#
# Note: once the PK-ZIP magic number is detected, the jexec interpreter handles
#       all additional processing required to determine if the file is a JAR or
#       just a simple ZIP file.
#
register_jexec() {
    result=${SUCCESS}

    # first make sure that nothing else has registered the PK-ZIP magic
    for file in ${BINFMT_MISC}/*; do
        filename="`basename ${file}`"
        if [ "${filename}" != "register" ] &&
           [ "${filename}" != "status" ]
        then
            is_registered=`check_registration ${file}`
            if [ ${is_registered} -eq ${REGISTERED_ENABLED} ] &&
               [ "${filename}" != "${NAME}" ]
            then
                result=${MAGIC_IN_USE}
            elif [ ${is_registered} -eq ${REGISTERED_DISABLED} ] &&
                 [ "${filename}" = "${NAME}" ]
            then
                # the registration exists, but is disabled, so re-enable it
                enable_jexec 2> /dev/null
                if [ $? -ne 0 ]; then
                    result=${INSUFFICIENT_PRIVILEGE}
                fi
            fi
        fi
    done

    if [ ${result} -eq ${SUCCESS} ] &&
       [ ! -e ${BINFMT_MISC}/${NAME} ]
    then
        # Register jexec with the PK-ZIP magic number.  jexec does additional
        # decoding of the ZIP/JAR file header to determine if it is actually
        # a JAR file, or just a regular ZIP file.
        echo ":${NAME}:${TYPE}:${OFFSET}:${MAGIC}:${MASK}:${INTERP}:" > \
            ${BINFMT_MISC}/register
        if [ ! -e ${BINFMT_MISC}/${NAME} ]; then
            result=${INSUFFICIENT_PRIVILEGE}
        fi
    fi

    echo ${result}
}


#
# Unregisters the jexec interpreter with the PK-ZIP binary type.
#
# This function is just a wrapper that allows any error messages to be sent to
# /dev/null.  Generally speaking this function shouldn't fail unless the user
# doesn't have sufficient permission to write to binfmt_misc.
#
unregister_jexec() {
    echo -1 > ${BINFMT_MISC}/${NAME}
    return $?
}


#
# Sets the overall binfmt_misc status.
#
# This function is just a wrapper that allows any error messages to be sent to
# /dev/null.  Generally speaking this function shouldn't fail unless the user
# doesn't have sufficient permission to write to binfmt_misc.
#
# Parameters:
#     $1 : overall status to set; either 1 = enable, 0 = disable, -1 = remove
#
set_service_status() {
    echo $1 > ${BINFMT_MISC}/status
    return $?
}


#
# Enable the jexec interpreter.
#
# This function is just a wrapper that allows any error messages to be sent to
# /dev/null.  Generally speaking this function shouldn't fail unless the user
# doesn't have sufficient permission to write to binfmt_misc.
#
enable_jexec() {
    echo 1 > ${BINFMT_MISC}/${NAME}
    return $?
}


#
# This function checks if a given registration contains the PK-ZIP magic number,
# and if it does, is it enabled.
#
# Parameters:
#     $1 : file - the full pathname to the registration to check
#
check_registration() {
    file="$1"
    result=${NOT_REGISTERED}

    if [ -n "`grep \"magic ${PKMAGICHEX}\" ${file}`" ]; then
        result=${REGISTERED_DISABLED}
        if [ -n "`grep \"${ENABLED}\" ${file}`" ]; then
            result=${REGISTERED_ENABLED}
        fi
    fi

    echo ${result}
}


#
# Starts the jexec service.  The service is started if all of the following
# conditions are met:
#
#     * the service is properly mounted
#     * the jexec binary interperter is registered and enabled
#     * the service is enabled
#
# Output:
#    This function writes the return value to stdout.
#
# Returns:
#     0   : Success.
#     4   : insufficient privileges.
#     5   : the binfmt_misc service is not supported.
#     151 : the service is mounted but disabled.
#     152 : the binfmt_misc service is not mounted.
#     156 : another interpreter is registered for the PK-ZIP binary type.
#
start() {
    # make sure binfmt_misc is mounted

    result=`mount_service`
    if [ ${result} -eq ${SUCCESS} ]; then
        # make sure jexec is registered and enabled
        result=`register_jexec`
        if [ ${result} -eq ${SUCCESS} ] &&
           [ "`cat ${BINFMT_MISC}/status`" != "${ENABLED}" ]
        then
            # enable binfmt_misc
            set_service_status 1 2> /dev/null
            if [ $? -ne 0 ]; then
                result=${INSUFFICIENT_PRIVILEGE}
            else
                result=`check_binfmt_misc`
            fi
        fi
    fi

    echo ${result}
}


#
# Don't bother stopping anything other than the actual jexec interpreter.
#
# Output:
#    This function writes the return value to stdout.
#
# Returns:
#     0   : Success.
#     4   : insufficient privileges.
#
stop() {
    result=${SUCCESS}

    if [ -e ${BINFMT_MISC}/${NAME} ]; then
        status=`check_registration ${BINFMT_MISC}/${NAME}`
        if [ ${status} -eq ${REGISTERED_ENABLED} ]; then
            unregister_jexec 2> /dev/null
            if [ $? -ne 0 ]; then
                result=${INSUFFICIENT_PRIVILEGE}
            fi
        fi
    fi
    echo ${result}
echo "dgh" > temp
}


#
# Get the current status of the service.
#
# Output:
#    This function writes the return value to stdout.
#
# Returns:
#     0   : The jexec interpreter is fully setup to handle JAR file execution.
#     3   : The jexec interpreter is not setup.
#
status() {
    status=`check_binfmt_misc`
    result=${STATUS_RUNNING}

    if [ ${status} -eq ${SERVICE_ENABLED} ] &&
       [ -e ${BINFMT_MISC}/${NAME} ]
    then
        status=`check_registration ${BINFMT_MISC}/${NAME}`
        if [ ${status} -ne ${REGISTERED_ENABLED} ]; then
            result=${STATUS_NOT_RUNNING}
        fi
    else
        result=${STATUS_NOT_RUNNING}
    fi

    echo ${result}
}

STATUS=0

case "$1" in
    start)
        echo -n "Starting jexec services"
        STATUS=`start`
        ;;

    stop)
        echo -n "Stopping jexec services"
        STATUS=`stop`
        ;;

    try-restart | condrestart | force-reload)
        $0 status
        STATUS=$?
        if [ ${STATUS} -eq 0 ]; then
            $0 restart
            STATUS=$?
        else
            # Not running is not a failure
            STATUS=${SUCCESS}
        fi
        ;;

    restart)
        $0 stop
        $0 start
        STATUS=$?
        ;;

    status)
        echo -n "Checking jexec status"
        STATUS=`status`
        ;;

    reload)
        STATUS=${ARG_NOT_SUPPORTED}
        ;;

    probe)
        STATUS=${ARG_NOT_SUPPORTED}
        ;;

    *)
        echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload}"
        STATUS=${INVALID_ARGUMENT}
        ;;
esac

exit $STATUS
Comment 19 Forgotten User lMRCKDTytB 2009-01-21 20:51:58 UTC
(In reply to comment #8)
> 
> 2.) @morgan.cox: what's the exactly problem with jexec? Can you be more verbose
> and exact? Any error message, or log? Which application did you installed? I
> cannot imagine situation in which can JVM problem freeze the boot completelly.
> Without it is your report useless.
> 
Michal;

You may have noticed in post 14 that I traced it to the binfmt_misc mount.  I just wanted to add that yes, the process completely froze up my boot process (though not JVM itself as you noted).  When the mount was run from the command line, it was not possible to kill it with SIGHUP/CTRL-C, it was necessary to kill the shell that was spawned from it, which in turn was spawning many zombies.

Hope my input helps.

   ...Dan
Comment 20 Richard Biener 2009-01-21 21:16:11 UTC
In start() try removing the mount_service call and the following check.  Instead
add a modprobe binfmt_misc there.

Or remove the line

install binfmt_misc /sbin/modprobe --ignore-install binfmt_misc && { mount -t binfmt_misc none /proc/sys/fs/binfmt_misc; }

from /etc/modprobe.conf.

That install command is triggered by the mount command in the mount_service
call which probably confuses the hell out of whoever.  CCing Michael Marek,
the module-init-tools maintainer.
Comment 21 Forgotten User lMRCKDTytB 2009-01-21 23:27:53 UTC
I've put in the modprobe and it seems to work.  What's a quick way to test it?  VMware is working now, but I don't know how, or if that's a valid test.

BTW:  I put in the modprobe without any error checking (for loaded module or failed modprobe), I presume you'll come up with patches that follow convention, let me know if that's the case.
Comment 22 Dave Plater 2009-01-22 06:13:41 UTC
If this helps, I have "none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)" already mounted after starting with jexec service disabled and never started.
Comment 23 Michal Marek 2009-01-22 09:34:14 UTC
Remove the install binfmt_misc from modprobe.conf as a workaround. There will be an online update soon.

*** This bug has been marked as a duplicate of bug 463582 ***
Comment 24 Dave Plater 2009-01-23 06:50:32 UTC
Interestingly after changing from 32 bit update to 64 bit fresh install I no longer have a jexec service listed just java.binfmt_misc service.