Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

Writing to a host folder inside a Lima VM fails because it is read-only

ErrorA host folder mounted in the Lima VM cannot be written to from inside the VM

Short answer

Lima's builtin default for a mount is writable: false, and the default template mounts your home folder read-only. Writes into it from the VM fail. Edit the instance, set writable: true on the mount you need, and restart. Remember the VM's own home directory is not your host home.

  • Applies to Lima 1.2, macOS 15 or 26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open the instance configuration and read the mounts block and the mountType line. Replace default with your instance name.

    limactl edit default
  2. 2Match what you see, then jump to its fix

    1. 1The mount entry has no writable key, or writable: falseThe mount is not writable, which is the defaultFix
    2. 2The path is under /home/<user>.linux or a similar path that is not in the mounts listYou are writing to the VM's home, not the mounted host homeFix

What does the error look like?

  • A host folder mounted in the Lima VM cannot be written to from inside the VM
  • Container or database data directory on a Lima mount fails to write

Cause 1 of 2

The mount is not writable, which is the default

1Check

The Lima default template says the builtin default for writable is false, and the home mount is read-only. Check the entry for the folder you write to.

limactl edit default

2Fix

Set writable: true on that mount only, not on a broad folder. Lima discourages writable true with the reverse-sshfs mount type, so prefer 9p or virtiofs where your setup allows.

mounts:
  - location: "~/projects"
    writable: true

3Verify

Restart the instance, then write a file from inside the VM and look for it on the host.

limactl restart default
limactl shell default
# inside the VM:
touch ~/projects/probe.txt

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 2

You are writing to the VM's home, not the mounted host home

1Check

The Lima template notes that the user's home inside the VM is not the mounted home directory of the host. A path that matches no mount lives on the VM's own disk and is unrelated to the host folder.

limactl shell default
# inside the VM:
echo $HOME; df -h $HOME

2Fix

Work in a path that is listed under mounts, or add the host folder as a mount. Avoid overlapping mounts such as ~ and ~/src, which the template says are not supported.

mounts:
  - location: "~/src/my-app"
    writable: true

3Verify

Create a file in the folder inside the VM and see it on the host.

limactl shell default
# inside the VM:
ls -l ~/src/my-app

Confirmed by raw.githubusercontent.com

Did this fix it?

How do I stop it coming back?

  • Mount only the folders a project needs, and make only those writable.
  • Keep database data directories on the VM's own disk and mount only source code.
  • Do not mount overlapping folders.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.