{"record":{"id":"7a0fb57478bf60ba","repo":"lima-vm/lima","slug":"field-mounts-d-mountpoint-must-not-be-a-system","errorCode":null,"errorMessage":"field `mounts[%d].mountPoint` must not be a system path such as /etc or /usr","messagePattern":"field `mounts\\[(.+?)\\]\\.mountPoint` must not be a system path such as /etc or /usr","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":148,"sourceCode":"\t\tloc, err := localpathutil.Expand(f.Location)\n\t\tif err != nil {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].location` refers to an unexpandable path: %#q: %w\", i, f.Location, err))\n\t\t}\n\t\tst, err := os.Stat(loc)\n\t\tif err != nil {\n\t\t\tif !errors.Is(err, os.ErrNotExist) {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].location` refers to an inaccessible path: %#q: %w\", i, f.Location, err))\n\t\t\t}\n\t\t\tif warn {\n\t\t\t\tlogrus.Warnf(\"field `mounts[%d].location` refers to a non-existent directory: %#q:\", i, f.Location)\n\t\t\t}\n\t\t} else if !st.IsDir() {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].location` refers to a non-directory path: %#q: %w\", i, f.Location, err))\n\t\t}\n\n\t\tswitch *f.MountPoint {\n\t\tcase \"/\", \"/bin\", \"/dev\", \"/etc\", \"/home\", \"/opt\", \"/sbin\", \"/tmp\", \"/usr\", \"/var\":\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].mountPoint` must not be a system path such as /etc or /usr\", i))\n\t\t// home directory defined in \"cidata.iso:/user-data\"\n\t\tcase *y.User.Home:\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].mountPoint` is the reserved internal home directory %#q\", i, *y.User.Home))\n\t\t}\n\t\t// There is no tilde-expansion for guest filenames\n\t\tif strings.HasPrefix(*f.MountPoint, \"~\") {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].mountPoint` must not start with `~`\", i))\n\t\t}\n\n\t\tif _, err := units.RAMInBytes(*f.NineP.Msize); err != nil {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `msize` has an invalid value: %w\", err))\n\t\t}\n\t}\n\n\tif *y.SSH.LocalPort != 0 {\n\t\tif err := validatePort(\"ssh.localPort\", *y.SSH.LocalPort); err != nil {\n\t\t\terrs = errors.Join(errs, err)\n\t\t}","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L130-L166","documentation":"Guest mountPoint values must not shadow critical system directories of the VM. Validate() rejects mountPoint equal to /, /bin, /dev, /etc, /home, /opt, /sbin, /tmp, /usr, or /var, since mounting over them would break the guest root filesystem.","triggerScenarios":"A mounts entry has mountPoint set to one of the forbidden system paths when Validate runs, e.g. `mountPoint: /etc` or `mountPoint: /` (including the default in older configs).","commonSituations":"Hand-editing mountPoint to expose host files at a familiar guest path; migrating config from other VM tools that allowed /; trying to replace /tmp or /var with a host mount.","solutions":["Change mountPoint to a safe location such as `/mnt/host/data` or `~/data`-equivalent guest path (no leading ~)","Access the needed host files from the new mountPoint instead of the system path","Re-validate with `limactl template validate`"],"exampleFix":"// before\nmounts:\n  - location: ~/etc-config\n    mountPoint: /etc\n// after\nmounts:\n  - location: ~/etc-config\n    mountPoint: /mnt/etc-config","handlingStrategy":"validation","validationCode":"const FORBIDDEN = ['/', '/bin', '/dev', '/etc', '/home', '/opt', '/sbin', '/tmp', '/usr', '/var']\nfunction safeMountPoint(mp) { return typeof mp === 'string' && !FORBIDDEN.includes(mp) }","typeGuard":"function isCustomMountPoint(mp) { return typeof mp === 'string' && mp.startsWith('/mnt/') || /^\\/home\\/[^/]+\\/./.test(mp || '') }","tryCatchPattern":"try { await limactl(['template','validate', file]) } catch (e) { if (/mountPoint.*must not be a system path/.test(e.message)) { moveMountPointTo(e, '/mnt/host'); } else throw e }","preventionTips":["Always use dedicated paths like /mnt/... or /srv/... for guest mountPoints","Never copy mountPoint values from other VM tools without review","Add a config linter rule rejecting the reserved list"],"tags":["lima","config-validation","mounts","guest-filesystem"],"backgroundTag":"forbidden-mount-point","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}