lima-vm/lima · error

no sudoers file defined in %#q

Error message

no sudoers file defined in %#q

What it means

verifySudoAccess determines which sudoers file to check: an explicit argument, or the path configured in the lima network config (nwCfg.Paths.Sudoers). If no argument is given and the config defines no sudoers path, the check cannot proceed and this error names the lima network config file where the path would be defined.

Source

Thrown at cmd/limactl/sudoers_darwin.go:59

	default:
		return fmt.Errorf("unexpected arguments %v", args)
	}
	sudoers, err := networks.Sudoers()
	if err != nil {
		return err
	}
	fmt.Fprint(cmd.OutOrStdout(), sudoers)
	return nil
}

func verifySudoAccess(ctx context.Context, nwCfg networks.Config, args []string, stdout io.Writer) error {
	var file string
	switch len(args) {
	case 0:
		file = nwCfg.Paths.Sudoers
		if file == "" {
			cfgFile, _ := networks.ConfigFile()
			return fmt.Errorf("no sudoers file defined in %#q", cfgFile)
		}
	case 1:
		file = args[0]
	default:
		return errors.New("can check only a single sudoers file")
	}
	if err := nwCfg.VerifySudoAccess(ctx, file); err != nil {
		return err
	}
	fmt.Fprintf(stdout, "%#q is up-to-date (or sudo doesn't require a password)\n", file)
	return nil
}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Set paths.sudoers in the network config file named in the error (usually ~/.lima/_config/networks.yaml)
  2. Or pass the file explicitly: `limactl sudoers --check /etc/sudoers.d/lima`
  3. If you never use the vznat/vde network needing sudoers, ignore or remove related config

Example fix

// before (~/.lima/_config/networks.yaml)
paths:
  sudoers: ""
// after
paths:
  sudoers: /etc/sudoers.d/lima
Defensive patterns

Strategy: validation

Validate before calling

grep -A2 'paths:' ~/.lima/_config/networks.yaml | grep sudoers || echo 'set paths.sudoers or pass a file to --check'

Try / catch

if ! limactl sudoers --check; then echo 'configure paths.sudoers in ~/.lima/_config/networks.yaml'; fi

Prevention

When it happens

Trigger: `limactl sudoers --check` (no file argument) when ~/.lima/_config/networks.yaml has an empty paths.sudoers field.

Common situations: Fresh Lima installs where the sudoers path was never configured; users deleting or never creating /etc/sudoers.d/lima and not recording it in networks.yaml; upgrading from versions that didn't manage sudoers.

Understand the failure class

Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/0c12577c52a9948f. Report an issue: GitHub.