Jira (PUP-9601) mount resource should trigger 'systemctl daemon-reload'

2 views
Skip to first unread message

Adam Winberg (JIRA)

unread,
Apr 3, 2019, 7:02:03 AM4/3/19
to puppe...@googlegroups.com
Adam Winberg created an issue
 
Puppet / Bug PUP-9601
mount resource should trigger 'systemctl daemon-reload'
Issue Type: Bug Bug
Affects Versions: PUP 5.5.3
Assignee: Unassigned
Created: 2019/04/03 4:01 AM
Priority: Normal Normal
Reporter: Adam Winberg

Puppet Version: 5.5.3
Puppet Server Version: 5.3.3
OS Name/Version: RHEL7

On systemd distributions entries in /etc/fstab automatically generates systemd .mount files, resulting in systemd effectively managing the mount. When changes are made to /etc/fstab, 'systemctl daemon-reload' must be called in order to generate new systemd mount files. It seems natural to me that puppets mount resource automatically should trigger this reload on changes in fstab if systemd is present, which it does not do currently.

 

Desired Behavior:

Changes in mount resources should always trigger a reload of systemd configuration (systemctl daemon-reload)

Actual Behavior:

Changes in mount resource only updates fstab. Changes will not update corresponding systemd .mount files until reboot or issuing a 'systemctl daemon-reload' manually. This is particularly inconvinient when using systemd automounting.

Following puppet mount:

mount {"/temp":
 ensure => 'present',
 device => 'fs_server:/temp',
 fstype => 'nfs',
 options => 'noauto,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.mount-timeout=30,x-systemd.idle-timeout=60,_netdev,vers=4.0,sec=krb5,
 }

creates a line in fstab for this mount, but does not create any corresponding systemd mount files. So, in this case, 'mount /temp' will work but not 'systemctl start temp.mount'. On boot, however, systemd will generate mount files (one .mount and one .automount) for this mount automatically. On access the filesystem will be mounted automatically by systemd, and unmounted after 60s of inactivity. If I change mount options for this mount, the fstab will be updated but since the systemd files are not updated any automounting after the change will still use the old options.

I can workaround this in my code by notifying a 'systemctl daemon-reload' in my mount definition, but if the mount fails for some reason (typically because of a failed remount) the reload command will not run leaving my system in an inconsistent state.

 

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

Adam Winberg (JIRA)

unread,
Apr 3, 2019, 7:06:02 AM4/3/19
to puppe...@googlegroups.com
Adam Winberg updated an issue
Change By: Adam Winberg
*Puppet Version: 5.5.3*
*Puppet Server Version: 5.3.3*
*OS Name/Version: RHEL7*


On systemd distributions entries in /etc/fstab automatically generates systemd .mount files, resulting in systemd effectively managing the mount. When changes are made to /etc/fstab, 'systemctl daemon-reload' must be called in order to generate new systemd mount files. It seems natural to me that puppets mount resource automatically should trigger this reload on changes in fstab if systemd is present, which it does not do currently.

 

*Desired Behavior:*


Changes in mount resources should always trigger a reload of systemd configuration (systemctl daemon-reload)

*Actual Behavior:*


Changes in mount resource only updates fstab. Changes will not update corresponding systemd .mount files until reboot or issuing a 'systemctl daemon-reload' manually. This is particularly inconvinient when using systemd automounting.

Following puppet mount:
{code:java}
mount {"/temp":
ensure => 'present',
device => 'fs_server:/temp',
fstype => 'nfs',
options => 'noauto,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.mount-timeout=30,x-systemd.idle-timeout=60,_netdev,vers=4.0,sec=krb5 , '
}{code}

creates a line in fstab for this mount, but does not create any corresponding systemd mount files. So, in this case, 'mount /temp' will work but not 'systemctl start temp.mount'. On boot, however, systemd will generate mount files (one .mount and one .automount) for this mount automatically. On access the filesystem will be mounted automatically by systemd, and unmounted after 60s of inactivity. If I change mount options for this mount, the fstab will be updated but since the systemd files are not updated any automounting after the change will still use the old options.

I can workaround this in my code by notifying a 'systemctl daemon-reload' in my mount definition, but if the mount fails for some reason (typically because of a failed remount) the reload command will not run leaving my system in an inconsistent state.

 

Josh Cooper (JIRA)

unread,
Apr 3, 2019, 6:30:03 PM4/3/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Apr 3, 2019, 6:30:03 PM4/3/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Apr 3, 2019, 6:30:05 PM4/3/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Apr 4, 2019, 2:21:02 AM4/4/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Story Points: 3
Sprint: PR - 2019-04-17

Adam Winberg (JIRA)

unread,
Apr 4, 2019, 5:45:03 AM4/4/19
to puppe...@googlegroups.com
Adam Winberg commented on Bug PUP-9601
 
Re: mount resource should trigger 'systemctl daemon-reload'

Additionally you would also need to trigger a

systemctl restart remote-fs.target

or

systemctl restart local-fs.target

, depending on whether the mount is remote (for example nfs) or local. Otherwise systemd will not create the mountpoints until next reboot.

 

Gheorghe Popescu (JIRA)

unread,
Apr 16, 2019, 9:55:06 AM4/16/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Apr 17, 2019, 5:35:10 AM4/17/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR - 2019-04-17 , PR - 2019-05-02

Gheorghe Popescu (JIRA)

unread,
Apr 24, 2019, 10:13:02 AM4/24/19
to puppe...@googlegroups.com
Gheorghe Popescu commented on Bug PUP-9601
 
Re: mount resource should trigger 'systemctl daemon-reload'

Adam Winberg i looked over the issue and on puppet documentation for the mount resource it says that you can specify different values for the ensure attribute. Could you check that using ensure => "mounted" instead of ensure => "present" solves your issue?

https://puppet.com/docs/puppet/5.3/types/mount.html#mount-attribute-ensure

 

Adam Winberg (JIRA)

unread,
Apr 24, 2019, 10:21:02 AM4/24/19
to puppe...@googlegroups.com
Adam Winberg commented on Bug PUP-9601

Gheorghe Popescu That doesnt really fit my usecase, since I use systemd for automount. So puppet should only make sure that the mount is added to the fstab but disregard whether the mount is mounted or not (i.e. 'present').

Gheorghe Popescu (JIRA)

unread,
Apr 24, 2019, 10:34:03 AM4/24/19
to puppe...@googlegroups.com

Is there any reason why are you relying on systemd for automount instead of letting puppet use "mounted" option?

Adam Winberg (JIRA)

unread,
Apr 24, 2019, 11:01:20 AM4/24/19
to puppe...@googlegroups.com
Adam Winberg commented on Bug PUP-9601

Regardless of which components you use that is more a question of automount vs. static mounts and I'm not sure why that is relevant here. But some of the advantages for us are: Automounting only mounts on access and automatically unmounts after inactivity so a server only activates a mount if it needs it (less network activity, less hassle if we need to change some mount options). If one mount is having an issue it wont affect system boot (and puppet wont error and time out trying to mount it).

Gheorghe Popescu (JIRA)

unread,
Apr 24, 2019, 11:03:08 AM4/24/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
May 2, 2019, 5:21:08 AM5/2/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR - 2019-04-17, PR - 2019-05-02 , PR - 2019-05-15

Gheorghe Popescu (JIRA)

unread,
May 9, 2019, 11:31:02 AM5/9/19
to puppe...@googlegroups.com
 
Re: mount resource should trigger 'systemctl daemon-reload'

Hi Adam Winberg

After looking more in-depth into this issue i believe this can be solved using a notify to 'systemctl daemon-reload' and the service created by systemd.

For example:

$mount_name="test"
 
mount {"/mnt/${mount_name}":
  ensure  => 'present',
  device  => "fs_server:/opt/${mount_name}",
  fstype  => 'nfs',
  options => 'noauto,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.mount-timeout=30,x-systemd.idle-timeout=60,_netdev',
  notify  => [Exec['systemctl daemon-reload'], Service["mnt-${mount_name}.mount"]]
}
 
exec {'systemctl daemon-reload':
  refreshonly => true,
  path        => ['/usr/bin', '/usr/sbin',]
}
 
service { "mnt-${mount_name}.mount":
  ensure => running,
}

In your example you are adding "noauto". With this option, the mount unit will not be added as a dependency for local-fs.target or remote-fs.target, so a refresh to this services is not needed.
The intent of "present" in the puppet mount resource is to add the information to fstab but not change mount/unmount status - this should not throw any mount errors.
In your case the actual mount process is handled by systemd.

Reply all
Reply to author
Forward
0 new messages