Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore sysvinit scripts when systemd is used #2469

Merged
merged 4 commits into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a small comment explaining why we need SYSTEMCTL_SKIP_SYSV=true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sure

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