I get this message from systemd status
after I have stopped my service:
Actice: failed (Result: exit-code) <...> Main PID: 4747 (code=exited, status=202/FDS)
Status FDS is defined in the docs like this:
202 EXIT_FDS Failed to close unwanted file descriptors, or to adjust passed file descriptors.
Starting the service works fine, no errors are reported by systemd status
Questions
- What does EXIT_FDS mean in more practical detail?
- Is the status code from my application, or from systemd itself?
- My application opens a TCP socket, which it doesn't close when stopped. Is that the reason?
- If so, can I make systemd ignore the lingering socket and not report it as an error?
Details
The full status message:
tool-user@tool-box:~$ systemctl status tool.service
● tool.service - Tool application
Loaded: loaded (/home/tool-user/tool.service; linked; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2022-02-07 14:14:46 CET; 3s ago
Process: 4758 ExecStop=/bin/bash -c tool-stop && while ps -p $MAINPID >/dev/null
Process: 4601 ExecStart=/bin/bash -c tool-start (code=exited, status=0/SUCCESS)
Main PID: 4747 (code=exited, status=202/FDS)
Feb 07 14:14:31 tool-box systemd[1]: Starting Tool application...
Feb 07 14:14:32 tool-box bash[4601]: Server started on port 44680
Feb 07 14:14:32 tool-box systemd[1]: Started Tool application.
Feb 07 14:14:44 tool-box systemd[1]: Stopping Tool application...
Feb 07 14:14:45 tool-box systemd[1]: tool.service: Main process exited, code=exited, status=202/FDS
Feb 07 14:14:46 tool-box systemd[1]: tool.service: Failed with result 'exit-code'.
Feb 07 14:14:46 tool-box systemd[1]: Stopped Tool application.
The service definition file looks like this:
[Unit]
Description=Tool application
# Standard dependencies for web server
After=network.target remote-fs.target nss-lookup.target httpd-init.service
[Service]
Type=forking
Restart=on-failure
RestartSec=10
ExecStart=/bin/bash -c 'toolStart'
ExecStop=/bin/bash -c 'toolStop && while ps -p $MAINPID >/dev/null 2>&1; do sleep 1; done'
User=tool-user
StandardOutput=syslog
StandardError=syslog
TimeoutStopSec=60
[Install]
WantedBy=multi-user.target
OS: Ubuntu 18.04 Server, run in VirtualBox on Windows 10.
tool-user@tool-box:~$ uname -a
Linux tool-box 4.15.0-166-generic #174-Ubuntu SMP Wed Dec 8 19:07:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
status=202
, is saysstatus=202/FDS
. Where doesFDS
comes from? I has to come from systemd, doesn't it? Why does systemd interpret exit code 202 as FDS? What does FDS mean? Where can I find documentation about that? – Lii Jun 17 '22 at 19:59systemctl
command. See my edit above. – telcoM Jun 17 '22 at 22:45