Alujjdnd / Ngrok-LAN

A FabricMC mod that exposes your local LAN server to the internet with Ngrok.
MIT License
31 stars 8 forks source link

[BUG] not working on linux #23

Open MSandro opened 2 years ago

MSandro commented 2 years ago

Describe the bug I can not use the mod :(

To Reproduce Steps to reproduce the behavior:

  1. set up the token
  2. Go to 'Open to Lan'
  3. Click on 'Open Public Server'
  4. see the error

Expected behavior it should open the tunnel to Ngrok

Screenshots image

Desktop (please complete the following information):

Additional context because of the no permissions error I've already used the chmod +x command to enable execution for the file. but it did not work.

[07:34:32] [Thread-69/INFO]: Launched Lan!
[07:34:32] [Thread-69/INFO]: [CHAT] Starting Ngrok Service...
[07:34:32] [Thread-69/INFO]: [STDERR]: com.github.alexdlaird.exception.NgrokException: An error occurred while starting ngrok.
[07:34:32] [Thread-69/INFO]: [STDERR]:  at com.github.alexdlaird.ngrok.process.NgrokProcess.start(NgrokProcess.java:167)
[07:34:32] [Thread-69/INFO]: [STDERR]:  at com.github.alexdlaird.ngrok.process.NgrokProcess.start(NgrokProcess.java:93)
[07:34:32] [Thread-69/INFO]: [STDERR]:  at com.github.alexdlaird.ngrok.NgrokClient.connect(NgrokClient.java:169)
[07:34:32] [Thread-69/INFO]: [STDERR]:  at net.minecraft.class_436.mdd0bad4$lambda$ngrokInit$6$0(class_436.java:601)
[07:34:32] [Thread-69/INFO]: [STDERR]:  at java.base/java.lang.Thread.run(Unknown Source)
[07:34:32] [Thread-69/INFO]: [STDERR]: Caused by: java.io.IOException: Cannot run program "/home/sandro/.ngrok2/ngrok": error=13, no permissions
[07:34:32] [Thread-69/INFO]: [STDERR]:  at java.base/java.lang.ProcessBuilder.start(Unknown Source)
[07:34:32] [Thread-69/INFO]: [STDERR]:  at java.base/java.lang.ProcessBuilder.start(Unknown Source)
[07:34:32] [Thread-69/INFO]: [STDERR]:  at com.github.alexdlaird.ngrok.process.NgrokProcess.start(NgrokProcess.java:132)
[07:34:32] [Thread-69/INFO]: [STDERR]:  ... 4 more
[07:34:32] [Thread-69/INFO]: [STDERR]: Caused by: java.io.IOException: error=13, Keine Berechtigung
[07:34:32] [Thread-69/INFO]: [STDERR]:  at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
[07:34:32] [Thread-69/INFO]: [STDERR]:  at java.base/java.lang.ProcessImpl.<init>(Unknown Source)
[07:34:32] [Thread-69/INFO]: [STDERR]:  at java.base/java.lang.ProcessImpl.start(Unknown Source)
[07:34:32] [Thread-69/INFO]: [STDERR]:  ... 7 more
[07:34:32] [Thread-69/INFO]: [CHAT] An error occurred while starting ngrok.
[07:34:32] [Thread-69/INFO]: [CHAT] Ngrok Service Initiation Failed!
[07:34:32] [Thread-69/ERROR]: Uncaught exception in thread "Thread-69"
java.lang.RuntimeException: Ngrok Service Failed to StartAn error occurred while starting ngrok.
    at net.minecraft.class_436.mdd0bad4$lambda$ngrokInit$6$0(class_436.java:654) ~[client-intermediary.jar:?]
    at java.lang.Thread.run(Unknown Source) [?:?]
dajix350 commented 2 years ago

I have experienced this on Fedora 36 and Minecraft 1.19

Flooflez commented 2 years ago

This bug might take a bit for us to figure out since we need to set up a Linux vm or something like that to test it.

I don't really know what could be going wrong here, and it might have something to do with the ngrok wrapper we are using.

In the mean time, apologies for the delay in fixing this.

If anybody can run this mod on Linux, please let me know and drop the specific OS in this thread.

dajix350 commented 2 years ago

Any updates? On Linux I have been able to use ngrok to manually port forward my singleplayer world.

solonovamax commented 2 years ago

It runs on for me, Arch Linux 5.19.1-lqx1-1-lqx x86_64 GNU/Linux, OpenJDK version "18.0.2" (build 18.0.2+9).

try running chmod +x ~/.ngrok2/ngrok and see if that fixes it.

solonovamax commented 2 years ago

I believe the error is that (for some reason), it's not marking the file as executable.

TheKodeToad commented 1 year ago

Ah, should be possible to do with Java NIO.

SimplyTadpole commented 1 year ago

I'm having the same issue on Linux (Fedora 38, Ngrok LAN version 1.4.4, Minecraft version 1.19.2). Exact same error log posted in the OP.

solonovamax commented 1 year ago

@SimplyTadpole try doing chmod +x ~/.ngrok2/ngrok, and see if that fixes it

SimplyTadpole commented 1 year ago

@solonovamax That directory doesn't seem to exist for me?

Flooflez commented 1 year ago

@SimplyTadpole This is interesting, looks like maybe the wrapper isn't installing ngrok correctly. I probably should update the wrapper to a later/the latest version, maybe this bug is fixed in one of the newer releases.

We are currently using version 1.5.6, but it looks like 1.7.1 has a specific changelog for fixing default installation issues.

I'm a little bit hesitant right now to fully move to the latest 2.1.0 release as it uses a different ngrok version. I will have some more time in the coming week or so, so I might look into at least porting to 1.7.1.

Will keep you all updated, and also sorry again everyone for the inactivity.

Flooflez commented 1 year ago

Hi all, I'm releasing a beta version of this mod for 1.20.1 that uses an updated wrapper version. You can find it under Releases on this github project.

Could someone who is experiencing this bug try this version of the mod to see if there is any difference?

Thanks :)

solonovamax commented 1 year ago

I no longer have issues with the bug, as chmod'ing the file fixed it for me, however I will try doing chmod -x to it, to see if I can reproduce it, and then attempt running with the latest version

notandvm commented 1 year ago

Could someone who is experiencing this bug try this version of the mod to see if there is any difference?

newcomer to the mod and was experiencing the issue beta build doesn't seem to make a difference, still getting initiation failed

chmod +x ~/.ngrok2/ngrok hasn't fixed it for me either

͏͏͏ logs spit this out whenever attempting to open a server

[20:57:26] [Thread-28/INFO]: [CHAT] Starting Ngrok Service...
[20:57:27] [Server thread/INFO]: Saving chunks for level 'ServerLevel[creeper testing]'/minecraft:the_nether
[20:57:27] [Server thread/INFO]: Saving chunks for level 'ServerLevel[creeper testing]'/minecraft:the_end
[20:57:27] [Thread-28/INFO]: [STDERR]: com.github.alexdlaird.exception.NgrokException: The ngrok process was unable to start.
[20:57:27] [Thread-28/INFO]: [STDERR]:     at com.github.alexdlaird.ngrok.process.NgrokProcess.start(NgrokProcess.java:160)
[20:57:27] [Thread-28/INFO]: [STDERR]:     at com.github.alexdlaird.ngrok.NgrokClient.connect(NgrokClient.java:182)
[20:57:27] [Thread-28/INFO]: [STDERR]:     at net.minecraft.class_436.md72bd1c$ngroklan$lambda$ngrokInit$5$0(class_436.java:600)
[20:57:27] [Thread-28/INFO]: [STDERR]:     at java.base/java.lang.Thread.run(Thread.java:833)
[20:57:27] [Thread-28/INFO]: [CHAT] The ngrok process was unable to start.
[20:57:27] [Thread-28/INFO]: [CHAT] Ngrok Service Initiation Failed!
[20:57:27] [Thread-28/ERROR]: Uncaught exception in thread "Thread-28"
java.lang.RuntimeException: Ngrok Service Failed to StartThe ngrok process was unable to start.
  at net.minecraft.class_436.md72bd1c$ngroklan$lambda$ngrokInit$5$0(class_436.java:652) ~[client-intermediary.jar:?]
  at java.lang.Thread.run(Thread.java:833) ~[?:?]
Flooflez commented 1 year ago

Hi @notandvm, does the ngrok directory exist on your machine? It should be created when trying to open a server.

Also, could you let me know what Linux distro and version you are using?

Flooflez commented 1 year ago

Does anyone know an easy way to set up a Linux environment for me to test this myself…?

notandvm commented 1 year ago

Hi @notandvm, does the ngrok directory exist on your machine? It should be created when trying to open a server.

Also, could you let me know what Linux distro and version you are using?

it's being created properly yeah, path is ~/.ngrok2/ as intended inside is the executable, ngrok.yml, and ngrok.zip

distro & version is steamos 3.4.8

Quiel245 commented 1 year ago

running into this issue too, i'm on endeavourOS, minecraft 1.20.1 using Prism launcher flatpak version, ~/.ngrok2/ was not created here, maybe it's related to the fact it's running on flatpak, installing the appimage version to see what happens

Quiel245 commented 1 year ago

running into this issue too, i'm on endeavourOS, minecraft 1.20.1 using Prism launcher flatpak version, ~/.ngrok2/ was not created here, maybe it's related to the fact it's running on flatpak, installing the appimage version to see what happens

Seems to have worked just fine now, so i guess this is not compatible with flatpak installs of minecraft, probably because of the lack of permissions to write into home of something like that