Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is not possible to install java or groovy in a instance of Windows Subsystem for Linux #622

Open
1 of 2 tasks
ilmoralito opened this issue Jan 17, 2018 · 8 comments
Open
1 of 2 tasks

Comments

@ilmoralito
Copy link

We require a conversation to take place in the appropriate Gitter Room before raising a new Github Issue. Please note that issues will be closed immediately if prior discussion did not take place. We need to do this to help manage the quality and validity of Issues raised on this project.

Please tick one:

Please explain the Issue / Feature Request here:

Hi everyone, I am trying to install java and groovy candidates in an instance of ubuntu bash shell in windows 10.

When I try

sdk install javajava 9.0.1-zulu

I get the following message

root@lab208:~# sdk install java 9.0.1-zulu

Downloading: java 9.0.1-zulu

In progress...

######################################################################## 100.0%
Download has failed, aborting!

Can not install java 9.0.1-zulu at this time...

I get a similar scenario when trying to install groovy, but with the following message

root@lab208:~# sdk install groovy 2.4.10

Downloading: groovy 2.4.10

In progress...

######################################################################## 100.0%
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /root/.sdkman/archives/groovy-2.4.10.zip or
        /root/.sdkman/archives/groovy-2.4.10.zip.zip, and cannot find /root/.sdkman/archives/groovy-2.4.10.zip.ZIP, period.

Stop! The archive was corrupt and has been removed! Please try installing again.

On the other hand grails and gradle are installed correctly.

Any idea how to fix this problem? Thanks in advance

@marc0der
Copy link
Member

How long does the download take? Does it seem like it's actually downloading something?

Also, it might be worth turning on debugging and posting the result here. You can do so by changing the sdkman_debug_mode flag to true in the ~./sdkman/etc/config.

@ilmoralito
Copy link
Author

It does not take much time, just print the text
######################################################################## 100.0%
And then the message

This is the debug result when trying to install java

root@lab213:~# sdk install java
==== BROADCAST =================================================================
* 17/01/18: Kotlin 1.2.20 released on SDKMAN! #kotlin
* 09/01/18: Gradle 4.5-rc-1 released on SDKMAN! #gradle
* 06/01/18: sbt 1.1.0 released on SDKMAN! #scala
================================================================================
Validate java 8u152-zulu for Linux64: valid
Validation URL: https://api.sdkman.io/2/candidates/validate/java/8u152-zulu/linux64
Get pre-installation hook: https://api.sdkman.io/2/hooks/pre/java/8u152-zulu/linux64
Copy remote pre-installation hook: /root/.sdkman/tmp/hook_pre_java_8u152-zulu.sh
No Linux pre-install hook found for Java 8u152-zulu.
Completed pre-installation hook...

Downloading: java 8u152-zulu

In progress...

######################################################################## 100.0%
Downloaded binary to: /root/.sdkman/tmp/miCAOn6UhLRUMlJ7fLihwM7fC0lwn88y.bin
Get post-installation hook: https://api.sdkman.io/2/hooks/post/java/8u152-zulu/linux64
Copy remote pre-installation hook: /root/.sdkman/tmp/hook_pre_java_8u152-zulu.sh
A Linux post-install hook was found for Java 8u152-zulu.
Download has failed, aborting!

Can not install java 8u152-zulu at this time...

This is the debug result when trying install groovy

root@lab213:~# sdk install groovy
SDKMAN: No update needed. Using existing candidates cache: ant,asciidoctorj,ceylon,crash,gaiden,glide,gradle,grails,griffon,groovy,groovyserv,java,jbake,kobalt,kotlin,kscript,lazybones,leiningen,maven,sbt,scala,spark,springboot,sshoogr,vertx,visualvm
Not refreshing version cache now...
Validate groovy 2.4.13 for Linux64: valid
Validation URL: https://api.sdkman.io/2/candidates/validate/groovy/2.4.13/linux64
Get pre-installation hook: https://api.sdkman.io/2/hooks/pre/groovy/2.4.13/linux64
Copy remote pre-installation hook: /root/.sdkman/tmp/hook_pre_groovy_2.4.13.sh
No Linux pre-install hook found for Groovy 2.4.13.
Completed pre-installation hook...

Downloading: groovy 2.4.13

In progress...

######################################################################## 100.0%
Downloaded binary to: /root/.sdkman/tmp/RcR68iQXgNm5reTBuGsbz0vx3o8XPMq8.bin
Get post-installation hook: https://api.sdkman.io/2/hooks/post/groovy/2.4.13/linux64
Copy remote pre-installation hook: /root/.sdkman/tmp/hook_pre_groovy_2.4.13.sh
No Linux post-install hook found for Groovy 2.4.13.
Moving /root/.sdkman/tmp/RcR68iQXgNm5reTBuGsbz0vx3o8XPMq8.bin to /root/.sdkman/tmp/RcR68iQXgNm5reTBuGsbz0vx3o8XPMq8.zip
Processed binary as: /root/.sdkman/tmp/RcR68iQXgNm5reTBuGsbz0vx3o8XPMq8.zip
Completed post-installation hook...
Moved to archive folder: /root/.sdkman/archives/groovy-2.4.13.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /root/.sdkman/archives/groovy-2.4.13.zip or
        /root/.sdkman/archives/groovy-2.4.13.zip.zip, and cannot find /root/.sdkman/archives/groovy-2.4.13.zip.ZIP, period.

Stop! The archive was corrupt and has been removed! Please try installing again.

Thanks for answering

@neversleepz
Copy link

neversleepz commented Aug 12, 2018

Tested this with my WSL Ubuntu install but wasn't able to reproduce. Could install Groovy and Kotlin (from a sudo bash shell) successfully
Noticed from your logs, that the download directory is going to /root and not /home/<username>
Wondering if there are any permission issues? I also tried running sudo bash in the Ubuntu shell prior to running sdkman (its still using my homedir though according to the logs)
How did you get to be the root user?

Here's a copy of my install log to compare

@svenHues
Copy link

svenHues commented Aug 22, 2018

tl;dr For me installing tar helped. It is used in the post-installation-hook when I run sdk install java, but sdkman hasn't reported it as a missing dependency.


I'm running sdkman from inside a container (opensuse/tumbleweed). Already during the installation sdkman reports missing dependencies: which unzip zip. I install them.
I try to sdk install java, but sdkman aborts at the very end. I try different versions of java, yet, it always aborts at the very end (after the download bar has reached 100%):

Download has failed, aborting!
Can not install java 8.0.181-zulu at this time...

sdk install gradle works, though.

I change

the sdkman_debug_mode flag to true in the ~./sdkman/etc/config

, as @marc0der suggested, to get some clues to what is happening under the hood. I run sdk install java again.
sdkmans's output looks like what @ilmoralito has posted when he ran sdk install java.
Ending with the same:

######################################################################## 100.0%
Downloaded binary to: [...]
Get post-installation hook: [...]
Copy remote pre-installation hook: [...]
A Linux post-install hook was found for Java [8.0.181-zulu].
Download has failed, aborting!

Can not install java [8.0.181-zulu] at this time...

So it fails after it's found that post-install hook.

I run sdk install java again, but this time I turn some shell options for debugging on for the bash-shell I'm running sdk install java in: set -ETx (Maybe set -x would do just fine. I don't know.).

I also open up the post-installation hook that sdkman has mentionned before: ~/.sdkman/tmp/hook_post_java_8.0.181-zulu.sh

I scroll upwards in what sdkman outputs and find:

+ __sdkman_validate_binary_input [~]/.sdkman/tmp/ykOtgndRnbqfzLy6WIwv3HMUv4uMwbAa.bin
+ tar tzf [~]/.sdkman/tmp/ykOtgndRnbqfzLy6WIwv3HMUv4uMwbAa.bin
+ echo 'Download has failed, aborting!'
Download has failed, aborting!
+ echo ''

+ echo 'Can not install java 8.0.181-zulu at this time...'

I look at the __sdkman_validate_binary_input in the post-installation hook:

function __sdkman_validate_binary_input {
    if ! tar tzf "$1" &> /dev/null; then
        echo "Download has failed, aborting!"
        echo ""
        echo "Can not install java 8.0.181-zulu at this time..."
        return 1
    fi
}

Then it occures to me: Maybe I don't have tar installed? 😅

@abelsromero
Copy link

I am running on WSL Arch and I also unable to install java.
It downloads and install, and everything seems fine, but it is not added to the PATH javac: command not found.
Also sdk ls java returns this:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Bad Request</title>
        <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAlFJREFUeNqUU8tOFEEUPVVdNV3dPe8xYRBnjGhmBgKjKzCIiQvBoIaNbly5Z+PSv3Aj7DSiP2B0rwkLGVdGgxITSCRIJGSMEQWZR3eVt5sEFBgTb/dN1yvnnHtPNTPG4PqdHgCMXnPRSZrpSuH8vUJu4DE4rYHDGAZDX62BZttHqTiIayM3gGiXQsgYLEvATaqxU+dy1U13YXapXptpNHY8iwn8KyIAzm1KBdtRZWErpI5lEWTXp5Z/vHpZ3/wyKKwYGGOdAYwR0EZwoezTYApBEIObyELl/aE1/83cp40Pt5mxqCKrE4Ck+mVWKKcI5tA8BLEhRBKJLjez6a7MLq7XZtp+yyOawwCBtkiBVZDKzRk4NN7NQBMYPHiZDFhXY+p9ff7F961vVcnl4R5I2ykJ5XFN7Ab7Gc61VoipNBKF+PDyztu5lfrSLT/wIwCxq0CAGtXHZTzqR2jtwQiXONma6hHpj9sLT7YaPxfTXuZdBGA02Wi7FS48YiTfj+i2NhqtdhP5RC8mh2/Op7y0v6eAcWVLFT8D7kWX5S9mepp+C450MV6aWL1cGnvkxbwHtLW2B9AOkLeUd9KEDuh9fl/7CEj7YH5g+3r/lWfF9In7tPz6T4IIwBJOr1SJyIGQMZQbsh5P9uBq5VJtqHh2mo49pdw5WFoEwKWqWHacaWOjQXWGcifKo6vj5RGS6zykI587XeUIQDqJSmAp+lE4qt19W5P9o8+Lma5DcjsC8JiT607lMVkdqQ0Vyh3lHhmh52tfNy78ajXv0rgYzv8nfwswANuk+7sD/Q0aAAAAAElFTkSuQmCC">
        <style>
            html, body, pre {
                margin: 0;
                padding: 0;
                font-family: Monaco, 'Lucida Console', monospace;
                background: #ECECEC;
            }
            h1 {
                margin: 0;
                background: #AD632A;
                padding: 20px 45px;
                color: #fff;
                text-shadow: 1px 1px 1px rgba(0,0,0,.3);
                border-bottom: 1px solid #9F5805;
                font-size: 28px;
            }
            p#detail {
                margin: 0;
                padding: 15px 45px;
                background: #F6A960;
                border-top: 4px solid #D29052;
                color: #733512;
                text-shadow: 1px 1px 1px rgba(255,255,255,.3);
                font-size: 14px;
                border-bottom: 1px solid #BA7F5B;
            }
        </style>
    </head>
    <body>
        <h1>Bad Request</h1>

        <p id="detail">
            For request 'GET /bad-request' [invalid version format: FILES/DOCKER/DOCKER/RESOURCES/BIN:/MNT/C/PROGRAM FILES (X86)/INTEL/INTEL(R) MANAGEMENT ENGINE COMPONENTS/ICLS:/MNT/C/PROGRAM FILES/INTEL/INTEL(R) MANAGEMENT ENGINE COMPONENTS/ICLS:/MNT/C/WINDOWS/SYSTEM32:/MNT/C/WINDOWS:/MNT/C/WINDOWS/SYSTEM32/WBEM:/MNT/C/WINDOWS/SYSTEM32/WINDOWSPOWERSHELL/V1.0:/MNT/C/PROGRAMDATA/CHOCOLATEY/BIN:/MNT/C/PROGRAM FILES/GIT/CMD:/MNT/C/PROGRAM FILES/MICROSOFT VS CODE/BIN:/MNT/C/PROGRAM FILES (X86)/INTEL/INTEL(R) MANAGEMENT ENGINE COMPONENTS/DAL:/MNT/C/PROGRAM FILES/INTEL/INTEL(R) MANAGEMENT ENGINE COMPONENTS/DAL:/MNT/C/PROGRAM FILES (X86)/INTEL/INTEL(R) MANAGEMENT ENGINE COMPONENTS/IPT:/MNT/C/PROGRAM FILES/INTEL/INTEL(R) MANAGEMENT ENGINE COMPONENTS/IPT:/MNT/C/PROGRAM FILES/JAVA/JDK1.8.0_181/BIN:/MNT/C/PROGRAM FILES/JAVA/JDK1.8.0_191/BIN:/MNT/C/USERS/XXX/.CARGO/BIN:/MNT/C/USERS/XXX/APPDATA/LOCAL/MICROSOFT/WINDOWSAPPS:/MNT/C/PROGRAM FILES/MICROSOFT VS CODE/BIN:/MNT/C/HOME/PATH:/MNT/C/HOME/BIN/MSYS64/MINGW64/BIN:/MNT/C/PROGRAM FILES/DOCKER TOOLBOX:/MNT/C/TOOLS/KUBERNETES-CLI/BIN:/USR/LIB/JVM/DEFAULT/BIN:/USR/BIN/SITE_PERL:/USR/BIN/VENDOR_PERL:/USR/BIN/CORE_PERL:/HOME/XXX/.RVM/BIN&amp;INSTALLED= HTTP/1.0]
        </p>

    </body>
</html>

@abelsromero
Copy link

After several remove/uninstall java 11 installed, but for java8 it was impossible. It failed when moving from temp/out to candidate stating that the target path was not a directory. I just resorted to move files manually and now it works.

@jvr-ks
Copy link

jvr-ks commented Jan 31, 2021

Installed both sdkman and java 21.0.0.r11-grl as root.
Is ok, but only root has access?
Not what was expected!

@matthunt1984
Copy link

I had a similar issue to this on WSL1 after upgrading Ubuntu from 18.04 (as SDKMAN needed GLIBC newer than 2.7).
Similar to above my issue was related to gzip rather than tar. Resolved with:

Actually those were all 0x1000 already. In gzip 1.10-4ubuntu4 I only had to change the value at offset 0x189 using
echo -en '\x10' | sudo dd of=/usr/bin/gzip count=1 bs=1 conv=notrunc seek=$((0x189))

Originally posted by @dreamlayers in microsoft/WSL#8219 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants