Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
ConfirmedSalt engineer has confirmed bug/feature - often including a MCVEbugbroken, incorrect, or confusing behaviorhelp-wantedCommunity help is needed to resolve thispending-community-assignmentPending community contributor assignmentseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundstale
Milestone
Description
Description of Issue/Question
When a systemd service is created, started, but not enabled, salt does not restart the service on mod_watch:
----------
ID: /etc/zabbix/zabbix_agentd.conf
Function: file.managed
Result: True
Comment: File /etc/zabbix/zabbix_agentd.conf updated
Started: 10:14:52.621831
Duration: 4298.499 ms
Changes:
----------
diff:
---
<snip>
----------
ID: zabbix-agent-service
Function: service.running
Name: zabbix-agent
Result: True
Comment: Service zabbix-agent has been enabled, and is in the desired state
Started: 10:14:56.922787
Duration: 1427.353 ms
Changes:
----------
zabbix-agent:
True
Some packages (zabbix, especifically), don't enable their services when installed, so Salt only enables it, instead of enabling+restarting.
This issue is discussed more thoroughly at this PR:
saltstack-formulas/zabbix-formula#77
Setup
Formula: https://github.com/edusperoni/zabbix-formula
states:
- zabbix-agent.repo
- zabbix-agent.conf
Steps to Reproduce Issue
On a machine that has never installed zabbix-agent, install it using the formula above.
On a machine that has zabbix-agent installed, run systemctl disable zabbix-agent && apt-get purge zabbix-agent -y and then apply the state.
Versions Report
Salt Version:
Salt: 2018.3.0
Dependency Versions:
cffi: 0.8.6
cherrypy: 3.5.0
dateutil: 2.2
docker-py: Not Installed
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.9.4
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.2
mysql-python: 1.2.3
pycparser: 2.10
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 14.4.0
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
System Versions:
dist: debian 8.10
locale: UTF-8
machine: x86_64
release: 3.16.0-4-amd64
system: Linux
version: debian 8.10
Reacted by Insolita and Michael Sverdlik
Metadata
Metadata
Assignees
Labels
ConfirmedSalt engineer has confirmed bug/feature - often including a MCVEbugbroken, incorrect, or confusing behaviorhelp-wantedCommunity help is needed to resolve thispending-community-assignmentPending community contributor assignmentseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundstale
Activity
Ch3LL commentedon Apr 30, 2018
I'm having a hard time replicating this with a small use case as below:
When running the state it restarts the service:
I tried capturing what I found in the states you pointed out and applyling it to this service. Is the use case the same?
edusperoni commentedon Apr 30, 2018
Try running the following commands:
systemctl disable apache2
service apache2 start
I'm not near my computer at this moment, but it should do the trick.
The idea is that systemctl status should report the service as disabled AND running
Ch3LL commentedon May 1, 2018
I just tripled check that i ran those commands before running the state and I am still seeing the service restart. I even just changed it to zabbix-agent and cannot replicate.
Heres a detailed use case:
i'm wondering if my state is just not setup in the same way as your use case
edusperoni commentedon May 1, 2018
Oh, I see now, you're using sysvinit, not systemd. Try it using either Ubuntu 16.04 or Debian 8 (or newer)
Ch3LL commentedon May 2, 2018
my understanding is debian ensures they synchronize the services through both sysvinit and systemd. I even confirmed on the minion that it was running the salt/modules/systemd.py file.
Ch3LL commentedon May 2, 2018
also to note i tested on both debian 8 and ubuntu 16
edusperoni commentedon May 2, 2018
That's weird, it happened to both me and another commenter on the issue I linked, and we were able to replicate it by running:
and then applying the formula. (or applying the formula on a clean system)
Can you try with the formula I linked (my fork is on the correct commit, before the workaround)? Just use zabbix.agent.repo and zabbix.agent.conf and this pillar (just in case):
Although it should work the same on debian 8, you could try it on debian 9, which is the exact version I'm using.
hatifnatt commentedon May 2, 2018
I can confirm, problem exist. I just checked one more time.
Disable and remove agent:
systemctl disable zabbix-agent.service; systemctl stop zabbix-agent.service; apt-get -y purge zabbix-agentInstall it again:
salt 'testvm*' state.sls zabbix.agent.repo,zabbix.agent.confzabbix-agent log file
It's still using 127.0.0.1 as server, restart was not performed.
I will try to replicate this issue with simple test state later. May be there is some race condition.
zerthimon commentedon Jun 15, 2018
Something weird is going on with this state.
From what I observed, when the service is dead and needs to be started AND enabled it's only gets started. The next run enables the service.
Ch3LL commentedon Jun 21, 2018
are any of you seeing this with any other services or only zabbix? Also are you certain this was working on previous salt versions?
zerthimon commentedon Jun 25, 2018
I'm seeing this with docker.service, not sure if it's salt, docker or systemd problem :)
Ch3LL commentedon Jun 28, 2018
and do you know if it was working on previous versions?
bandikoot commentedon Aug 8, 2019
Hello, @Ch3LL!
I'd try to bring this up again. The issue is reproducable and can be simplified to the description below.
Situation 1
Assume, we have an
.slswith:servicestate with awatchrequisite:In this case on applying state we get:
and the service hasn't been restarted (take a look on active since) despite the watch for the config.
Situation 2
When the service is already enabled, but we still have changes in the watched config file, applying the state results in the service's restart correctly:
I believe,
servicestate should trigger systemd-service's enabling and restarting (or starting if it was inactive) in Situation 1. It also seems to me, that the issue is not somehow service-related. We're currently using2018.3.2version.Could you take another look on it, please?
7 remaining items
nicholasmhughes commentedon Sep 22, 2021
Confirmed on:
Versions Report
Given the text in the watch requisite documentation, it seems this is the intended (or at least expected) behavior.
I haven't dug into the code for this too deep yet, but does anyone know if this is something that's "fixable" in
mod_watchfor the service state without fundamentally changing globalwatchbehavior?dwoz commentedon Oct 15, 2026
Thanks for the original report. This issue has been open for more than three years without recent activity and carries a severity label below
severity-high. As part of a backlog cleanup, we're closing older low- and medium-severity issues so triage can focus on reports against currently supported releases.Closing isn't a judgement that the problem wasn't real — only that the codebase has moved through several releases since this was filed, and much of the surrounding code has changed.
If you — or anyone else — can still reproduce this on the 3008.x LTS release, please leave a comment with a reproduction and a maintainer will reopen. The original reporter can also reopen directly.
mitar commentedon Nov 27, 2026
I made a PR to address this: #70974
I think this issue should be reopened until that PR is merged.