PacketSender icon indicating copy to clipboard operation
PacketSender copied to clipboard

[BUG] Cannot open GUI in Linux

Open VuiMuich opened this issue 4 years ago • 5 comments

What OS?

  • [ ] Windows
  • [ ] Mac
  • [x] Linux (Manjaro with LeftWM tiling WM)
  • [ ] iOS (phone or ipad?)
  • [ ] Android (phone or tablet?)

Description of issue

When I try to launch PacketSender I get the following error-message:

Cannot open display. Try --help to access console app.

I am aware of issue #178 and also tried to run it as root and tried all three of the following: installed via AUR package, cloned the git repo and compiled manually and downloaded the AppImage (btw: why is the AppImage version 7.2.4, where all others are 7.2.3?), with no success. Are there any runtime dependencies I am possibly missing? If so it would be helpful to get an according error-message. I read you comment in the fix for #178 that there is an underlying issue with qt5, do you have any further info on this specific issue?

Also I'd like to suggest even though with the fix for #178 you are exiting gracefully you should return the exit code 1 as it actually still is an exiting with an error, right?

Update: Just looked up on what exit code xrandr is exiting and I get this (note: I use fish as interactive shell):

>>> xrandr
xrandr: output eDP1 cannot use rotation "normal" reflection "none"
>>> echo $status
1

So possibly I have an odd xrandr configuration so it is trying to do something to a second display which currently isn't connected.

VuiMuich avatar Jul 19 '21 16:07 VuiMuich

Try removing the check and see if works anyway for you: https://github.com/dannagle/PacketSender/blob/master/src/main.cpp#L734

Remove these lines.

        if (!isGuiApp()) {
            printf("\nCannot open display. Try --help to access console app.\n");
            return -1;
        }

dannagle avatar Jul 19 '21 17:07 dannagle

Yes, without the check it launches fine.

Maybe the check for xrandr could test only if the exit-code is bigger then 126? Will have a look at this later..

VuiMuich avatar Jul 19 '21 17:07 VuiMuich

Not sure what the complete answer is. At least on my end, I could add an easy way to bypass the check.

dannagle avatar Jul 19 '21 18:07 dannagle

Ooops, later apearently became days later, sorry.

Now I tried this, and it works so far:

diff --git a/src/main.cpp b/src/main.cpp
index 127c1dd..c66a7b8 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -32,7 +32,7 @@ bool isGuiApp()
     int exitcode = process->exitCode();
     QDEBUGVAR(exitcode);
     free(process);
-    if (exitcode > 0) {
+    if (exitcode > 125) {
         // This means xrandr exists, but it couldn't connect.
         return false;
     }

I have to admit though I haven't tested what happens if xrandr isn't installed as I am not sure if it is safe to uninstall it on a running X11 session.

VuiMuich avatar Jul 25 '21 05:07 VuiMuich

I'll need to run some tests on my end, but I think I may ultimately add a bypass method. Leaving this bug open until I have time to do that.

dannagle avatar Jul 28 '21 23:07 dannagle

in Fedora 37, if there is no xrandr installed, exitcode is 255.

eZioPan avatar Feb 01 '23 16:02 eZioPan

Thanks for bumping this to the top. I think a bypass (with instructions in the output) is the best workaround for now. I'll try to get that into the next release.

dannagle avatar Feb 02 '23 20:02 dannagle

This fix is now in the development branch. The option to bypass is --gui

dannagle avatar Feb 15 '23 03:02 dannagle

This fix will be in the next release.

dannagle avatar Mar 05 '23 02:03 dannagle