SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2013-02-03 05:05:55

cenzo188
Member
Registered: 2013-01-26
Posts: 37

[more or less solved] No GUIs are working.

I am currently having an issue, I have no GUIs of any sort. When it starts up, I get a command line. Attempting to launch any program (except command-line programs like vi) results in a "cannot create display" error.
There's also this other issue: sometimes, I'm getting an error: "No space left on the device" in connection with sudo.

sudo: unable to write to /var/lib/sudo/cenzo/tty1: No space left on device

I'm not too sure because it doesn't stay too long, but I think I'm seeing the same error flash briefly on the screen during start-up. I cant help but think they're connected. I am sure there's plenty of space on the drive, and besides I haven't added anything to it that could have caused it to fill up.
I suppose I should go over the last thing I did before this problem started. I was attempting to copy a video (4GB) to a thumbdrive. The operation failed because there wasn't enough space on the drive. I then attempted to copy it to a friend's external hard drive. But apparently it was a read-only file system, it would not allow me to copy it. I returned the hard drive to my friend, who attempted to see why it was coming up as read-only. When he gave it back to me, I tried copying the file again, only to get a "no space left" error. Despite there being over 300GB of space. After that, I wasn't able to mount the drive. I gave up trying to copy the file and shut down the computer, and when I started it up again, I had this problem.
Mounting the drive on another computer showed that there was definitely a great deal of free space despite my computer failing to copy the file due to insufficient space.
Could it be that some sort of error in the cp command somehow filled my hard drive so that there really isn't any space left? Or could something be causing the OS to 'think' that there's no space left?

I have only been using this OS for a couple of weeks. I was just starting to get used to it... and then this happens and I have no idea what to do. Your help is much appreciated.

Last edited by cenzo188 (2013-02-13 03:45:49)

Offline

Help fund CrunchBang, donate to the project!

#2 2013-02-03 11:06:30

fatmac
#! Die Hard
Registered: 2012-11-14
Posts: 1,948

Re: [more or less solved] No GUIs are working.

Two commands to try are 'df -h' & 'du -hs' - they will give a good estimation of your hdd usage.
You may find a 'core' dump taking up some space, this can safely be deleted.
Check out any 'tmp' or 'temp' directories for unwanted files hogging disc space.
To start a GUI, try 'startx', & take note of what it reports if you don't get a graphical environment.
(Also take a look in /var/lib/sudo/cenzo/tty1 in case something has been copied in there.)


Linux since 1999
Currently:  AntiX, & Crunchbang.
A good general beginners book for Linux :- http://rute.2038bug.com/index.html.gz
A good Debian read :- http://debian-handbook.info/get/now/

Offline

#3 2013-02-03 17:25:39

cenzo188
Member
Registered: 2013-01-26
Posts: 37

Re: [more or less solved] No GUIs are working.

Thank you for those two commands, they're quite useful. It showed I have 1.1GB free on my root partition, and nearly 100GB free on my home partition.
When I tried startx, I did get a graphical environment in which I was able to move the mouse around and open a terminal, but not much else.
And then, when I restarted, I booted normally. As of now it seems there's nothing wrong with it at all. I have no idea WHY, though. I didn't do anything and that gives me the concern that it could happen again at any time. There didn't seem to be much in any temp directories, and nothing copied to the /tty1 folder.
It does seem like the root partition is getting too full, though. That's only about 10% free space. Could that be a problem?

Offline

#4 2013-02-03 19:00:55

fatmac
#! Die Hard
Registered: 2012-11-14
Posts: 1,948

Re: [more or less solved] No GUIs are working.

I don't think 10% free in your / will cause problems unless you want to install more programs.
Linux reserves a percentage of disk space for the root user in cases of emergency, but I, on a home use system have never had cause to make any use of it.
What I usually do when installing is to reduce it to 1% on /, & 0% on my /home & /data partitions.
(tune2fs -m 1 /dev/sda1 will give you some MB's back if you get desperate.)

Last edited by fatmac (2013-02-03 19:01:38)


Linux since 1999
Currently:  AntiX, & Crunchbang.
A good general beginners book for Linux :- http://rute.2038bug.com/index.html.gz
A good Debian read :- http://debian-handbook.info/get/now/

Offline

#5 2013-02-03 19:05:52

fatmac
#! Die Hard
Registered: 2012-11-14
Posts: 1,948

Re: [more or less solved] No GUIs are working.

You might find this thread of interest :-
http://crunchbang.org/forums/viewtopic.php?id=23168


Linux since 1999
Currently:  AntiX, & Crunchbang.
A good general beginners book for Linux :- http://rute.2038bug.com/index.html.gz
A good Debian read :- http://debian-handbook.info/get/now/

Offline

#6 2013-02-03 20:04:01

el_koraco
#!/loony/bun
From: inside Ed
Registered: 2011-07-25
Posts: 4,749

Re: [more or less solved] No GUIs are working.

I would guess the misbehaving copying to the thumb drive caused a problem (maybe root overwrote your .Xauthority or it was removed or something, maybe there were some file system inconsitencies). Force a file system check on next reboot:

sudo touch /forcefsck
sudo reboot

Offline

#7 2013-02-12 02:00:49

cenzo188
Member
Registered: 2013-01-26
Posts: 37

Re: [more or less solved] No GUIs are working.

I hate to kick up this thread, but now I've screwed up and I really am in trouble.
Today I attempted to mount a drive, and I got the "no space" error. Upon checking, my / was indeed full. I am not sure why, I hadnt put anything in there.
So I booted to the live cd ans opened up gparted, with the intention of taking some space out of the 2gb swap space that always seems to read 0% used, as a temporary workaround. But immediately upon starting the operation, every partition was suddenly mounted automatically (is this supposed to happen?) and the operation failed because of this.
Now, I again boot to a shell and am completely unable to launch any displays. There is 0% free space on / partition.
What I believe I really need to do is copy my data, re-format the whole drive so it's suitable for running #! as my primary OS. But all my eggs are in this basket: If I screw something up (like I just did) and my computer is out of commission for long, I'll get behind on my studies. Anybody have an idea for a temporary solution to this?

Offline

#8 2013-02-12 14:44:38

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 891

Re: [more or less solved] No GUIs are working.

^ You can boot off of a flash drive or borrowed hard drive until you get things fixed.
That way you can save things you need later.

This is probably not relevant but you can get the "No space left on the device" error if you reach the maximum number of files for a ext4 partition without using up the free space on your drive.
I had this happen once with a script that called a program that randomized its cache file names every time it was called.
It took 24 hours to delete all the files.

Offline

#9 2013-02-13 02:03:37

cenzo188
Member
Registered: 2013-01-26
Posts: 37

Re: [more or less solved] No GUIs are working.

Last night, I finally bit the bullet and just wiped my hard drive and re-partitioned. Gave myself a nice 30GB for /, even though I'm sure it's more than I'll need. Had some issues with the install, and it took forever to get straightened out, but at the expense of a night of sleep I have a mostly working #! install, with libreoffice and printing support, and that's the most important stuff.
Still can't install Matlab, though. I had problems with this before, with somebody else's help we finally got it working but neither one of us knows exactly how we did it. I still have 24 hours to figure that out, though.

arclance wrote:

you can get the "No space left on the device" error if you reach the maximum number of files for a ext4 partition without using up the free space on your drive.
I had this happen once with a script that called a program that randomized its cache file names every time it was called.
It took 24 hours to delete all the files.

Very interesting. How easy is this to do by accident?

Offline

#10 2013-02-13 03:02:01

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 891

Re: [more or less solved] No GUIs are working.

cenzo188 wrote:

Still can't install Matlab, though. I had problems with this before, with somebody else's help we finally got it working but neither one of us knows exactly how we did it. I still have 24 hours to figure that out, though.

Depending on what you are using Matlab for you could use Octave until you get it installed.
It is intended to be a free equivalent to Matlab and the code is mostly compatible.

cenzo188 wrote:
arclance wrote:

you can get the "No space left on the device" error if you reach the maximum number of files for a ext4 partition without using up the free space on your drive.
I had this happen once with a script that called a program that randomized its cache file names every time it was called.
It took 24 hours to delete all the files.

Very interesting. How easy is this to do by accident?

Unless you are scripting something it is unlikely to happen by accident.
The maximum number of files in a ext4 file system is 4 Billion.
It took about a week to run out with calcurse making about 5 text files a second without me knowing.
I ended up ditching calcurse entirely and did everything in Python, this is what I ended up with.

Offline

#11 2013-02-13 03:26:27

hinto
#! Windbag
From: Cary, NC
Registered: 2010-12-08
Posts: 1,396

Re: [more or less solved] No GUIs are working.

Don't forget that /tmp is on /, unless you put it somewhere else.  I use SAS so lots of stuff gets put in /tmp so I need to plan accordingly.
-Hinto


"Sometimes I wish I hadn't taken the red pill" -Me

Offline

#12 2013-02-13 03:43:49

cenzo188
Member
Registered: 2013-01-26
Posts: 37

Re: [more or less solved] No GUIs are working.

arclance wrote:

Depending on what you are using Matlab for you could use Octave until you get it installed.

Won't do, I'm afraid. I need Matlab for class, if I don't have it my grade will take a hit. I've still got the CD, but I still keep getting the "Exception in thread "main" java.lang.NoClassDefFoundError" upon running the installer. Last time, it worked because, well, one time we tried it and it just didn't do that. No idea why it happened, but it isn't happening again. Not quite sure what can be done about this, if anything.

arclance wrote:

I ended up ditching calcurse entirely and did everything in Python, this is what I ended up with.

Looks nice.

Offline

#13 2013-02-13 03:47:21

hinto
#! Windbag
From: Cary, NC
Registered: 2010-12-08
Posts: 1,396

Re: [more or less solved] No GUIs are working.

NoClassDefFoundError is a java error, usually indicating that the classpath is incorrect for the java app that's trying to run.
-Hinto


"Sometimes I wish I hadn't taken the red pill" -Me

Offline

#14 2013-02-13 03:49:34

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 891

Re: [more or less solved] No GUIs are working.

^^ You may need the Sun or Oracle version of Java not OpenJDK.
Making that change usually fixes Java problems with commercial software.
It is also possible that you need the JDK (Java Development Kit) and not the JRE (Java Runtime Environment) for it to work.

Offline

#15 2013-02-13 03:55:23

hinto
#! Windbag
From: Cary, NC
Registered: 2010-12-08
Posts: 1,396

Re: [more or less solved] No GUIs are working.

I haven't had any problems with OpenJDK.  That doesn't mean that none exist.  If you post the stacktrace of the exception that would help.  However, I've found that classpath causes about 99% of the problems. (Steven Wright says 41.7% of statistics are made up on the spot)

-Hinto


"Sometimes I wish I hadn't taken the red pill" -Me

Offline

#16 2013-02-13 03:56:39

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 891

Re: [more or less solved] No GUIs are working.

^ There are a few things that don't work with OpenJDK.
Minecraft is the only one I can think of off the top of my head.
I have had problems with websites that use Java in the past with OpenJDK but those problems may have been resolved by now.
Java use on websites is much less common now anyway so it is not really a problem.

Last edited by arclance (2013-02-13 04:02:08)

Offline

#17 2013-02-13 04:03:23

hinto
#! Windbag
From: Cary, NC
Registered: 2010-12-08
Posts: 1,396

Re: [more or less solved] No GUIs are working.

I don't play games.  I code Java/C/C++.  If the OP posts the Exception, then we'll know what the problem is.
-Hinto

Last edited by hinto (2013-02-13 04:04:18)


"Sometimes I wish I hadn't taken the red pill" -Me

Offline

#18 2013-02-13 04:31:52

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 891

Re: [more or less solved] No GUIs are working.

About 40% of my Java problems over the years have be OpenJDK related, 40% were due to needing a newer version of Java, 10% were due to broken code, and the last 10% were due to operator error or incorrect instructions.
Hopefully the Matlab installer gives him the full exception so we can see it.

Offline

#19 2013-02-13 04:33:41

cenzo188
Member
Registered: 2013-01-26
Posts: 37

Re: [more or less solved] No GUIs are working.

This is the first few lines of what appears upon running the installer off the CD with sh ./install. Oddly, if I type just ./install,  get "permission denied" even if I'm root. I don't believe this happened the first time I installed it.

Preparing installation files ...
Installing ...
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.awt.Component
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at $Proxy11.<clinit>(Unknown Source)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

It continues much in the same fashion for another hundred lines or so. I'll post the rest upon request, but it seems pretty redundant. I checked the java situation, I've got OpenJDK. I'll try installing the Oracle version, but on my internet it will be several hours before the download is complete. (I've gone and downloaded too much stuff and my internet speed's been cut.)
I'm hoping that it will fix the problem.

Last edited by cenzo188 (2013-02-13 04:34:51)

Offline

#20 2013-02-13 05:08:38

hinto
#! Windbag
From: Cary, NC
Registered: 2010-12-08
Posts: 1,396

Re: [more or less solved] No GUIs are working.

java.awt.Component
is available in any JDK.
I'd say it's a classpath problem.
-H


"Sometimes I wish I hadn't taken the red pill" -Me

Offline

#21 2013-02-13 06:27:47

cenzo188
Member
Registered: 2013-01-26
Posts: 37

Re: [more or less solved] No GUIs are working.

I got a faster download and finished the install of Oracle java. It went well, but no change in Matlab. Still fails with the same errors.

hinto wrote:

I'd say it's a classpath problem.

Any tips as to how to go about correcting this?

Offline

#22 2013-02-13 07:25:06

hinto
#! Windbag
From: Cary, NC
Registered: 2010-12-08
Posts: 1,396

Re: [more or less solved] No GUIs are working.

Can you post the contents of the install script (provided it isn't too big)?
also can you do

java -version

at the command line?
-H

Last edited by hinto (2013-02-13 07:25:34)


"Sometimes I wish I hadn't taken the red pill" -Me

Offline

#23 2013-02-13 15:17:54

cenzo188
Member
Registered: 2013-01-26
Posts: 37

Re: [more or less solved] No GUIs are working.

hinto wrote:

Can you post the contents of the install script (provided it isn't too big)?

I sure can.

#!/bin/sh
#
# Name:
#    install -  script file for invoking the Multi-platform installer on Linux.
#
#    Usage: install [-h|help]"
#                              [-javadir <directory>] | [-root <directory>] |"
#                              [-test] | [-v|-verbose]"
#                              -h|-help        - Display arguments."
#                              -test           - Don't actually run the java
#                                                command (only useful with -v)."
#                              -v|-verbose     - Display settings."
#                              -javadir <directory>  - Override default java root directory."
#                              -root <directory>     - Override default DVD root directory."
#                              -tmpdir <directory>   - Override default directory for temporary files."
#
#              The default settings when no override inputs are supplied are:
#              -root = <directory containing this script>
#              -javadir = <root>/sys/java/jre/$ARCH/jre
#              -tmpdir = /tmp"
#
#
# Copyright 2009-2011 The MathWorks, Inc.
#__________________________________________________________________________
#
    arg0_=$0
#
#
    trap "exit 1" 1 2 3 15
#
#========================= java_launcher (start) ============================
#
#========================= archlist.sh (start) ============================
#
# usage:        archlist.sh
#
# abstract:     This Bourne Shell script creates the variable ARCH_LIST.
#
# note(s):      1. This file is always imbedded in another script
#
# Copyright 1997-2007 The MathWorks, Inc.
# $Revision: 1.1.6.3 $  $Date: 2007/11/12 22:52:47 $
#----------------------------------------------------------------------------
#
    ARCH_LIST='glnx86 glnxa64 mac maci maci64 sol2 sol64'
#=======================================================================
# Functions:
#   check_archlist ()
#=======================================================================
    check_archlist () { # Sets ARCH. If first argument contains a valid
			# arch then ARCH is set to that value else
		        # an empty string. If there is a second argument
			# do not output any warning message. The most
			# common forms of the first argument are:
			#
			#     ARCH=arch
			#     MATLAB_ARCH=arch
			#     argument=-arch
			#
                        # Always returns a 0 status.
                        #
                        # usage: check_archlist arch=[-]value [noprint]
                        #
	if [ $# -gt 0 ]; then
	    arch_in=`expr "$1" : '.*=\(.*\)'`
	    if [ "$arch_in" != "" ]; then
	        ARCH=`echo "$ARCH_LIST EOF $arch_in" | awk '
#-----------------------------------------------------------------------
	{ for (i = 1; i <= NF; i = i + 1)
	      if ($i == "EOF")
		  narch = i - 1
	  for (i = 1; i <= narch; i = i + 1)
		if ($i == $NF || "-" $i == $NF) {
		    print $i
		    exit
		}
	}'`
#-----------------------------------------------------------------------
	       if [ "$ARCH" = "" -a $# -eq 1 ]; then
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo ' '
echo "    Warning: $1 does not specify a valid architecture - ignored . . ."
echo ' '
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	       fi
	    else
		ARCH=""
	    fi
	else
	    ARCH=""
	fi
#
	return 0
    }
#=======================================================================
#========================= archlist.sh (end) ==============================
ARCH=
#========================= arch.sh (start) ============================
#!/bin/sh
#
# usage:        arch.sh
#
# abstract:     This Bourne Shell script determines the architecture
#               of the the current machine.
#
#               ARCH      - Machine architecture
#
#               IMPORTANT: The shell function 'check_archlist' is used
#                          by this routine and MUST be loaded first.
#                          This can be done by sourcing the file,
#
#                              archlist.sh
#
#                          before using this routine.
#
# note(s):      1. This routine must be called using a . (period)
#
#               2. Also returns ARCH_MSG which may contain additional
#                  information when ARCH returns 'unknown'.
#
# Copyright 1986-2011 The MathWorks, Inc.
#----------------------------------------------------------------------------
#
#=======================================================================
# Functions:
#   realfilepath ()
#   matlab_arch ()
#=======================================================================
    realfilepath () { # Returns the actual path in the file system
                      # of a file. It follows links. It returns an
                      # empty path if an error occurs.
                      #
                      # Returns a 1 status if the file does not exist
                      # or appears to be a circular link. Otherwise,
                      # a 0 status is returned.
                      #
                      # usage: realfilepath filepath
                      #
    filename=$1
#
# Now it is either a file or a link to a file.
#
    cpath=`pwd`

#
# Follow up to 8 links before giving up. Same as BSD 4.3
#
      n=1
      maxlinks=8
      while [ $n -le $maxlinks ]
      do
#
# Get directory correctly!
#
	newdir=`echo "$filename" | awk '
                        { tail = $0
                          np = index (tail, "/")
                          while ( np != 0 ) {
                             tail = substr (tail, np + 1, length (tail) - np)
                             if (tail == "" ) break
                             np = index (tail, "/")
                          }
                          head = substr ($0, 1, length ($0) - length (tail))
                          if ( tail == "." || tail == "..")
                             print $0
                          else
                             print head
                        }'`
	if [ ! "$newdir" ]; then
	    newdir="."
	fi
	(cd "$newdir") > /dev/null 2>&1
	if [ $? -ne 0 ]; then
	    return 1
	fi
	cd "$newdir"
#
# Need the function pwd - not the built in one
#
	newdir=`/bin/pwd`
#
	newbase=`expr //"$filename" : '.*/\(.*\)' \| "$filename"`
        lscmd=`ls -ld "$newbase" 2>/dev/null`
	if [ ! "$lscmd" ]; then
	    return 1
	fi
#
# Check for link portably
#
	if [ `expr "$lscmd" : '.*->.*'` -ne 0 ]; then
	    filename=`echo "$lscmd" | awk '{ print $NF }'`
	else
#
# It's a file
#
	    dir="$newdir"
	    command="$newbase"
#
	    cd "$dir"
#
# On Mac OS X, the -P option to pwd causes it to return a resolved path, but
# on 10.5, -P is no longer the default, so we are now passing -P explicitly
#
            if [ "$ARCH" = 'mac' -o "$ARCH" = 'maci' -o "$ARCH" = 'maci64' ]; then
                echo `/bin/pwd -P`/$command
#
# The Linux version of pwd returns a resolved path by default, and there is
# no -P option
#
            else
                echo `/bin/pwd`/$command
            fi
	    break
	fi
	n=`expr $n + 1`
      done
      if [ $n -gt $maxlinks ]; then
	return 1
      fi

    cd "$cpath"
    }
#
#=======================================================================
    set_mac_arch() {
        # First check to see if maci64 is even possible on this hardware
        if [ "`/usr/sbin/sysctl -n hw.cpu64bit_capable`" = "0" ]; then
            # maci64 is not possible. So set the arch to maci.
            ARCH="maci"
            return
        fi

        # Now check to see if maci64 is asked for
        if [ "$MACI64" = "0" ]; then
            # only maci is wanted, so arch is maci.
            ARCH="maci"
            return
        fi

        # If we get to this point, maci64 is available and desired. So, check to
        # see if 64 bit binaries are available. First, if $MATLABROOT is NOT
        # set, we can't really check for anything else.
        if [ "$MATLABROOT" = "" ]; then
            ARCH="maci64";
            return
        fi


        # if we get to this point, we need to check the binaries that we have to
        # find out if we have maci64 binaries
        if [ -d "$MATLABROOT/bin/maci64" ]; then
            ARCH="maci64"
            return
        fi

        # if we get to this point, even though maci64 is possible and desired,
        # the maci64 binaries aren't available, so fall back to maci
        ARCH="maci"
    }

#
#=======================================================================
    matlab_arch () {  # Determine the architecture for MATLAB
                      # It returns the value in the ARCH variable.
                      # If 'unknown' is returned then sometimes a
                      # diagnostic message is returned in ARCH_MSG.
                      #
                      # Always returns a 0 status.
                      #
                      # usage: matlab_arch
                      #
        ARCH="unknown"
#
        if [ -f /bin/uname ]; then
            case "`/bin/uname`" in
                SunOS)                                  # Solaris
                    case "`/bin/uname -p`" in
                        sparc)
                            ARCH="sol64"
                            ;;
                        i386)
                            ARCH="sola64"
                            ;;
                    esac
                    ;;
                Linux)
                    case "`/bin/uname -m`" in
                        i*86)
                            ARCH="glnx86"
                            ;;
                        x86_64)
                            ARCH="glnxa64"
                            ;;
                    esac
                    ;;
# Usually uname lives in /usr/bin on the Mac, but sometimes people
# have links in /bin that link uname to /usr/bin.  Because of this
# Mac needs to be listed in the checks for both /bin/uname and /usr/bin/uname
                Darwin)                                 # Mac OS X
                    case "`/bin/uname -p`" in
                        i386)
                            set_mac_arch
                            ;;
                        esac
                    ;;
                *)
                    :
                    ;;
            esac
        elif [ -f /usr/bin/uname ]; then
            case "`/usr/bin/uname`" in
                Darwin)                                 # Mac OS X
                    case "`/usr/bin/uname -p`" in
                        i386)
                            set_mac_arch
                            ;;
                        esac
                    ;;
            esac
        fi
        return 0
    }
#=======================================================================
#
# The local shell function check_archlist is assumed to be loaded before this
# function is sourced.
#
    ARCH_MSG=''
    check_archlist ARCH=$ARCH
    if [ "$ARCH" = "" ]; then
        if [ "$MATLAB_ARCH" != "" ]; then
            check_archlist MATLAB_ARCH=$MATLAB_ARCH
        fi
        if [ "$ARCH" = "" ]; then
            matlab_arch
        fi
    fi
    Arch=$ARCH
#========================= arch.sh (end) ==============================
    setMac () {
        if [ "$ARCH" = "maci" -o "$ARCH" = "maci64" ]; then
            ISMAC=1
        else
            ISMAC=0
        fi
        export ISMAC
         
    }
#=======================================================================
    setVMenvironment () {
    #   Set up some variables for the VM environment

    # Augment with AWT Motif default locale resource files
    XFILESEARCHPATH="$JRE_LOC/lib/locale/%L/%T/%N%S:$XFILESEARCHPATH"
    export XFILESEARCHPATH

    # Determine <final_load_library_path> for each platform
    #
    libraryPathsToAdd=$1
    
    case "$ARCH" in
        glnx*)
            LD_LIBRARY_PATH="`eval echo $LD_LIBRARY_PATH`"
            if [ "$LD_LIBRARY_PATH" != "" ]; then
                LD_LIBRARY_PATH="$libraryPathsToAdd":$LD_LIBRARY_PATH
            else
                LD_LIBRARY_PATH="$libraryPathsToAdd"
            fi
            export LD_LIBRARY_PATH
            ;;
        mac*)
            DYLD_LIBRARY_PATH="`eval echo $DYLD_LIBRARY_PATH`"
            if [ "$DYLD_LIBRARY_PATH" != "" ]; then
                DYLD_LIBRARY_PATH="$libraryPathsToAdd":$DYLD_LIBRARY_PATH
            else
                DYLD_LIBRARY_PATH="$libraryPathsToAdd"
            fi
            export DYLD_LIBRARY_PATH
            ;;
        *)
            LD_LIBRARY_PATH="`eval echo $LD_LIBRARY_PATH`"
            if [ "$LD_LIBRARY_PATH" != "" ]; then
                LD_LIBRARY_PATH=$LD_LIBRARY_PATH
            else
                LD_LIBRARY_PATH=
            fi
            export LD_LIBRARY_PATH
            ;;
    esac

    }
#=======================================================================
    setVMpath () {
    #
    # Determine the java vm path for each platform.
    #

    if [ $ISMAC -eq 1 ]; then
        JAVA_HOME_CMD=/usr/libexec/java_home
        # Newer Macs have the java_home command, 
        # older ones (some 10.5 machines) might not. This check 
        # can be removed once 10.5 is no longer supported
        if [ ! -f $JAVA_HOME_CMD ]; then
            DEFAULT_JRE_LOC=/Library/Java/Home
        else
            # Ask for a 64-bit Java 1.6 (or higher) VM
            DEFAULT_JRE_LOC=`$JAVA_HOME_CMD -v 1.6+ -d64 -F`
            if [ $? != 0 ]; then
                # java_home couldn't find what we want so error out
                echo "Error: Cannot locate Java Runtime Environment (JRE)."
                exit 1
            fi
        fi
    else
        javaRoot=$1
        DEFAULT_JRE_LOC=$javaRoot/jre/$ARCH/jre
        # If the JRE doesn't exist and we are on glnxa64, try to fall back to glnx86
        if [ ! -d "$DEFAULT_JRE_LOC" ]; then
            if [ "$ARCH" = "glnxa64" ]; then
                echo "Could not find JRE for glnxa64.  Trying glnx86."
                ARCH=glnx86
                DEFAULT_JRE_LOC=$javaRoot/jre/$ARCH/jre
            fi
        fi
    fi

    if [ "$JRE_LOC" = "" ]; then
        JRE_LOC=$DEFAULT_JRE_LOC
    fi
#
# Look for JRE
#
    if [ ! -d "$JRE_LOC" ]; then
        echo "---------------------------------------------------------------------------"
        echo "Error: Cannot locate Java Runtime Environment (JRE)."
        echo "The directory $JRE_LOC does not exist."
        echo "---------------------------------------------------------------------------"
        exit 1
    fi
    }
#=======================================================================
    getJarPaths () {
    # Get the full search path for our jar files
    # Echos the search path to stdout.

    JAVA_DIR="$1/java"
    JAR_LOC="$JAVA_DIR/jar"
    JAREXT_LOC="$JAVA_DIR/jarext"
    JAR_SEARCH_PATHtmp=$JRE_LOC/lib/ext:$JAR_LOC:$JAREXT_LOC

    # Get list of directories in JAREXT_LOC
    theDirList=`ls -1Ap "$JAREXT_LOC" | grep '/'`
    # Add all subdirectories of JAREXT_LOC (but not recursively)
    for aDir in $theDirList
    do
        JAR_SEARCH_PATHtmp=$JAR_SEARCH_PATHtmp:$JAREXT_LOC/$aDir
    done

    # If MW_LIB_EXT_DIRS env var set, append value to existing search path
    if [ "$MW_LIB_EXT_DIRS" != "" ]; then
        JAR_SEARCH_PATHtmp=$JAR_SEARCH_PATHtmp:$MW_LIB_EXT_DIRS
    fi

    echo $JAR_SEARCH_PATHtmp
    }
#=======================================================================
    copyDirWritable() { 
    # Copy an entire directory.  This will create the destination 
    # directory, do a recursive copy, and then make all the files and 
    # directories writable.
    # usage: copyDirWritable src dest
    srcDir=$1
    destDir=$2

    mkdir -p "$destDir"
    cp -RLf "$srcDir"/* "$destDir"
    chmod -R +w "$destDir" 2>/dev/null

    }
#========================= java_launcher (end) ==============================
    copyJREAndJarsToTmp () {
    #
    # Copy JRE and Jars to tmp
    #
    echo "Preparing installation files ..."
    if [ $ISMAC -eq 0 ]; then
	NEW_JRE_LOC="$TEMP_DIR/sys/java/jre/$ARCH/jre"
        copyDirWritable "$JRE_LOC" "$NEW_JRE_LOC"
	JRE_LOC=$NEW_JRE_LOC
    fi
    JAVA_DIR="$TEMP_DIR/java"
    JAR_LOC="$JAVA_DIR/jar"
    JAREXT_LOC="$JAVA_DIR/jarext"
    copyDirWritable "$ROOT/java" "$JAVA_DIR"
    }
#=======================================================================
    getJavaLaunchTarget () {
    #   Find jar file to execute.
    # TODO: Consolidate this code with getClassName() from activation and 
    #       move to java_launcher_template

    MAIN_CLASS="com/mathworks/professionalinstaller/Launcher"

    BOOTSTRAP_PROPERTIES=$ROOT/java/bootstrap.properties

    if [ -f "$BOOTSTRAP_PROPERTIES" ]; then
        MAIN_CLASS_OVERRIDE=`grep -i mainclass "$BOOTSTRAP_PROPERTIES" | awk -F= '{ print $2 }' | sed 's/ //g'`
        if [ "$MAIN_CLASS_OVERRIDE" != "" ]; then
            MAIN_CLASS=$MAIN_CLASS_OVERRIDE
        fi
    fi

    #   By default, set launch target to main class
    JAVA_LAUNCH_TARGETtmp=$MAIN_CLASS

    #   If MW_MAIN_CLASS env var set, set launch target to "$MW_MAIN_CLASS"
    if [ "$MW_MAIN_CLASS" != "" ]; then
        JAVA_LAUNCH_TARGETtmp=$MW_MAIN_CLASS
    fi

    echo $JAVA_LAUNCH_TARGETtmp
    }
#=======================================================================
#
# Parse the arguments
#
    stat="OK"
    JAR_LOC=
    JAREXT_LOC=
    JAR_SEARCH_PATH=
    VERBOSE=0
    TEMP_DIR="/tmp/mathworks_$$"
    JRE_LOC=
    XTRAFLAGS=
    TESTONLY=0
    arglist=
    SHOW_SPLASH=1

#   Set default values for some variables if they are not set yet.
    if [ "$ROOT" = "" ]; then
        SETUP_FILE=`realfilepath "$0"`
        ROOT=`dirname "$SETUP_FILE"`
    fi

    while [ "$stat" = "OK" -a  $# -gt 0 ]; do
        case "$1" in
            -h|-help)
                stat=""
                ;;
            -v|-verbose)
                VERBOSE=1;
                ;;
            -javadir)
                if [ $# -eq 1 ]; then
                    echo "A JRE directory must be specified with -javadir."
                    stat=""
                else
                    shift
                    JRE_LOC=$1;

                    if [ ! -d "$JRE_LOC" ]; then
                        echo "The directory $JRE_LOC does not exist."
                        stat=""
                    fi
                    if [ ! -d "$JRE_LOC/lib" ]; then
                        echo "$JRE_LOC does not appear to be a JRE directory."
                        stat=""
                    fi
                fi
                ;;
            -root)
                if [ $# -eq 1 ]; then
                    echo "A DVD directory must be specified with -root."
                    stat=""
                else
                    shift
                    ROOT=$1;
                    if [ ! -d "$ROOT" ]; then
                        echo "The directory $ROOT does not exist."
                        stat=""
                    fi
                fi
                ;;
            -tmpdir)
                if [ $# -eq 1 ]; then
                    echo "A directory for temporary files must be specified with -tmpdir."
                    stat=""
                else
                    shift
                    TEMP_DIR="$1/mathworks_$$"
                fi
                ;;
            -test)
                # Just run through script without actually running the java
                # command.  Only useful with -v.
                TESTONLY=1
                ;;
            -psn*)
                # Apple passes this in with things that are double clicked. Ignore.
                ;;
            -*)
                OPTION=$1
                OPTION="$(echo ${OPTION} | tr '[:upper:]' '[:lower:]')"
                if [ $OPTION = "-mode" ]; then
                    SHOW_SPLASH=0
                fi
                if [ $OPTION = "-inputfile" ]; then
                    SHOW_SPLASH=0
                fi
                found=0
                # Check for -arch
                arch=$ARCH
                check_archlist argument=$1 noprint
                if [ "$ARCH" != "" ]; then
                    found=1
                else
                    ARCH=$arch
                fi
                if [ "$found" = "0" ]; then
                    arglist="$arglist $1"
                fi
                ;;
            *)
                arglist="$arglist $1"
                ;;
        esac
        shift
    done
    setMac
#
# Check for errors
#
    if [ "$stat" != "OK" ]; then        # An error occurred.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    echo ""
    echo "   Usage: install [-h|help]"
    echo "                             [-javadir <directory>] | [-root <directory>] |"
    echo "                             [-test] | [-v|-verbose]"
    echo ""
    echo "    -h|-help        - Display arguments."
    echo "    -test           - Don't actually run the java command (only useful with -v)."
    echo "    -v|-verbose     - Display settings."
    echo "    -javadir <directory>       - Override default java root directory."
    echo "    -root <directory>          - Override default DVD root directory."
    echo "    -tmpdir <directory>        - Override default directory for temporary files."
    echo ""
    echo "    The default settings when no override inputs are supplied are: "
    echo "    -root = <directory containing this script>"
    echo "    -javadir = <root>/sys/java/jre/$ARCH/jre"
    echo "    -tmpdir = /tmp"
    echo ""
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        exit 1
    fi

#   Determine the java vm path for each platform.
    setVMpath "$ROOT/sys/java"
    copyJREAndJarsToTmp

#   Set up some variables for the VM environment.
    copyDirWritable "$ROOT/bin/$ARCH" "$TEMP_DIR/bin/$ARCH"
    setVMenvironment "$TEMP_DIR/bin/$ARCH"

#   Get the jar directories
    JAR_SEARCH_PATH=`getJarPaths "$TEMP_DIR"`

#   Get the java launch target
    JAVA_LAUNCH_TARGET=`getJavaLaunchTarget`

#   Set up splash option
    if [ $SHOW_SPLASH -eq 1 ]; then
        SPLASH_OPTION="-splash:\"$ROOT/java/splash.png\""
    else
        SPLASH_OPTION=""
    fi

#   Set up java command to run.
    if [ $ISMAC -eq 1 ]; then
        XTRAFLAGS="-d64 -Xdock:name=\"Install MATLAB\" -Xdock:icon=\"$ROOT/InstallForMacOSX.app/Contents/Resources/membrane.icns\" -Xmx512m"
    fi
    java_exe=$JRE_LOC/bin/java
    java_cmd="$java_exe $XTRAFLAGS $SPLASH_OPTION -Djava.ext.dirs=$JAR_SEARCH_PATH $JAVA_LAUNCH_TARGET -root \"$ROOT\" -tmpdir \"$TEMP_DIR\" $arglist"

#
    if [ "$VERBOSE" = "1" ]; then
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    echo "->  DVD                 = $ROOT"
    echo "->  ARCH                = $ARCH"
    echo "->  DISPLAY             = $DISPLAY"
    echo "->  TESTONLY            = $TESTONLY"
    echo "->  JRE_LOC             = $JRE_LOC"
#
        case "$ARCH" in
            mac*)
    echo "->  DYLD_LIBRARY_PATH   = $DYLD_LIBRARY_PATH"
                ;;
            *)
    echo "->  LD_LIBRARY_PATH     = $LD_LIBRARY_PATH"
                ;;
        esac

    echo " "
    echo "Command to run:"
    echo "$java_cmd"
    echo " "
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    fi
#
#
#   Run the java command to start the install app
    if [ "$TESTONLY" != "1" ]; then
        echo "Installing ..."
        eval $java_cmd

#   Clean up
        rm -rf $TEMP_DIR
    fi

    echo "Finished"

And the Java version is
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

Offline

#24 2013-02-13 15:37:07

hinto
#! Windbag
From: Cary, NC
Registered: 2010-12-08
Posts: 1,396

Re: [more or less solved] No GUIs are working.

I'm running the OpenJDK from the repos which is:

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

But that won't matter.
Looking at the script, I *think* you want invoke it something like: (provided install has execute permissions)

./install -javadir /usr/lib/jvm/java-6-sun/jre

Where -javadir points to my jre.  You'll have something similar.
If you installed Sun/Oracle jre, then you'll have to point to it.
That should get you past the ClassDefNotFoundError.

Alternatively you can create an environment variable, but I never run with classpath set... it's too problematic.


-Hinto


"Sometimes I wish I hadn't taken the red pill" -Me

Offline

Help fund CrunchBang, donate to the project!

#25 2013-02-13 17:42:48

cenzo188
Member
Registered: 2013-01-26
Posts: 37

Re: [more or less solved] No GUIs are working.

That didn't work, I'm afraid. It says that the file "java.security" doesn't exist. The file appears to exist right where it should be.
I tried this the first time I installed Matlab. It didn't work then, either. Any idea why I get "permission denied" (even as root) when trying to run the installer, unless I use sh? That did not happen last time and it seems a bit wrong.

EDIT: Upon looking up the color-coding used in ls output, I was wrong: The java.security file doesn't exist, it's an orphan symlink. This points to "../../../../../x86_64-linux-gnu/security/classpath.security" which is "/usr/lib/x86_64-linux-gnu". This directory does not contain a "security" directory.

Last edited by cenzo188 (2013-02-13 17:51:40)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo