puppetlabs/puppet · error · Puppet::Error

Could not disable #{name}: #{output}

Error message

Could not disable #{name}: #{output}

What it means

The Gentoo service provider implements disable by shelling out to /sbin/rc-update del <name> default. A Puppet::ExecutionFailure from that command (non-zero exit) is rescued and re-raised as Puppet::Error with the command output attached. Note a long-standing quirk: because the rescue fires before the assignment to output completes, the interpolated #{output} in the message is nil, so the real reason must be read from the exception backtrace/e.cause.

Source

Thrown at lib/puppet/provider/service/gentoo.rb:20

# Manage gentoo services.  Start/stop is the same as InitSvc, but enable/disable
# is special.
Puppet::Type.type(:service).provide :gentoo, :parent => :init do
  desc <<-EOT
    Gentoo's form of `init`-style service management.

    Uses `rc-update` for service enabling and disabling.

  EOT

  commands :update => "/sbin/rc-update"

  confine 'os.name' => :gentoo

  def disable
    output = update :del, @resource[:name], :default
  rescue Puppet::ExecutionFailure => e
    raise Puppet::Error, "Could not disable #{name}: #{output}", e.backtrace
  end

  def enabled?
    begin
      output = update :show
    rescue Puppet::ExecutionFailure
      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

View on GitHub (pinned to e227c27540)

Solutions

  1. Run the exact command by hand to see the real error: /sbin/rc-update del <name> default
  2. Check registration: rc-update show | grep <name>; if absent, the disable is unnecessary or enable ran first
  3. Confirm os.name fact is gentoo and you are not forcing the provider on another distro
  4. Align the resource name with the actual init script name in /etc/init.d
Defensive patterns

Strategy: validation

Validate before calling

# pre-flight on the node: only manage disable when it is actually registered
test -x /sbin/rc-update || echo "rc-update missing — wrong provider?"
rc-update show default 2>/dev/null | grep -q "^[[:space:]]*${name}[[:space:]]*|" \
  || echo "${name} not in default runlevel; disable will fail"

Try / catch

begin
  provider.disable
rescue Puppet::Error => e
  # message shows nil output on this path; inspect e.cause/original exception for rc-update stderr
  warn "rc-update del failed for #{name}: #{e.message}" if Puppet.settings[:noop] == false
end

Prevention

When it happens

Trigger: Running disable on a Gentoo node where rc-update del fails: the service is not registered in any runlevel, /sbin/rc-update is missing or not executable (confine 'os.name' => :gentoo violated, e.g. provider forced), or the init script name does not match @resource[:name].

Common situations: Managing a service whose /etc/init.d script was removed by a package update; forcing provider => 'gentoo' while testing on a non-Gentoo box; a stale catalog referencing a renamed ebuild service.

Related errors


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/92cacaa52dba898d. Report an issue: GitHub.