{"record":{"id":"92cacaa52dba898d","repo":"puppetlabs/puppet","slug":"could-not-disable-name-output","errorCode":null,"errorMessage":"Could not disable #{name}: #{output}","messagePattern":"Could not disable #(.+?): #(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/service/gentoo.rb","lineNumber":20,"sourceCode":"\n# Manage gentoo services.  Start/stop is the same as InitSvc, but enable/disable\n# is special.\nPuppet::Type.type(:service).provide :gentoo, :parent => :init do\n  desc <<-EOT\n    Gentoo's form of `init`-style service management.\n\n    Uses `rc-update` for service enabling and disabling.\n\n  EOT\n\n  commands :update => \"/sbin/rc-update\"\n\n  confine 'os.name' => :gentoo\n\n  def disable\n    output = update :del, @resource[:name], :default\n  rescue Puppet::ExecutionFailure => e\n    raise Puppet::Error, \"Could not disable #{name}: #{output}\", e.backtrace\n  end\n\n  def enabled?\n    begin\n      output = update :show\n    rescue Puppet::ExecutionFailure\n      return :false\n    end\n\n    line = output.split(/\\n/).find { |l| l.include?(@resource[:name]) }\n\n    return :false unless line\n\n    # If it's enabled then it will print output showing service | runlevel\n    if output =~ /^\\s*#{@resource[:name]}\\s*\\|\\s*(boot|default)/\n      :true\n    else\n      :false","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/service/gentoo.rb#L2-L38","documentation":"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.","triggerScenarios":"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].","commonSituations":"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.","solutions":["Run the exact command by hand to see the real error: /sbin/rc-update del <name> default","Check registration: rc-update show | grep <name>; if absent, the disable is unnecessary or enable ran first","Confirm os.name fact is gentoo and you are not forcing the provider on another distro","Align the resource name with the actual init script name in /etc/init.d"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# pre-flight on the node: only manage disable when it is actually registered\ntest -x /sbin/rc-update || echo \"rc-update missing — wrong provider?\"\nrc-update show default 2>/dev/null | grep -q \"^[[:space:]]*${name}[[:space:]]*|\" \\\n  || echo \"${name} not in default runlevel; disable will fail\"","typeGuard":null,"tryCatchPattern":"begin\n  provider.disable\nrescue Puppet::Error => e\n  # message shows nil output on this path; inspect e.cause/original exception for rc-update stderr\n  warn \"rc-update del failed for #{name}: #{e.message}\" if Puppet.settings[:noop] == false\nend","preventionTips":["Gate service resources on os.name fact: only use the gentoo provider on Gentoo nodes","Sync the resource name with the real /etc/init.d script name via a mapping in your data layer","Test rc-update add/del in a Gentoo container before rolling service changes to fleets"],"tags":["puppet","gentoo","rc-update","service","disable"],"backgroundTag":"command-execution-failure","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}