Univention Bugzilla – Bug 53886
/usr/sbin/univention-management-console-web-server --no-daemon fails with systemd
Last modified: 2023-06-09 17:04:21 CEST
In MultiProcess mode there are several univention-management-console-web-server@1820?.service units. By default they invoke > ExecStart=/usr/sbin/univention-management-console-web-server start --port=%i which redirects STDOUD/STDERR/debug-output to /var/log/univention/management-console-web-server.log In multi-process mode this is hard to read as multiple daemons append(or overwrite each other?) to that file. systemd introduces journald, which is there to collect STDOUT and STDERR of daemones, which gives each daemon a separate data sink. UMC-web-server already has an option "--no-daemon", which can be used to prevent it from forking and re-directing the log output. But this option does not work with systemd as systemd closes STDIN/-OUT/-ERR, so /dev/std{in,out,err} do not exists and /proc/self/fd/{0,1,2} are closed respectively replaces by the 3 newly opened files/sockets. This leads to the following traceback: Okt 08 15:59:40 m34 ls[3243]: /bin/ls: Zugriff auf '/dev/std*' nicht möglich: Datei oder Verzeichnis nicht gefunden Okt 08 15:59:40 m34 ls[3243]: /proc/self/fd/: Okt 08 15:59:40 m34 ls[3243]: insgesamt 0 Okt 08 15:59:40 m34 ls[3243]: lr-x------ 1 root root 64 Okt 8 15:59 0 -> /dev/null Okt 08 15:59:40 m34 ls[3243]: lrwx------ 1 root root 64 Okt 8 15:59 1 -> socket:[30332] Okt 08 15:59:40 m34 ls[3243]: lrwx------ 1 root root 64 Okt 8 15:59 2 -> socket:[30332] Be aware that STDOUT and STDERR are *UNIX sockets* instead of files an opening them with open() will fail: Okt 08 15:59:40 m34 ls[3243]: lr-x------ 1 root root 64 Okt 8 15:59 3 -> /proc/3243/fd Okt 08 15:59:40 m34 systemd[1]: Started LSB: Univention Management Console Web Server. Okt 08 15:59:41 m34 univention-management-console-web-server[3245]: Could not open logfile "/dev/stderr" Okt 08 15:59:41 m34 univention-management-console-web-server[3245]: Traceback (most recent call last): Okt 08 15:59:41 m34 univention-management-console-web-server[3245]: File "/usr/sbin/univention-management-console-web-server", line Okt 08 15:59:41 m34 univention-management-console-web-server[3245]: http_daemon = UMC_HTTP_Daemon() Okt 08 15:59:41 m34 univention-management-console-web-server[3245]: File "/usr/sbin/univention-management-console-web-server", line Okt 08 15:59:41 m34 univention-management-console-web-server[3245]: DaemonRunner.__init__(self, self) Okt 08 15:59:41 m34 univention-management-console-web-server[3245]: File "/usr/lib/python2.7/dist-packages/daemon/runner.py", line Okt 08 15:59:41 m34 univention-management-console-web-server[3245]: self.daemon_context.stdout = open(app.stdout_path, 'w+t') Okt 08 15:59:41 m34 univention-management-console-web-server[3245]: IOError: [Errno 6] No such device or address: '/dev/stdout' # cat /etc/systemd/system/univention-management-console-web-server.service.d/override.conf [Service] Type=simple ExecStartPre=-/bin/ls -l /dev/std* /proc/self/fd/ ExecStart= ExecStart=/usr/sbin/univention-management-console-web-server -n # ucr search --brief ^umc/server/ umc/server/autostart: yes umc/server/debug/level: 4 umc/server/disable-security-restrictions: <empty> umc/server/dispatch-interval: <empty> umc/server/processes: 3 umc/server/ssl/ciphers: <empty> umc/server/upload/max: 2048 umc/server/upload/min_free_space: 51200 With --no-daemon "python-daemonize" should be skipped completely and UMC-web-server should not fiddle with STDIN/-OUT/-ERR at all. Be aware that univention.debug.init("/dev/stderr",…) is used as well, which also fails in that case. For UCS 4.4: Fix --no-daemon For UCS 5.0: Convert to systemd PS: For UCS-5.0-0 there was the plan to also use systemd in non-multiprocess-mode, but this is still pending accoridng to @fbest
(In reply to Philipp Hahn from comment #0) > In MultiProcess mode there are several > univention-management-console-web-server@1820?.service units. By default > they invoke > > ExecStart=/usr/sbin/univention-management-console-web-server start --port=%i > > which redirects STDOUD/STDERR/debug-output to > /var/log/univention/management-console-web-server.log > In multi-process mode this is hard to read as multiple daemons append(or > overwrite each other?) to that file. yes, that's why in multiprocessing mode each log line is prefixed with the pid.
We have to re-evaluate this after Bug #43633. UMC meanwhile is a systemd service, which is started in foreground but still logs to a specific logfile. Interesting would also be if we can redirect the logs of the module sub-proceses into a specific journald-stream, so that we can filter stream only for certain modules.