puppetlabs/puppet · error · Puppet::Error
Could not enable #{name}: #{output}
Error message
Could not enable #{name}: #{output} What it means
The Gentoo provider's enable shells out to /sbin/rc-update add <name> default and converts any Puppet::ExecutionFailure into Puppet::Error. As with disable, the interpolated #{output} is nil on this path because the assignment never completed, so the message alone does not carry the underlying rc-update stderr.
Source
Thrown at lib/puppet/provider/service/gentoo.rb:45
return :false
end
line = output.split(/\n/).find { |l| l.include?(@resource[:name]) }
return :false unless line
# If it's enabled then it will print output showing service | runlevel
if output =~ /^\s*#{@resource[:name]}\s*\|\s*(boot|default)/
:true
else
:false
end
end
def enable
output = update :add, @resource[:name], :default
rescue Puppet::ExecutionFailure => e
raise Puppet::Error, "Could not enable #{name}: #{output}", e.backtrace
end
end
View on GitHub (pinned to e227c27540)
Solutions
- Run /sbin/rc-update add <name> default manually and read its stderr
- Confirm the init script exists and is executable: test -x /etc/init.d/<name>
- Add ordering so the owning package is applied first: Package['<pkg>'] -> Service['<name>']
- Verify the resource title equals the init script filename
Example fix
# before
package { 'net-misc/ntp': ensure => installed }
service { 'ntpd':
enable => true,
provider => 'gentoo',
}
# after
package { 'net-misc/ntp': ensure => installed }
-> service { 'ntpd':
enable => true,
provider => 'gentoo',
} Defensive patterns
Strategy: validation
Validate before calling
# ensure the init script exists before enable is attempted
test -x "/etc/init.d/${name}" || { echo "${name}: no init script — install package first"; exit 1; } Try / catch
begin
provider.enable
rescue Puppet::Error => e
warn "rc-update add failed for #{name}; check /etc/init.d/#{name} exists and is valid"
end Prevention
- Always declare Package[...] -> Service[...] ordering for rc-update-managed services
- Never force provider => 'gentoo' off-platform; rely on the os.name confine
- After package renames, audit service resource titles against /etc/init.d contents
When it happens
Trigger: enable runs when the init script /etc/init.d/<name> does not exist (rc-update add refuses to register a missing script), the name does not match an installed init script, or rc-update exits non-zero for another reason such as a read-only /etc/runlevels.
Common situations: The package that ships the init script is not installed or not applied before the service resource (missing package -> service ordering); renaming an ebuild service; a container image with Gentoo userland but no OpenRC state.
Related errors
- Could not disable #{name}: #{output}
- Could not enable #{name}: #{detail}
- Could not #{action} #{name}: #{output}
- Unable to verify the SSL certificate at %{uri}
- Unknown service #{name}
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/9dfacd5515a9a8d0.
Report an issue: GitHub.