{"record":{"id":"a40b7e571fd75774","repo":"lima-vm/lima","slug":"can-t-read-q-w-hint-s","errorCode":null,"errorMessage":"can't read %#q: %w: (Hint: %s)","messagePattern":"can't read %#q: %w: \\(Hint: (.+?)\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/networks/sudoers.go","lineNumber":110,"sourceCode":"\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"passwordLessSudo error: %w\", err)\n\t}\n\thint := fmt.Sprintf(\"run `%s sudoers >etc_sudoers.d_lima && sudo install -o root etc_sudoers.d_lima %q`)\",\n\t\tos.Args[0], sudoersFile)\n\tb, err := os.ReadFile(sudoersFile)\n\tif err != nil {\n\t\t// Default networks.yaml specifies /etc/sudoers.d/lima file. Don't throw an error when the\n\t\t// file doesn't exist, as long as password-less sudo still works.\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\terr = c.passwordLessSudo(ctx)\n\t\t\tif err == nil {\n\t\t\t\tlogrus.Debugf(\"%#q does not exist, but sudo doesn't seem to require a password\", sudoersFile)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tlogrus.Debugf(\"%#q does not exist; passwordLessSudo error: %s\", sudoersFile, err)\n\t\t}\n\t\treturn fmt.Errorf(\"can't read %#q: %w: (Hint: %s)\", sudoersFile, err, hint)\n\t}\n\tsudoers, err := Sudoers()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif string(b) != sudoers {\n\t\t// Happens on upgrading socket_vmnet with Homebrew\n\t\treturn fmt.Errorf(\"sudoers file %#q is out of sync and must be regenerated (Hint: %s)\", sudoersFile, hint)\n\t}\n\treturn nil\n}\n","sourceCodeStart":92,"sourceCodeEnd":122,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/networks/sudoers.go#L92-L122","documentation":"Lima cannot read the configured sudoers file (e.g. /etc/sudoers.d/lima) needed to validate network daemon sudo access, and passwordless sudo did not work as a fallback either. The message includes a Hint with the exact command to (re)generate and install the file.","triggerScenarios":"VerifySudoAccess is called with a non-empty sudoersFile, os.ReadFile fails with a non-ErrNotExist error (permission denied, path wrong), or the file does not exist and the passwordLessSudo fallback also fails.","commonSituations":"New Lima install where /etc/sudoers.d/lima was never created, the sudoersFile path in networks.yaml points to the wrong location, or the file exists but is unreadable by the current user.","solutions":["Run the Hint command: limactl sudoers > etc_sudoers.d_lima && sudo install -o root etc_sudoers.d_lima /etc/sudoers.d/lima","Check that paths.sudoersFile in networks.yaml matches the actual installed file location","Fix file permissions so the user can read the sudoers file (root-owned 0440 is standard for /etc/sudoers.d; note non-root read failure is expected if fallback sudo also fails)","If you rely on the file-missing fallback, ensure passwordless sudo (NOPASSWD) actually works"],"exampleFix":"// before\n# /etc/sudoers.d/lima missing\n// after\n$ limactl sudoers > etc_sudoers.d_lima && sudo install -o root etc_sudoers.d_lima /etc/sudoers.d/lima","handlingStrategy":"validation","validationCode":"if sudoersFile != \"\" {\n    if _, err := os.Stat(sudoersFile); errors.Is(err, os.ErrNotExist) {\n        out, _ := exec.Command(\"limactl\", \"sudoers\").Output()\n        // install: sudo install -o root <tmp> /etc/sudoers.d/lima\n        _ = out\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := verifySudoAccess(ctx, sudoersFile); err != nil {\n    var pathErr *os.PathError\n    if errors.As(err, &pathErr) && errors.Is(pathErr.Err, os.ErrNotExist) {\n        // regenerate & install the sudoers file, then retry\n    }\n}","preventionTips":["Run `limactl sudoers > ... && sudo install ...` right after installing Lima","Keep networks.yaml paths.sudoersFile pointing at the real file location","Re-run the sudoers install after macOS upgrades and socket_vmnet reinstall","Follow the Hint in the error message verbatim"],"tags":["network","sudo","sudoers-file","permissions"],"backgroundTag":"sudoers-file-missing","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}