i2pd icon indicating copy to clipboard operation
i2pd copied to clipboard

Windows build - daemon mode doesn't work and --help doesn't give arg configuration options

Open NovakovicA opened this issue 7 months ago • 8 comments

Hi, I'm very impressed with this project, although I've found a few issues on Windows 10 LTSC with the official release/manually built i2pd binary.
When you run i2pd on Windows with the --daemon flag it simply exits without any output and the logfile is empty even though the loglevel is set to debug.
Not sure what is causing this, although I can try to debug and fix this in a PR.

NovakovicA avatar Jun 02 '25 17:06 NovakovicA

Please look here: https://github.com/PurpleI2P/i2pd/wiki/Setting-up-i2pd-as-Windows-Service#service-installation

And here: https://github.com/PurpleI2P/i2pd/blob/56bd94a1cb700a99c0ca48a5ee2f2a4bf1ddb583/contrib/i2pd.conf#L42

Vort avatar Jun 02 '25 18:06 Vort

Thank you very much, didn't know about this page, will check it out.
On the first look I'm kind of unsure about this design choice where you can run it as a service and not in any way in the background by an argument (even with elevated privileges, although the GUI program by itself doesn't require it), in case I do not require a graphical user interface. I already have most information that I need present within the webconsole.

NovakovicA avatar Jun 02 '25 18:06 NovakovicA

If I remember correctly, there will be no GUI if you run it as described on wiki.

Vort avatar Jun 02 '25 18:06 Vort

Yup, I've tried now and it works and the GUI definitely isn't present if the i2pd executable is configured to run as a Windows service (by definition a Windows service should not have a GUI anyway). I will use it like this for now.

Not sure if we should close this issue, or keep it open and possibly consider the following changes:

  • adding the option mentioned above, for starting i2pd without the GUI and without using it as a Windows service.
  • possibly adding a log entry otherwise if the --daemon flag is used while i2pd is not running as a service, just so the user knows that he is using the program in a wrong way and that there is no other issue present.
  • still not sure how to display all possible argument configuration options (--help or /? which is more common for Windows programs don't seem to work).

NovakovicA avatar Jun 02 '25 19:06 NovakovicA

still not sure how to display all possible argument configuration options (--help or /? which is more common for Windows programs don't seem to work).

You can run i2pd --help > help.txt and then look into help.txt. i2pd for Windows is built as GUI application, so it is not much compatible with console output. Such output probably should go into MessageBox or something similar, but I don't know why it is not done this way. Probably because users find https://i2pd.readthedocs.io/en/latest/user-guide/configuration/ page faster than proper command line option.

Vort avatar Jun 02 '25 19:06 Vort

adding the option mentioned above, for starting i2pd without the GUI and without using it as a Windows service.

I suspect it is possible to build i2pd binary in console mode for Windows by changing compilation flags somehow, but I did not tried to do this.

Vort avatar Jun 02 '25 19:06 Vort

I suspect it is possible to build i2pd binary in console mode for Windows by changing compilation flags somehow, but I did not tried to do this.

Will try this when I have the time.

NovakovicA avatar Jun 02 '25 20:06 NovakovicA

Yup it is indeed possible to compile the binary without the GUI by setting USE_WIN32_APP=no.
As for running the binary (without the GUI) in the background I will need to additionally see what is going on.
For now it seems that the call to I2PService::Run in DaemonWin32.cpp is generating a system error code 1063 (possibly when calling StartServiceCtrlDispatcher in Win32Service.cpp) when the service flag is set and the binary is not started as a service in Windows. Will need to think about this - maybe when the executable is started with the --daemon argument and not with --service the program should hide the console/GUI (+tray) window and run like a regular Windows executable. I can submit an MR if this idea is accepted.

NovakovicA avatar Jun 16 '25 21:06 NovakovicA