hashicorp/vagrant · warning

The `privileged` setting for option `run` for trigger comman

Error message

The `privileged` setting for option `run` for trigger command '%{command}' will be ignored and set to false.

What it means

A trigger's `run` option executes a host-side shell command where the shell provisioner's `privileged` flag has no meaning. When run.privileged == true, validation warns that it will be ignored and set to false for the host execution.

Source

Thrown at plugins/kernel_v2/config/vm_trigger.rb:238

                           trigger: @command,
                           types: VALID_TRIGGER_TYPES.join(', '))
        end

        if @type == :command || !@type
          commands = Vagrant.plugin("2").manager.commands.keys.map(&:to_s)

          if !commands.include?(@command) && @command != :all
            machine.ui.warn(I18n.t("vagrant.config.triggers.bad_command_warning",
                                  cmd: @command))
          end
        end

        if @run
          errorz = @run.validate(machine)
          errors.concat errorz["shell provisioner"] if !errorz.empty?

          if @run.privileged == true
            machine.ui.warn(I18n.t("vagrant.config.triggers.privileged_ignored",
                                  command: @command))
          end

          if @run.powershell_args != ""
            machine.ui.warn(I18n.t("vagrant.config.triggers.powershell_args_ignored"))
          end
        end

        if @run_remote
          errorz = @run_remote.validate(machine)
          errors.concat errorz["shell provisioner"] if !errorz.empty?
        end

        if @name && !@name.is_a?(String)
          errors << I18n.t("vagrant.config.triggers.name_bad_type", cmd: @command)
        end

        if @info && !@info.is_a?(String)

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Remove privileged from the run option hash (it is ignored for host-side execution)
  2. If you actually need privileged execution in the guest, use `t.run_remote = { inline: "...", privileged: true }`, which runs through the shell provisioner on the machine

Example fix

# before
config.trigger.after :up do |t|
  t.run = { inline: "echo hi", privileged: true }
end
# after (needs privilege in the guest)
config.trigger.after :up do |t|
  t.run_remote = { inline: "echo hi", privileged: true }
end
Defensive patterns

Strategy: validation

Validate before calling

# Lint trigger run hashes: no privileged key allowed
raise "privileged is ignored for trigger run" if trigger_run.key?(:privileged)

Type guard

host_run_options = ->(h) { h.slice(:inline, :path, :args, :env, :powershell_elevated) } # privileged belongs only to run_remote

Prevention

When it happens

Trigger: A trigger block containing `t.run = { inline: "...", privileged: true }` in a Vagrantfile; the check runs during trigger validation.

Common situations: Copy-pasting shell-provisioner option hashes into trigger run options; assuming host-side commands can elevate via privileged.

Related errors


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/3ee351721be89393. Report an issue: GitHub.