ventoy / PXE

The open source part of iVentoy.
460 stars 32 forks source link

Iventoy fails to run on alpine linux #79

Open pitsi opened 1 month ago

pitsi commented 1 month ago

I want to run iventoy on a vm running alpine linux x64. I downloaded the latest version from here, extracted it in a folder, and when I first tried to run it, it complained about some missing grep flag because the stock grep on alpine is the one provided by busybox.

# ./iventoy.sh start
grep: unrecognized option: P
BusyBox v1.36.1 (2024-06-10 15:30:53 UTC) multi-call binary.

I installed the regular grep, but iventoy still fails. although the mentioned file is at the right place and is an executable

# ./iventoy.sh start
env: can't execute '/root/dl/iventoy-1.0.20/lib/iventoy': No such file or directory
iventoy start FAILED
# file lib/iventoy
lib/iventoy: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=ab59f1557a16f087393d74ee2f927edee436d2a4, not stripped

Installing bash did not help either

# bash iventoy.sh start
env: can't execute '/root/dl/iventoy-1.0.20/lib/iventoy': No such file or directory
iventoy start FAILED

I assume that all this happens because alpine is built with musl instead of glibc that other distros are built. Am I right?

Relevant threads on r/ventoy and r/linux4noobs with someone having the same issue. https://old.reddit.com/r/Ventoy/duplicates/1e05cqw/cannot_get_iventoy_to_run_on_alpine_linux/ https://old.reddit.com/r/linux4noobs/comments/1e0ywqz/cannot_get_iventoy_to_run_on_alpine_linux/

Justasic commented 2 weeks ago

I investigated this a bit further and the "No such file or directory" error is from the dynamic linker, running ldd on it shows that there's lots of symbols missing due to the libraries in the lin64 directory being compiled against glibc. These libraries are common enough that you can just install them from apk: apk add libevent wimlib hivex but there's still a problem with libhivex.so which the ventoy version has two extra symbols missing: hivex_open_mem and hivex_commit_mem, both of which I cannot find the upstream source to anywhere so I suspect these were patched in by ventoy.

Unfortunately even if you could find those symbols, iventoy itself won't work because it also depends on glibc: image

Only thing to do is wait for a version to be compiled against alpine or musl-libc.