{"record":{"id":"114bf4b04f6d1598","repo":"puppetlabs/puppet","slug":"you-must-specify-a-package-source-or-configure-an","errorCode":null,"errorMessage":"You must specify a package source or configure an installpath in /etc/pkg.conf","messagePattern":"You must specify a package source or configure an installpath in /etc/pkg\\.conf","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/openbsd.rb","lineNumber":147,"sourceCode":"            @resource[:source] = matchdata[1]\n          else\n            matchdata = line.match(/^installpath\\s*\\+=\\s*(.+)\\s*$/i)\n            if matchdata\n              if @resource[:source].nil?\n                @resource[:source] = matchdata[1]\n              else\n                @resource[:source] += \":\" + matchdata[1]\n              end\n            end\n          end\n        end\n\n        unless @resource[:source]\n          raise Puppet::Error,\n                _(\"No valid installpath found in /etc/pkg.conf and no source was set\")\n        end\n      else\n        raise Puppet::Error,\n              _(\"You must specify a package source or configure an installpath in /etc/pkg.conf\")\n      end\n    end\n  end\n\n  def install(latest = false)\n    cmd = []\n\n    parse_pkgconf\n\n    if @resource[:source][-1, 1] == ::File::SEPARATOR\n      e_vars = { 'PKG_PATH' => @resource[:source] }\n      full_name = get_full_name(latest)\n    else\n      e_vars = {}\n      full_name = @resource[:source]\n    end\n","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/openbsd.rb#L129-L165","documentation":"openbsd.rb:147 (parse_pkgconf): the stricter sibling of the 'no valid installpath' error — it fires when the resource has no source and /etc/pkg.conf does not exist at all. Without either a per-resource source or an installpath file, pkg_add has no idea where to fetch packages from, so the provider refuses with Puppet::Error.","triggerScenarios":"ensure => installed package resource with no source on an OpenBSD node where /etc/pkg.conf has been deleted or never created (Puppet::FileSystem.exist? fails).","commonSituations":"Minimal/hardened OpenBSD images that prune /etc; chroots and build jails without a base etc set; first runs before any configuration management of pkg.conf.","solutions":["Create /etc/pkg.conf with an installpath line (via a file resource that runs before packages).","Alternatively set source per package (directory URL ending in '/' so the code sets PKG_PATH), e.g. source => 'https://ftp.openbsd.org/pub/OpenBSD/7.4/packages/amd64/'.","Order the pkg.conf creation explicitly with before/require so parse_pkgconf finds the file on the first run."],"exampleFix":"# before\npackage { 'rsync--': ensure => installed }  # /etc/pkg.conf missing\n\n# after\nfile { '/etc/pkg.conf': ensure => file, content => 'installpath = https://ftp.openbsd.org/pub/OpenBSD/7.4/packages/%a\\n', before => Package['rsync--'] }\npackage { 'rsync--': ensure => installed }","handlingStrategy":"validation","validationCode":"# no source and no pkg.conf -> will raise; check first\nhas_conf = Puppet::FileSystem.exist?('/etc/pkg.conf')\nraise 'OpenBSD needs package source or /etc/pkg.conf installpath' if resource[:source].nil? && !has_conf","typeGuard":null,"tryCatchPattern":"begin\n  provider.send(:parse_pkgconf)\nrescue Puppet::Error => e\n  raise unless e.message.include?('installpath in /etc/pkg.conf')\n  # first run: create pkg.conf then retry\n  write_default_pkgconf; retry\nend","preventionTips":["Include pkg.conf creation in base OpenBSD profiles with before => Package <| |>. ","Never prune /etc/pkg.conf in image hardening without also setting per-package sources.","Smoke-test package installs in your OpenBSD image build."],"tags":["puppet","openbsd","packages","repository-config"],"backgroundTag":"package-source-misconfigured","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}