WSL: git: "fatal: fsync error Permission denied"

  • Your Windows build number: Microsoft Windows [Version 10.0.18234.1000]

  • What you’re doing and what’s happening:

atlefren@atlsve-M4800:/mnt/d/code$ git --version git version 2.7.4 atlefren@atlsve-M4800:/mnt/d/code$ git clone git@ssh.dev.azure.com:v3/path/to/repo Cloning into ‘repo’…

path/to/repo is of course edited

… remote: Found 319 objects to send. (11 ms) Receiving objects: 100% (319/319), 186.51 KiB | 0 bytes/s, done. Resolving deltas: 100% (132/132), done. fatal: fsync error on ‘/mnt/d/code/repo/.git/objects/pack/tmp_idx_QfTqP5’: Permission denied fatal: index-pack failed atlefren@atlsve-M4800:/mnt/d/code$

  • What’s wrong / what should be happening instead:

The permission denied part and the fact that repo is not cloned.

I get the same error when doing a git pull on an existing repo. However, this does not happen with all repos.

I recently edited the /etc/wsl.conf file to contain this:

[interop]
enabled=false # enable launch of Windows binaries; default is true
appendWindowsPath=false # append Windows path to $PATH variable; default is true

[automount]
options=case=off

the windows drives are mapped like so:

atlefren@atlsve-M4800:/mnt/d/code$ mount
rootfs on / type lxfs (rw,noatime)
root on /root type lxfs (rw,noatime)
home on /home type lxfs (rw,noatime)
data on /data type lxfs (rw,noatime)
cache on /cache type lxfs (rw,noatime)
mnt on /mnt type lxfs (rw,noatime)
none on /dev type tmpfs (rw,noatime,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,gid=5,mode=620)
none on /run type tmpfs (rw,nosuid,noexec,noatime,mode=755)
none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,noatime)
none on /run/shm type tmpfs (rw,nosuid,nodev,noatime)
none on /run/user type tmpfs (rw,nosuid,nodev,noexec,noatime,mode=755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noatime)
C:\ on /mnt/c type drvfs (rw,relatime,uid=1000,gid=1000,case=off)
D:\ on /mnt/d type drvfs (rw,relatime,uid=1000,gid=1000,case=off)

Also: git clone of the same repo works fine /home/atlefren and works fine on Windows using git on windows. Guess it’s related to the mounting in some way. Problem appeared after updating Windows and adding the [interop]-part to /etc/wsl.conf

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 18
  • Comments: 47 (4 by maintainers)

Most upvoted comments

I noticed this only affects /mnt folders (at least for me)

We have identified the issue and @SvenGroot is working on a fix. Thanks for filing the issue.

Fixed in 18267.

The workaround is to alias git to git.exe 😃

Ugh, painful bug. I hope the fix goes out quickly.

Having the same error in Version 1809 build 18242.1000 and mounted drives to “/” instead

git clone git@bitbucket.org:myrepo/myproject.git
Cloning into 'myproject'...
remote: Counting objects: 15, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 15 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (15/15), 4.16 KiB | 236.00 KiB/s, done.
fatal: fsync error on '/d/dev/projects/myproject/.git/objects/pack/tmp_idx_oQEgk4': Permission denied
fatal: index-pack failed

Mounted as such:

rootfs on / type lxfs (rw,noatime)
none on /dev type tmpfs (rw,noatime,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,gid=5,mode=620)
none on /run type tmpfs (rw,nosuid,noexec,noatime,mode=755)
none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,noatime)
none on /run/shm type tmpfs (rw,nosuid,nodev,noatime)
none on /run/user type tmpfs (rw,nosuid,nodev,noexec,noatime,mode=755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noatime)
C:\ on /c type drvfs (rw,noatime,uid=1000,gid=1000,umask=22,fmask=11,metadata,case=off)
D:\ on /d type drvfs (rw,noatime,uid=1000,gid=1000,umask=22,fmask=11,metadata,case=off)

Also I’m using this wsl.conf (if helps)

[automount]
enabled = true
root = /
options = "metadata,umask=22,fmask=11"
mountFsTab = false

Thanks @benhillis, just upgraded to 18267 and issue is gone 👏

@dannyk81 - Looks like the fix for this issue just missed the 18262 build. I suspect the fix will be in next week’s build.

I’ve only seen this problem when cloning. Pulling and pushing work just fine. So I’ve been cloning outside /mnt then move the whole thing over. In rare cases I have had to run git clone from Windows. Again pulling and pushing work just fine for me.

“repo sync” command failed with permission denied message. I opened the Ubuntu as an administrator and it works fine now.

I arrived on this page after doing an Internet search because I was experiencing Permission denied errors when attempting to use repo. For example:

Fetching:  0% (0/14) warming uperror: Cannot fetch fsl-community-bsp-base (Error: [(<DirEntry 'heads'>, '/mnt/d/Code/Ion/Yocto/imx-yocto-bsp/.repo/projects/sources/base.git/refs/heads', "[Errno 13] Permission denied: '/mnt/d/Code/Ion/Yocto/imx-yocto-bsp/.repo/projects/sources/base.git/refs/heads'"), (<DirEntry 'tags'>, '/mnt/d/Code/Ion/Yocto/imx-yocto-bsp/.repo/projects/sources/base.git/refs/tags', "[Errno 13] Permission denied: '/mnt/d/Code/Ion/Yocto/imx-yocto-bsp/.repo/projects/sources/base.git/refs/tags'"), ('/mnt/d/Code/Ion/Yocto/imx-yocto-bsp/.repo/project-objects/fsl-community-bsp-base.git/refs', '/mnt/d/Code/Ion/Yocto/imx-yocto-bsp/.repo/projects/sources/base.git/refs', "[Errno 13] Permission denied: '/mnt/d/Code/Ion/Yocto/imx-yocto-bsp/.repo/projects/sources/base.git/refs'")])

The solution was to to to the Windows side add Everyone to the newly-created Yocto directory and give them Full control. After doing this, repo sync was able to successfully update from WSL1.

I’m posting this here in case it helps anyone else who runs into a similar problem.

@therealkenc i’m running the latest windows, and it doesn’t look like this has been fixed

Came here to also state I see this in 1909 (18363.815)

error: insufficient permission for adding an object to repository database .git/objects
error: .gitignore: failed to insert into database
error: unable to index file .gitignore
fatal: adding files failed

This is on a drive mounted to a network share with full r/w. All files in the share list as owned by root:root and have full 777 permissions by default.

I am running into this error on 18363:

git clone git@github.com:microsoft/WSL.git
Cloning into 'WSL'...
remote: Enumerating objects: 37, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (33/33), done.
fatal: Unable to create temporary file '/mnt/files/WSL/.git/objects/pack/tmp_pack_XXXXXX': Permission denied
fatal: index-pack failed

Unsure if related but I cannot get the metadata option to work with my network shares. It just seems to swallow the option (does not show up in mounts -l). However, I am able to get a metadata option for the automounts.

+1 for this. Please fix, this is a massive pain in the ass.

If it helps anyone, the only solution I’ve found is to restart my machine, then it works…

@mqudsi So basically running windows git on WSL? I’ve removed all the windows binaries from my WSL PATH, so no option for me. But, yeah, why not?

On the other hand: this issue will hopefully be resolved soon…

oh man this is sad.

I’ve gone back to working in a HyperV VM 😦

As I need to access the repo from windows my temporary solution is to use git on windows to clone the repo, seems like git on wsl still works for most other things