Home dir not mounting anymore with 1.2.1 when local username is not a valid Linux username
Description
I've tried recreating my local VM with lima 1.2.1 (using https://cloud.debian.org/images/cloud/bookworm/20250804-2194/debian-12-genericcloud-arm64-20250804-2194.qcow2) and to my surprise my home is not mounting anymore.
When I create the VM I get:
WARN[0000] local username "[email protected]" is not a valid Linux username (must match "^[a-z_][a-z0-9_-]*$"); using "lima" instead
and when it creates the VM, host home dir exists in the VM but it's empty:
lima
bash: line 1: cd: /Users/[email protected]/project: No such file or directory
lima@lima-lima:/Users/[email protected]$ ls -la
total 8
drwxr-xr-x 2 root root 4096 Aug 14 11:38 .
drwxr-xr-x 3 root root 4096 Aug 14 11:38 ..
I've tried mounting the dir to /home/lima.linux but that is empty as well:
mounts:
# Also tried
# - location: "{{.Home}}"
# writable: true
- location: "/tmp/lima"
writable: true
- location: "{{.Home}}/project"
mountPoint: "/home/lima.linux/project"
writable: true
lima@lima-lima:~$ pwd
/home/lima.linux
lima@lima-lima:~$ ls -la project/
total 8
drwxr-xr-x 2 lima root 4096 Aug 14 11:38 .
drwxr-xr-x 4 lima root 4096 Aug 14 11:38 ..
How do I mount the home dir (or its subdir) now?
I still get the mounts (with an invalid user name), so there is probably some mount error in the logs?
This may be due to the switch from reverse-sshfs to virtiofs.
Try setting the mountType to reverse-sshfs and see if that works (because it uses a different code path than 9p and virtiofs).
This may be due to the switch from
reverse-sshfstovirtiofs.Try setting the
mountTypetoreverse-sshfsand see if that works (because it uses a different code path than9pandvirtiofs).
How can I achieve this @jandubois? Plainly setting the mountType in the lima.yaml yields errors:
+ limactl start ./lima/lima.yaml --name lima --tty=false '--set=.cpus = 6 | .memory = "10GiB" | .disk = "60GiB" | .arch = "aarch64" | .vmType = "qemu" '
WARN[0000] Non-strict YAML detected; please check for typos comment=/Users/USER/code_/team/hack/lima/lima.yaml error="[50:3] unknown field \"mountType\"\n 47 | mounts:\n 48 | - location: \"{{.Home}}\"\n 49 | writable: true\n> 50 | mountType: reverse-sshfs\n ^\n 51 | - location: \"/tmp/lima\"\n 52 | writable: true\n 53 | # - location: \"{{.Home}}/code_\"\n 54 | "
mounts:
- location: "{{.Home}}"
writable: true
mountType: reverse-sshfs
- location: "/tmp/lima"
writable: true
Found it: https://lima-vm.io/docs/config/mount/#reverse-sshfs
mountType: "reverse-sshfs"
mounts:
- location: "{{.Home}}"
writable: true
Seems to have done the trick! Do we need to document this for users somehow so that people don't hit this like I did?
Why did it not mount with virtiofs? Was there any error in the logs?
It is natural for the mount point to be created as an empty directory
The same issue is occurring.
Even if I don’t explicitly specify mountType or if I set mountType: virtiofs, the host-side $HOME is not mounted.
The log output from limactl start default --debug does not contain any information related to the mount.
When I set mountType: "reverse-sshfs", it works as expected:
vmType: vz
arch: "aarch64"
#mountType: virtiofs
mountType: "reverse-sshfs"
mounts:
- location: "~"
- location: "/tmp/lima"
writable: true
macOS 15.6.1 lima version 1.2.1