After enabling package data collection using the package_inventory_enabled
parameter, Puppet runs fail with No such file or directory
error messages.
Error messages and logs
When running Puppet on a node, you get the following errors:
Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /opt/puppetlabs/puppet/cache/state/package_inventory_enabled at /opt/puppetlabs/puppet/modules/puppet_enterprise /manifests/profile/agent.pp:77 Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /opt/puppetlabs /puppet/cache/state/package_inventory_enabled at /opt/puppetlabs/puppet/modules/puppet_enterprise /manifests/profile/agent.pp:77 Wrapped exception: No such file or directory @ rb_sysopen - /opt/puppetlabs/puppet/cache /state/package_inventory_enabled change from absent to present failed: Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /opt/puppetlabs/puppet/cache/state/package_inventory_enabled at /opt/puppetlabs/puppet/modules/puppet_enterprise/manifests/profile/agent.pp:77 Source: /Stage[main]/Puppet_enterprise::Profile::Agent/File[/opt/puppetlabs/puppet/cache /state/package_inventory_enabled]/ensure File: /opt/puppetlabs/puppet/modules/puppet_enterprise/manifests/profile/agent.ppLine: 77
Version and installation information
PE version: All supported versions
OS: Unix
Installation type: Standard, large, extra-large
Note: If you’re already using the puppetlabs-support_tasks
module, update it to the latest version.
Solution
This issue occurs when statedir
is not set to the default location, /opt/puppetlabs/puppet/cache/state
in puppet.conf
. The default location of these directories changed in PE 2015.2. If you upgraded from an older version of PE, statedir
,vardir
, and rundir
might be set to something other than the default location.
You can fix this manually or by installing a module and using a task. You can only complete the task-based solution on Unix nodes.
To use a task to fix the issue:
Note: If you’re already using the puppetlabs-support_tasks
module, update it to the latest version.
Resolve the error by installing a module and using a task to remove the vardir
, statedir
, and cachedir
settings from puppet.conf
. You can only complete the task-based solution on Unix nodes.
-
Download and install the
puppetlabs-support-tasks module
which includes the task for this solution. -
In the console, in the Orchestration section, click Tasks. Click Run a task in the upper right corner of the Tasks page. Under Tasks select
support_tasks:st0236_set_cache_paths_to_default
. In the Code environment field, select the environment where you installed the module. This defaults to production. Under Select targets select a PQL query, node list, or node group to select the affected nodes. Click Run task.The task can exit with the following outputs:
success - parameters reset to default
: Parameters were changed to default.success - No changes necessary
: Parameters were already default, no changes were made.sucess - Not an agent node
: The task ran on infrastructure nodes, and exited with no change to parameters.fail - unable to reset parameters
: The task exited with no change to parameters.
To manually fix the issue:
On one node or a handful of nodes
In puppet.conf
, change the location for each directory to its default value.
On each affected agent node:
-
Edit
/etc/puppetlabs/puppet/puppet.conf
to remove the following settings:vardir
,rundir
, andstatedir
. -
Restart the
puppet
service:puppet resource service puppet ensure=stopped puppet resource service puppet ensure=running
-
To verify that the issue has been resolved, run
puppet agent -t
On many nodes
Manage the location of vardir
, rundir
, and statedir
using the puppetlabs-inifile
module.
-
Install or add
puppetlabs-inifile
to your deployment. -
Add the following to a class.
$puppet_conf = '/etc/puppetlabs/puppet/puppet.conf' ini_setting { 'puppet.conf remove vardir': ensure => absent, path => $puppet_conf, section => 'main', setting => 'vardir', } ini_setting { 'puppet.conf remove rundir': ensure => absent, path => $puppet_conf, section => 'main', setting => 'rundir', } ini_setting { 'puppet.conf remove statedir': ensure => absent, path => $puppet_conf, section => 'main', setting => 'statedir', }
-
Add the class to a node group with the affected nodes in it.
How can we improve this article?
0 comments
Please sign in to leave a comment.
Related articles