I am the maintainer of the OpenNMS scripts (and debian/ubuntu packages).
We return 6 ("not configured") if there are `dpkg-dist` files that have
not been merged before startup, or if the database has not been properly
initialized. This can happen *after* upgrade of a normal working
system, so it's not just that it's a "first install" situation.
Without an error exit, the user may not know that OpenNMS did not
restart properly after upgrade because there are tasks to do to have a
working OpenNMS install.
It seems strange to me that `systemd` would treat ANY error code as not-
an-error without deliberate choice from the packager's POV, but I guess
this is only one of many things that are confusing about systemd. I'll
work on making a proper systemd file for OpenNMS and then hopefully it
won't be an issue.
--
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1828883
Title:
systemd sysv-compatibility eats exit codes
Status in systemd package in Ubuntu:
Invalid
Bug description:
Systemd properly honors an exit code of 6 when creating a native
service, like so:
---8<---
ranger@carolina:/lib/systemd/system$ cat exitcode.service
[Unit]
Description=Test Exit Code (Systemd)
[Service]
Type=oneshot
ExecStart=/bin/bash -c 'exit 6'
[Install]
WantedBy=default.target
ranger@carolina:/lib/systemd/system$ sudo systemctl start exitcode
Job for exitcode.service failed because the control process exited with error
code.
See "systemctl status exitcode.service" and "journalctl -xe" for details.
ranger@carolina:/lib/systemd/system$ echo $?
1
---8<---
However, the equivalent SysV init file improperly returns an exit code
of 0 when starting under the compatibility layer:
---8<---
ranger@carolina:/etc/init.d$ cat exitcode
#! /bin/sh
### BEGIN INIT INFO
# Provides: exitcode
# Required-Start: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Test Exit Code (SysV)
# Description: Test case for Systemd SysV compatibility layer
### END INIT INFO
exit 6
ranger@carolina:/etc/init.d$ sudo systemctl enable exitcode
exitcode.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable exitcode
ranger@carolina:/etc/init.d$ sudo systemctl start exitcode
ranger@carolina:/etc/init.d$ echo $?
0
---8<---
Even if I change the script to do `exit 1` it still returns exit code
0.
These are tiny examples but we are hitting it in the real world with
the startup scripts for the OpenNMS Debian/Ubuntu packages, which
return exit code 6 (LSB "not configured") when there are leftover
upgrade files in `/etc/opennms`. The OpenNMS startup is not properly
failing on attempted startup in this case.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1828883/+subscriptions
--
Mailing list: https://launchpad.net/~touch-packages
Post to : [email protected]
Unsubscribe : https://launchpad.net/~touch-packages
More help : https://help.launchpad.net/ListHelp