Jira (PUP-9473) Systemd daemon-reload doesn't get triggered for removal of unit file

6 views
Skip to first unread message

Duncan X Simpson (JIRA)

unread,
Feb 4, 2019, 12:34:03 PM2/4/19
to puppe...@googlegroups.com
Duncan X Simpson created an issue
 
Puppet / Bug PUP-9473
Systemd daemon-reload doesn't get triggered for removal of unit file
Issue Type: Bug Bug
Affects Versions: PUP 6.1.0
Assignee: Unassigned
Components: Types and Providers
Created: 2019/02/04 9:33 AM
Priority: Minor Minor
Reporter: Duncan X Simpson

Puppet Version: 6.1.0
Puppet Server Version: 6.1.0
OS Name/Version: CentOS 7

Related to PUP-3483, if I tell puppet to ensure a unit file (i.e. /etc/systemd/system/foobar.service) is absent, and that unit file overrides another unit file (i.e. /usr/share/systemd/system/foobar.service), Puppet removes the override file but doesn't trigger a daemon reload, causing systemd to still use the old, removed unit file's config.

Desired Behavior: Removing a file in any of the paths listed here should trigger a daemon-reload, just like modifying them

Actual Behavior: No daemon-reload is triggered

 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Josh Cooper (JIRA)

unread,
Feb 4, 2019, 4:35:04 PM2/4/19
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Feb 13, 2019, 2:34:04 PM2/13/19
to puppe...@googlegroups.com

Ewoud Kohl van Wijngaarden (Jira)

unread,
Feb 18, 2021, 11:31:02 AM2/18/21
to puppe...@googlegroups.com
Ewoud Kohl van Wijngaarden commented on Bug PUP-9473
 
Re: Systemd daemon-reload doesn't get triggered for removal of unit file

This showed up in https://github.com/puppetlabs/puppetlabs-postgresql/pull/1233 as well. From that PR, the root cause is that querying for the property failed:

# systemctl show --property=NeedDaemonReload -- postgresql
Failed to get properties: Access denied

Perhaps the safest bet is to treat an access denied as needs reload.

This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Andreas Papst (Jira)

unread,
Jan 21, 2022, 9:40:01 AM1/21/22
to puppe...@googlegroups.com
Andreas Papst commented on Bug PUP-9473

Hello,

To find changed unit-files use:

$ systemctl --all status *.service 2>&1 | grep --color 'changed on disk. Run'
Warning: The unit file, source configuration file or drop-ins of example.service changed on disk. Run 'systemctl daemon-reload' to reload units.

For a distinct service, it would be

$ systemctl --all status example.service 2>&1 | grep --color 'changed on disk. Run' && echo changed

 

 

BTW: `systemctl daemon-reload´ mends all deltas. Therefore I suggest, you use a trigger to a global
Exec['/bin/systemctl daemon-reload'] for all changes and a
`ensure => Exec['/bin/systemctl daemon-reload']´ within the Service statement.

The statement

{{exec['/bin/systemctl daemon-reload']

{refreshonly => true,}

}}

should be part of modules/systemd/manifest/init.pp.

 

Example:

file { '/usr/lib/systemd/system/foo.service':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
source => "puppet:///modules/${module_name}/foo.service",
notify => Exec['/bin/systemctl daemon-reload'],
}
~> service

Unknown macro: {'foo'}

Just have a look at https://github.com/justin8/justin8-systemd

Regards
Andreas

This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Tim Meusel (Jira)

unread,
Feb 15, 2022, 3:10:03 AM2/15/22
to puppe...@googlegroups.com
Tim Meusel commented on Bug PUP-9473

Hey puppet. This is currently marked as 'needs information'. Is that state correct? Is there anything missing from Ewouds description?

andrea...@univie.ac.at I don't think your suggestion is the correct way forward. This is a valid workaround, but not a valid bugfix. Puppet has a built-in szstemctl daemon-reload since 6.1, it's just not triggered correctly in all usecase. See https://tickets.puppetlabs.com/browse/PUP-3483

Reply all
Reply to author
Forward
0 new messages