Skip to content

Commit

Permalink
Ignore sysvinit scripts when systemd is used (DataDog#2469)
Browse files Browse the repository at this point in the history
* Ignore sysvinit scripts when systemd is used

* Explain why we use SYSTEMCTL_SKIP_SYSV

* Add a note about the warning in the release notes

* Update docs about sysvinit support on debian
  • Loading branch information
remicalixte authored Oct 17, 2018
1 parent 262d016 commit 5afdcdc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Agent 6 is currently available on these platforms:

| System | Supported version |
|--------|-------------------|
| Debian x86_64 | version 7 (wheezy) and above (we do not support SysVinit)|
| Debian x86_64 | version 7 (wheezy) and above (SysVinit support in agent >=6.6.0)|
| Ubuntu x86_64 | version 12.04 and above |
| RedHat/CentOS x86_64 | version 6 and above |
| SUSE Enterprise Linux x86_64 | version 11 SP4 and above (we do not support SysVinit)|
Expand Down
24 changes: 12 additions & 12 deletions docs/agent/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,18 @@ If the `service` wrapper command is not available on your system, use:

If you're unsure which init system your distribution uses by default, please refer to the table below:

| distribution \ init system | `upstart` | `systemd` | Notes |
| -------------------------- |:---------:|:---------:| ----- |
| Amazon Linux (<= 2017.09) || | |
| Amazon Linux 2 (>= 2017.12) | || |
| CentOS/RHEL 6 || | |
| CentOS/RHEL 7 | || |
| Debian 7 (wheezy) | | | _currently unsupported unless you install systemd_ |
| Debian 8 (jessie) & 9 (stretch) | || |
| SUSE 11 | | | _currently unsupported unless you install systemd_ |
| SUSE 12 | || |
| Ubuntu < 15.04 || | |
| Ubuntu >= 15.04 | || |
| distribution \ init system | `upstart` | `systemd` | `sysvinit` | Notes |
| -------------------------- |:---------:|:---------:|:----------:|----- |
| Amazon Linux (<= 2017.09) || | | |
| Amazon Linux 2 (>= 2017.12) | || | |
| CentOS/RHEL 6 || | | |
| CentOS/RHEL 7 | || | |
| Debian 7 (wheezy) | | | ✅ (agent >= 6.6.0) | |
| Debian 8 (jessie) & 9 (stretch) | || | |
| SUSE 11 | | | | _currently unsupported unless you install systemd_ |
| SUSE 12 | || | |
| Ubuntu < 15.04 || | | |
| Ubuntu >= 15.04 | || | |

#### Agent commands

Expand Down
7 changes: 4 additions & 3 deletions omnibus/package-scripts/agent/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ if [ "$DISTRIBUTION" != "Darwin" ]; then
# Only supports systemd and upstart
echo "Enabling service $SERVICE_NAME"
if command -v systemctl >/dev/null 2>&1; then
systemctl enable $SERVICE_NAME || echo "[ WARNING ]\tCannot enable $SERVICE_NAME with systemctl"
systemctl enable $SERVICE_NAME-process || echo "[ WARNING ]\tCannot enable $SERVICE_NAME-process with systemctl"
systemctl enable $SERVICE_NAME-trace || echo "[ WARNING ]\tCannot enable $SERVICE_NAME-trace with systemctl"
# Force systemd to ignore the sysvinit scripts. Only cosmetic, remove some irrelevant warnings during upgrade
SYSTEMCTL_SKIP_SYSV=true systemctl enable $SERVICE_NAME || echo "[ WARNING ]\tCannot enable $SERVICE_NAME with systemctl"
SYSTEMCTL_SKIP_SYSV=true systemctl enable $SERVICE_NAME-process || echo "[ WARNING ]\tCannot enable $SERVICE_NAME-process with systemctl"
SYSTEMCTL_SKIP_SYSV=true systemctl enable $SERVICE_NAME-trace || echo "[ WARNING ]\tCannot enable $SERVICE_NAME-trace with systemctl"
elif command -v initctl >/dev/null 2>&1; then
# Nothing to do, this is defined directly in the upstart job file
:
Expand Down
7 changes: 4 additions & 3 deletions omnibus/package-scripts/agent/prerm
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ deregister_agent()
# Disable agent start on system boot
# Only supports systemd and upstart
if command -v systemctl >/dev/null 2>&1; then
systemctl disable $SERVICE_NAME-process || true
systemctl disable $SERVICE_NAME-trace || true
systemctl disable $SERVICE_NAME || true
# Force systemd to ignore the sysvinit scripts. Only cosmetic, remove some irrelevant warnings during upgrade
SYSTEMCTL_SKIP_SYSV=true systemctl disable $SERVICE_NAME-process || true
SYSTEMCTL_SKIP_SYSV=true systemctl disable $SERVICE_NAME-trace || true
SYSTEMCTL_SKIP_SYSV=true systemctl disable $SERVICE_NAME || true
elif command -v initctl >/dev/null 2>&1; then
# Nothing to do, this is defined directly in the upstart job file
:
Expand Down
1 change: 1 addition & 0 deletions releasenotes/notes/debian-sysvinit-424c71c2b7e14a12.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
features:
- |
Support SysVinit on Debian
note: some warnings can appear if you enable/disable the agent manually on a systemd system. They can be safely ignored

0 comments on commit 5afdcdc

Please sign in to comment.