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

Cannot install java@18.0.2 on alpine in docker #2560

Open
hejfelix opened this issue Sep 11, 2024 · 4 comments
Open

Cannot install java@18.0.2 on alpine in docker #2560

hejfelix opened this issue Sep 11, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@hejfelix
Copy link

hejfelix commented Sep 11, 2024

Describe the bug
Installing java fails with:

[DEBUG] $ ~/.local/share/mise/installs/java/18.0.2/bin/java -version
Error:
   0: failed to execute command: ~/.local/share/mise/installs/java/18.0.2/bin/java -version
   1: No such file or directory (os error 2)

when running alpine inside a docker container

To Reproduce

> docker run -it alpine:latest
>> apk add mise
fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/community/aarch64/APKINDEX.tar.gz
(1/2) Installing libgcc (13.2.1_git20240309-r0)
(2/2) Installing mise (2024.5.20-r0)
Executing busybox-1.36.1-r29.trigger
OK: 16 MiB in 16 packages
>> mise install -v java@18.0.2
[DEBUG] ARGS: mise install -v java@18.0.2
[DEBUG] Config {
    Config Files: [],
}
[DEBUG] Toolset (4.666µs):
[DEBUG] install_versions: java@18.0.2
[DEBUG] ToolRequestSet.build(6.25µs): ToolRequestSet:

[DEBUG] GET https://rtx-java-metadata.jdx.dev/metadata/ga/linux/aarch64.json
[DEBUG] starting new connection: https://rtx-java-metadata.jdx.dev/
[DEBUG] GET https://rtx-java-metadata.jdx.dev/metadata/ga/linux/aarch64.json 200 OK
downloading openjdk-18.0.2_linux-aarch64_bin.tar.gz
[DEBUG] GET Downloading https://download.java.net/java/GA/jdk18.0.2/f6ad4b4450fd4d298113270ec84f30ee/9/GPL/openjdk-18.0.2_linux-aarch64_bin.tar.gz to ~/.local/share/mise/downloads/java/18.0.2/openjdk-18.0.2_linux-aarch64_bin.tar.gz
[DEBUG] GET https://download.java.net/java/GA/jdk18.0.2/f6ad4b4450fd4d298113270ec84f30ee/9/GPL/openjdk-18.0.2_linux-aarch64_bin.tar.gz
[DEBUG] starting new connection: https://download.java.net/
[DEBUG] GET https://download.java.net/java/GA/jdk18.0.2/f6ad4b4450fd4d298113270ec84f30ee/9/GPL/openjdk-18.0.2_linux-aarch64_bin.tar.gz 200 OK
installing openjdk-18.0.2_linux-aarch64_bin.tar.gz
[DEBUG] tar -xzf /root/.local/share/mise/downloads/java/18.0.2/openjdk-18.0.2_linux-aarch64_bin.tar.gz -C /root/.local/share/mise/downloads/java/18.0.2
java -version
[DEBUG] $ ~/.local/share/mise/installs/java/18.0.2/bin/java -version
Error:
   0: failed to execute command: ~/.local/share/mise/installs/java/18.0.2/bin/java -version
   1: No such file or directory (os error 2)

Location:
   src/cmd.rs:242

Version:
   2024.5.20 linux-arm64 (198227e 2024-05-21)

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Expected behavior
Java should be installed

mise doctor output

version: 2024.5.20 linux-arm64 (198227e 2024-05-21)
activated: no
shims_on_path: no

build_info:
  Target: aarch64-alpine-linux-musl
  Features: DEFAULT, NATIVE_TLS
  Built: Tue, 21 May 2024 16:24:39 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29) (Alpine Linux 1.78.0-r0)
  Profile: release

shell:
  (unknown)

dirs:
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/.cache/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files:


backends:
  cargo
  core
  go
  npm
  pipx
  ubi

plugins:
  bun     (core)
  deno    (core)
  erlang  (core)
  go      (core)
  java    (core)
  node    (core)
  python  (core)
  ruby    (core)

toolset:


env_vars:
  (none)

settings:
  activate_aggressive = false
  all_compile = true
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = false
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = true
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_compile = true
  python_default_packages_file = "/root/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
2 problems found:

1. mise is not activated, run mise help activate or
   read documentation at https://mise.jdx.dev for activation instructions.
   Alternatively, add the shims directory ~/.local/share/mise/shims to PATH.
   Using the shims directory is preferred for non-interactive setups.

2. new mise version 2024.9.1 available, currently on 2024.5.20

Additional context
While doctor complains that the shell is not activated, installing bash and running inside bash after activating yields the same result, so I don't think this is connected. I also tried to install the latest version from edge repo but same issue.

@hejfelix hejfelix added the bug Something isn't working label Sep 11, 2024
@roele
Copy link
Contributor

roele commented Sep 11, 2024

Can reproduce this and i assume this reproduces on other Linux distros as well. It looks as the archive is corrupt and all binaries are kinda invalid (same size). Manually downloading the archive and extracting it also shows the non-executable binaries.

❯ tar xzf openjdk-18.0.2_linux-aarch64_bin.tar.gz
❯ lt 2 jdk-18.0.2
Permissions Size User  Group Date Modified Name
drwxr-xr-x@    - roele staff 11 Sep 19:39   jdk-18.0.2
drwxr-xr-x@    - roele staff 11 Sep 19:39  ├──  bin
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jar
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jarsigner
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  java
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  javac
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  javadoc
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  javap
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jcmd
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jconsole
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jdb
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jdeprscan
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jdeps
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jfr
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jhsdb
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jimage
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jinfo
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jlink
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jmap
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jmod
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jpackage
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jps
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jrunscript
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jshell
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jstack
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jstat
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jstatd
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  jwebserver
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  keytool
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  ├──  rmiregistry
.rwxr-xr-x@  71k roele staff  7 Jun  2022  │  └──  serialver
drwxr-xr-x@    - roele staff 11 Sep 19:39  ├──  conf
.rw-r--r--@ 2.7k roele staff  7 Jun  2022  │  ├──  logging.properties
drwxr-xr-x@    - roele staff 11 Sep 19:39  │  ├──  management
.rw-r--r--@ 6.6k roele staff  7 Jun  2022  │  ├──  net.properties
drwxr-xr-x@    - roele staff 11 Sep 19:39  │  ├──  sdp
drwxr-xr-x@    - roele staff 11 Sep 19:39  │  ├──  security
.rw-r--r--@ 1.2k roele staff  7 Jun  2022  │  └──  sound.properties

@jeremy
Copy link

jeremy commented Sep 11, 2024

Red herrings. OpenJDK is build with glibc whereas Alpine has musl. You can try apk add gcompat and it'll probably still fail, but at least it'll be clear that it wasn't an issue with the executable or tar or whatever.

Your best bet is to use a glibc-based distro instead of Alpine. Or you can use the Alpine OpenJDK port.

@roele
Copy link
Contributor

roele commented Sep 11, 2024

Thanks for the hint @jeremy. It seems that some vendors such as Azul provide musl builds but these are not automatically picked by mise.

@roele
Copy link
Contributor

roele commented Sep 11, 2024

@hejfelix You can use one of the supported vendors. You can get a list of available Java versions for musl via mise ls-remote java | grep musl for example mise install java@zulu-musl-18.32.11 seems to work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants