Enonic version: enonic CLI version 1.5.1, linux sdk 7.6.0
OS: NixOS 20.09
Hi,
I’m struggling a bit with getting started and following the guides provided. I have a sneaking suspicion that this is due to NixOS and the way it handles things, but I’m not entirely sure, so I thought I’d post here to see if anyone knows anything about it.
The issue is that when running enonic sandbox start
, I get an error message saying:
Could not start process: /home/thomas/.enonic/distributions/enonic-xp-linux-sdk-7.6.0/bin/server.sh fork/exec /home/thomas/.enonic/distributions/enonic-xp-linux-sdk-7.6.0/bin/server.sh: no such file or directory
Turns out it’s trying to use /bin/bash
, which should work on most Linux distros. However, on NixOS, the path is different. In fact, it’s /nix/store/vnyfysaya7sblgdyvqjkrjbrb0cy11jf-bash-4.4-p23/bin/bash
on my current system, though /run/current-system/sw/bin/bash
should work.
So I rewrote the shebang lines in the scripts in the directory to use the latter. Now it complains that:
./enonic-xp-linux-sdk-7.6.0/bin/server.sh: line 91: /home/thomas/.enonic/distributions/enonic-xp-linux-sdk-7.6.0/jdk/bin/java: No such file or directory
That line is the run command, which looks like this:
exec "$JAVACMD" $JAVA_OPTS -Dxp.install="$XP_INSTALL" -Dfile.encoding=UTF8 -Dnashorn.args="--no-deprecation-warning" $XP_OPTS -Dmapper.allow_dots_in_name=true --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED -classpath "$XP_INSTALL/lib/*" com.enonic.xp.launcher.LauncherMain "${ARGS[@]}"
Now, I’ve checked that the file .../bin/java
is definitely there, but there is this interesting thing where if I try and run it I get an error message:
In the jdk/bin
dir
$ ./java
Failed to execute process './java'. Reason:
The file './java' does not exist or could not be executed.
The file is definitely there and the permissions say it’s executable for all groups, so I don’t really know what’s going on. Again, I suspect this is related to how NixOS handles software and packages, but I’m not 100% certain, so I thought I’d come here for advice first.
Oh, and for the record: I downloaded the binary from https://repo.enonic.com/public/com/enonic/cli/enonic/1.5.1/enonic_1.5.1_Linux_64-bit.tar.gz
and not through my regular package manager (nix
). Nix does not yet support snaps.
Any thoughts and insights are much appreciated. I’m also happy to provide any other information you may need; just ask.
Cheers!