Hello,
I succeeded in building and starting Mosquitto under Genode, but it fails due to the not-implemented functions geteuid() and getpwnam(). See log below. Are these functions already implemented somewhere? How should I continue from here?
Also, what does the warning about exec_static_constructors() mean?
[init -> mosquitto] lwIP Nic interface up address=10.0.2.55 netmask=255.255.255.0 gateway=10.0.2.1 [init -> mosquitto] Warning: Don't call Genode::Env::exec_static_constructors() in components without static globals [init -> mosquitto] 1543318260: mosquitto version 1.5.4 starting [init -> mosquitto] 1543318260: Using default config. [init -> mosquitto] 1543318260: Opening ipv4 listen socket on port 1883. [init -> mosquitto] Warning: geteuid: geteuid not implemented [init -> mosquitto] Warning: getpwnam: getpwnam not implemented [init -> mosquitto] 1543318260: Error: Invalid user 'mosquitto'. [init] child "mosquitto" exited with exit value 1
Best regards, Wouter
Hello Wouter,
* Wouter van Oijen wouter.van.oijen@technolution.nl:
I succeeded in building and starting Mosquitto under Genode, but it fails due to the not-implemented functions geteuid() and getpwnam(). See log below. Are these functions already implemented somewhere? How should I continue from here?
At least 'getpwnam' got implemented by [1] but you need to configure the libc (please look at the run script included in the commit). Most of the time the user account/identity functions that are used to check various properties in a multi-user system (e.g. to drop priviledges or check for running as root) are of no concern on Genode - after all there is just a single user and the seperation is done at another layer, not the libc. You might have to check what your program expects and how, if necessary, to adapt it.
[1] https://github.com/genodelabs/genode/commit/874ba409ca
The back end implementation of the libc is located in [2].
[2] repos/libports/src/lib/libc
Also, what does the warning about exec_static_constructors() mean?
[…]
Ported software might depend on calling static constructors but we have to make sure to execute the functions at the proper time, i.e., after the component's environment has been completely initialized. For now we do that for every libc based component unconditionally. The dynamic run-time linker, however, will print this diagnostic message in case the binary does not have any static constructors that need to be executed.
Regards,
Hello Wouter,
The geteuid() function is not implemented but getpwnam() will be part of the next release. There is a runscript at 'repos/libports/run/libc_getpwent.run' that shows how to configure the new 'getpwnam' feature. The next release is at the end of this week, or you may build from git master for 'getpwnam'. When 'getuid' is called a warning is printed and '0' is returned, so if you configure the passwd facade to pretend that UID 0 is "mosquitto" that may be enough to get things working. If having UID 0 is a problem, perhaps it is sufficient to override the implementation locally like so:
``` extern "C" uid_t getuid(void) { return 1000; } ```
As for 'exec_static_constructors', this can be safely ignored in your case.
Cheers, E.
On Tuesday, November 27, 2018 12:40:21 PM CET, Wouter van Oijen wrote:
Hello,
I succeeded in building and starting Mosquitto under Genode, but it fails due to the not-implemented functions geteuid() and getpwnam(). See log below. Are these functions already implemented somewhere? How should I continue from here?
Also, what does the warning about exec_static_constructors() mean?
[init -> mosquitto] lwIP Nic interface up address=10.0.2.55 netmask=255.255.255.0 gateway=10.0.2.1 [init -> mosquitto] Warning: Don't call Genode::Env::exec_static_constructors() in components without static globals [init -> mosquitto] 1543318260: mosquitto version 1.5.4 starting [init -> mosquitto] 1543318260: Using default config. [init -> mosquitto] 1543318260: Opening ipv4 listen socket on port 1883. [init -> mosquitto] Warning: geteuid: geteuid not implemented [init -> mosquitto] Warning: getpwnam: getpwnam not implemented [init -> mosquitto] 1543318260: Error: Invalid user 'mosquitto'. [init] child "mosquitto" exited with exit value 1
Best regards, Wouter
Hello Josef (and Emery, who responded similarly in another mail),
At least 'getpwnam' got implemented by [1] but you need to configure the libc (please look at the run script included in the commit). Most of the time the user account/identity functions that are used to check various properties in a multi-user system (e.g. to drop priviledges or check for running as root) are of no concern on Genode - after all there is just a single user and the seperation is done at another layer, not the libc. You might have to check what your program expects and how, if necessary, to adapt it.
You're right. It was indeed used to check for running as root and drop privileges. Since this is not necessary within the Genode context, I think I'll patch the third-party code to remove these checks. This may be the easiest solution and I think it makes sense as well.
Also, what does the warning about exec_static_constructors() mean?
[…]
Ported software might depend on calling static constructors but we have to make sure to execute the functions at the proper time, i.e., after the component's environment has been completely initialized. For now we do that for every libc based component unconditionally. The dynamic run-time linker, however, will print this diagnostic message in case the binary does not have any static constructors that need to be executed.
Ah, thanks for explaining. So I can safely ignore this warning then, which Emery also confirmed :-)
Kind regards, Wouter