Windows build - daemon mode doesn't work and --help doesn't give arg configuration options
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.
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
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.
If I remember correctly, there will be no GUI if you run it as described on wiki.
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
i2pdwithout the GUI and without using it as a Windows service. - possibly adding a log entry otherwise if the --daemon flag is used while
i2pdis 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 (
--helpor/?which is more common for Windows programs don't seem to work).
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.
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.
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.
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.