Describe GraalVM and your environment :
Installed graalvm. Java and all the commands works fine.
However when I run any gu command other than help I get
$ gu info
Error: The GraalVM directory [ommited directory] is invalid
I tried turning on logging and debug but it fails to quickly for any logging.
I figured out the issue.
In my bash profile I was originally doing something like:
GRAAL_HOME=/some/directory/graalvm-ce-java8-20.0.0
export GRAALVM_HOME=${GRAAL_HOME}/Contents/Home
export PATH=$GRAAL_HOME/Contents/Home/bin:$PATH
export JAVA_HOME=$GRAAL_HOME/Contents/Home
I was just using the GRAAL_HOME variable to help construct the correct path.
Than for whatever reason I changed it to export GRAAL_HOME
export GRAAL_HOME=/some/directory/graalvm-ce-java8-20.0.0
Apparently the gu tool uses the GRAAL_HOME environment variable.
I googled around and could not find any documentation on that environment variable.
Anyway once I stopped exporting the variable the tool worked as expected.
Feel free to close.
GU will use $GRAALVM_HOME env. variable instead of GRAAL_HOME
working with GraalVM Updater 20.2.0
I also get this error unless I set GRAAL_HOME:
20201115T200432 [email protected]:~/d.sws/conan-envs/default
$ env | grep GRAAL
GRAALVM_HOME=/home/iwana/.conan/data/graalvm-ce-prebuilt/20.2.0/aucampia/default/package/56f0443cd1e67a6394d0ba61f9aac996bafae6a9
GRAAL_HOME=/home/iwana/.conan/data/graalvm-ce-prebuilt/20.2.0/aucampia/default/package/56f0443cd1e67a6394d0ba61f9aac996bafae6a9
20201115T200437 [email protected]:~/d.sws/conan-envs/default
$ gu list
ComponentId Version Component name Origin
--------------------------------------------------------------------------------
js 20.2.0 Graal.js
graalvm 20.2.0 GraalVM Core
20201115T200439 [email protected]:~/d.sws/conan-envs/default
$ unset GRAAL_HOME
20201115T200442 [email protected]:~/d.sws/conan-envs/default
$ env | grep GRAAL
GRAALVM_HOME=/home/iwana/.conan/data/graalvm-ce-prebuilt/20.2.0/aucampia/default/package/56f0443cd1e67a6394d0ba61f9aac996bafae6a9
20201115T200444 [email protected]:~/d.sws/conan-envs/default
$ gu list
Error: The GraalVM directory /home/iwana/.conan/data/graalvm-ce-prebuilt/20.2.0/aucampia/default/package is invalid.
Was working off graalvm-ce-java11-linux-amd64-20.2.0.tar.gz
I just tried and gu worsk without setting any environment property on my computer.
~/graalvm-ce-java11-20.2.0/bin$ ./gu available
running it like this returns list of all components. I don't have anything set on my machine no $GRAAL_HOME, $GRAALVM_HOME, no $JAVA_HOME.
Can you try it without these env. variables set?
Okay I figured out under what circumstance this was happening.
Clean extract from archive works well:
$ \rm -rf graalvm-ce-java11-20.2.0/
$ bsdtar -xf ~/.conan/data/graalvm-ce-prebuilt/20.2.0/aucampia/default/source/graalvm-ce-java11-linux-amd64-20.2.0.tar.gz
$ ./graalvm-ce-java11-20.2.0/bin/gu --version
GraalVM Updater 20.2.0
However if bin/gu is not a symlink to ../lib/installer/bin/gu but instead the actual file it does not work:
$ # Check that file is a symlink:
$ ls -ld ./graalvm-ce-java11-20.2.0/bin/gu
lrwxrwxrwx. 1 iwana iwana 23 Aug 16 10:31 ./graalvm-ce-java11-20.2.0/bin/gu -> ../lib/installer/bin/gu
$ # replace symlink with file it points to:
$ \cp -v --remove-destination $(readlink -f ./graalvm-ce-java11-20.2.0/bin/gu) ./graalvm-ce-java11-20.2.0/bin/gu
removed './graalvm-ce-java11-20.2.0/bin/gu'
'/var/tmp/graalvm-ce-java11-20.2.0/lib/installer/bin/gu' -> './graalvm-ce-java11-20.2.0/bin/gu'
$ # no longer a symlink
$ ls -ld ./graalvm-ce-java11-20.2.0/bin/gu
-rwxr-xr-x. 1 iwana iwana 27338772 Nov 18 23:19 ./graalvm-ce-java11-20.2.0/bin/gu
$ ./graalvm-ce-java11-20.2.0/bin/gu --version
Error: The GraalVM directory /var/tmp is invalid.
Unless you set GRAAL_HOME:
$ export GRAAL_HOME=$(readlink -f ./graalvm-ce-java11-20.2.0)
$ ./graalvm-ce-java11-20.2.0/bin/gu --version
GraalVM Updater 20.2.0
Pardon me, why to replace symlink created in graalvm /bin folder with a file copied from installer/bin/gu? I miss the reason for this change, sorry.
No good reason, I was installing it with conan and conan defaults to this behaviour. When instructing conan to copy symlinks this problem goes away. Hopefully the detail can help someone who has this problem in the future.
OK, thank you for investigation and posting the root cause of your problem here.
Okay I figured out under what circumstance this was happening.
Clean extract from archive works well:
$ \rm -rf graalvm-ce-java11-20.2.0/ $ bsdtar -xf ~/.conan/data/graalvm-ce-prebuilt/20.2.0/aucampia/default/source/graalvm-ce-java11-linux-amd64-20.2.0.tar.gz $ ./graalvm-ce-java11-20.2.0/bin/gu --version GraalVM Updater 20.2.0However if
bin/guis not a symlink to../lib/installer/bin/gubut instead the actual file it does not work:$ # Check that file is a symlink: $ ls -ld ./graalvm-ce-java11-20.2.0/bin/gu lrwxrwxrwx. 1 iwana iwana 23 Aug 16 10:31 ./graalvm-ce-java11-20.2.0/bin/gu -> ../lib/installer/bin/gu $ # replace symlink with file it points to: $ \cp -v --remove-destination $(readlink -f ./graalvm-ce-java11-20.2.0/bin/gu) ./graalvm-ce-java11-20.2.0/bin/gu removed './graalvm-ce-java11-20.2.0/bin/gu' '/var/tmp/graalvm-ce-java11-20.2.0/lib/installer/bin/gu' -> './graalvm-ce-java11-20.2.0/bin/gu' $ # no longer a symlink $ ls -ld ./graalvm-ce-java11-20.2.0/bin/gu -rwxr-xr-x. 1 iwana iwana 27338772 Nov 18 23:19 ./graalvm-ce-java11-20.2.0/bin/gu$ ./graalvm-ce-java11-20.2.0/bin/gu --version Error: The GraalVM directory /var/tmp is invalid.Unless you set GRAAL_HOME:
$ export GRAAL_HOME=$(readlink -f ./graalvm-ce-java11-20.2.0) $ ./graalvm-ce-java11-20.2.0/bin/gu --version GraalVM Updater 20.2.0
export GRAAL_HOME works for me.
Most helpful comment
I figured out the issue.
In my bash profile I was originally doing something like:
I was just using the GRAAL_HOME variable to help construct the correct path.
Than for whatever reason I changed it to export GRAAL_HOME
Apparently the gu tool uses the
GRAAL_HOMEenvironment variable.I googled around and could not find any documentation on that environment variable.
Anyway once I stopped exporting the variable the tool worked as expected.
Feel free to close.