Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git: "fatal: fsync error Permission denied" #3556

Closed
atlefren opened this issue Sep 20, 2018 · 47 comments
Closed

git: "fatal: fsync error Permission denied" #3556

atlefren opened this issue Sep 20, 2018 · 47 comments
Assignees

Comments

@atlefren
Copy link

  • 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 [email protected]: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

@dominicsayers
Copy link

dominicsayers commented Sep 23, 2018

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

@Deadpoolddt
Copy link

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

git clone [email protected]: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

@benhillis benhillis added the bug label Oct 1, 2018
@benhillis benhillis assigned benhillis and SvenGroot and unassigned benhillis and SvenGroot Oct 1, 2018
@benhillis
Copy link
Member

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

@dannyk81
Copy link

dannyk81 commented Oct 4, 2018

@SvenGroot @benhillis any workaround for this perhaps that you can share? 🙏

@benhillis
Copy link
Member

@dannyk81 - Working outside of DrvFs would be a workaround, or reverting to an earlier Insider build (or 1803 / 1809).

@dannyk81
Copy link

dannyk81 commented Oct 5, 2018

Thanks @benhillis I've moved this repo to the lxfs and it works fine, looking forward for the fix 🙏

@atlefren
Copy link
Author

atlefren commented Oct 5, 2018

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

@dominicsayers
Copy link

I've gone back to working in a HyperV VM :-(

@nocko
Copy link

nocko commented Oct 5, 2018

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

@dinfyru
Copy link

dinfyru commented Oct 8, 2018

+1
Windows 10 Insider Preview 18252.1000 (rs_prerelease)

@neoadventist
Copy link

oh man this is sad.

@khuongduybui
Copy link

khuongduybui commented Oct 9, 2018

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.

@kaiwoods
Copy link

kaiwoods commented Oct 11, 2018

Confirming the issue on rs_prerelease (18252.1000) - I seem to experience it when cloning down and when using git pull.

I've been doing as @khuongduybui and just cloning into a directory in the linux filesystem and then moving it into my symlinked /mnt directory (I have /srv/sites symlinked to a Sites/ directory in my Windows user folder) and this works just fine.

One extra step, but it means I can stick to my setup!

@dannyk81
Copy link

pull started failing for me too...

$ git pull
remote: Counting objects: 148, done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 105 (delta 73), reused 0 (delta 0)
Receiving objects: 100% (105/105), 9.78 KiB | 133.00 KiB/s, done.
Resolving deltas: 100% (73/73), completed with 23 local objects.
fatal: fsync error on '.git/objects/pack/tmp_pack_VmGVIF': Permission denied
fatal: index-pack failed

@AndyGauge
Copy link

AndyGauge commented Oct 11, 2018

I've attempted to clone the repository in the linux FS and move it onto /mnt, but git thinks all of the files have been modified.

Even after git reset --hard and git clean -fx and git stash

git diff

old mode 100644
new mode 100755

chmod -R 644 *
ls -la

-rwxrwxrwx ...

I can't even chmod files anymore (probably couldn't before actually, as this is NTFS)

@AlexGamezo
Copy link

Line endings are a pain. Had the same issue.

@orozco30
Copy link

$ git pull
remote: Counting objects: 148, done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 105 (delta 73), reused 0 (delta 0)
Receiving objects: 100% (105/105), 9.78 KiB | 133.00 KiB/s, done.
Resolving deltas: 100% (73/73), completed with 23 local objects.
fatal: fsync error on '.git/objects/pack/tmp_pack_VmGVIF': Permission denied
fatal: index-pack failed

@Habitats
Copy link

Anyone figured out a workaround? Or ETA on fix?

@dannyk81
Copy link

@Habitats workaround is described here: #3556 (comment)

Only solution now is to not use git over the DrvFS mount (/mnt)

@mqudsi
Copy link

mqudsi commented Oct 13, 2018

The workaround is to alias git to git.exe :)

@atlefren
Copy link
Author

@mqudsi I assume this is a joke, right?

@mqudsi
Copy link

mqudsi commented Oct 15, 2018

No, it’s not. It won’t work outside of /mnt/ but it works around the problem otherwise.

@atlefren
Copy link
Author

@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...

@benhillis
Copy link
Member

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

@dannyk81
Copy link

dannyk81 commented Oct 17, 2018 via email

@inigopascall
Copy link

+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...

@benhillis
Copy link
Member

Fixed in 18267.

@dannyk81
Copy link

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

@ioweb-gr
Copy link

I'm still getting errors in 18267 when cloning a repo in a /mnt directory so if other members can confirm this issue is gone in 18267 then #3607 is not a duplicate of this one and should probably be reopened

/mnt/g# git clone https://github.com/AmauriC/tarteaucitron.js.git
Cloning into 'tarteaucitron.js'...
remote: Enumerating objects: 1504, done.
fatal: Unable to create temporary file '/mnt/g/tarteaucitron.js/.git/objects/pack/tmp_pack_XXXXXX': Permission denied
fatal: index-pack failed

@non1979
Copy link

non1979 commented Oct 27, 2018

still got problems in 18267 (ubuntu 16.04)

non@10PC:/mnt/f$ mkdir los16
non@10PC:/mnt/f$ cd los16
non@10PC:/mnt/f/los16$ repo init -u git://github.com/LineageOS/android.git -b lineage-16.0
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
fatal: cloning the git-repo repository failed, will remove '.repo/repo'

$ cat /proc/version
Linux version 4.4.0-18267-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #1001-Microsoft Sat Oct 20 19:08:00 PST 2018
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial

Tried 18.04, the same problems
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
fatal: could not set 'core.filemode' to 'false'
fatal: could not create /mnt/f/los16/.repo/repo
fatal: cloning the git-repo repository failed, will remove '.repo/repo'

@inigopascall
Copy link

Possibly a noob question, but how do I update to 18267; Do I need to be on the Windows Insider Program, or is there some other way to do this manually? I'm currently on Windows 10 version 1803.

@khuongduybui
Copy link

Yes you do need to be on Insider Fast ring.
Or you can download the ISO on the internet and update your Windows, but that's is NOT recommended or supported. Use at your own risk.

@Uldiniad
Copy link

still got problems in 18267 (ubuntu 16.04)

non@10PC:/mnt/f$ mkdir los16
non@10PC:/mnt/f$ cd los16
non@10PC:/mnt/f/los16$ repo init -u git://github.com/LineageOS/android.git -b lineage-16.0
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
fatal: cloning the git-repo repository failed, will remove '.repo/repo'

$ cat /proc/version
Linux version 4.4.0-18267-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #1001-Microsoft Sat Oct 20 19:08:00 PST 2018
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial

Tried 18.04, the same problems
error: chmod on /mnt/f/los16/.repo/repo/.git/config.lock failed: Operation not permitted
fatal: could not set 'core.filemode' to 'false'
fatal: could not create /mnt/f/los16/.repo/repo
fatal: cloning the git-repo repository failed, will remove '.repo/repo'

@non1979 you are not supposed to use mnt. download to folders within the subsystem https://forum.xda-developers.com/android/software-hacking/guide-how-to-build-lineageos-15-1-t3750175

@MikePach
Copy link

MikePach commented Feb 27, 2019

for me i found out why it would still error out in later versions of Insider
i found that if i cloned/push/pull on my internal drive (formatted ntfs) it would work fine
if i tried it on a flash drive (exfat) it fails with permission failed. (further checked by formatting it as ntfs and that solved the issue with the drive)
my theory is that its a drive format filesystem specific issue now (as the issue that surrounded with ntfs was fixed)

@ioweb-gr
Copy link

I can confirm it's the same for me. I just formatted a drive in drvfs as NTFS and it works but it's broken for other filesystems that it used to work on.

@ttimasdf
Copy link

ttimasdf commented Feb 2, 2020

I've gotten into the same problem, finally found that (in my case) it's the Windows Defender problem. A feature rather than a bug.

I've enabled Controlled folder access inside Windows Defender allowing only a whitelist of program to modify the content of My Documents. None of the programs inside WSL is put into my list. If a normal Windows program trying to modify the protected folder, Windows Defender will show a notification that the file operation is blocked. However, if I modify the protected file inside WSL it will just silently failed! After I turning off ransomware protection temporarily, the file operation works again.

So, the same for you all, the fsync error maybe an antivirus problem. Try to disable it and try again.

@gund
Copy link

gund commented Feb 24, 2020

I've got the same errors and turns out it's Vscode in WSL that causes this issues.
It's called folder pinning and there is an issue in either Vscode or WSL somewhere that tracks this bug but in general when you open a folder in Vscode under WSL it blocks some folders access and permissions are failing even on windows side.

If you close Vscode - then permissions are back online =)

EDIT: This is the issue described in Vscode and it has a workaround: https://code.visualstudio.com/docs/remote/wsl#_i-see-eaccess-permission-denied-error-trying-to-rename-a-folder-in-the-open-workspace

@zinefer
Copy link

zinefer commented Apr 19, 2020

I am running into this error on 18363:

git clone [email protected]: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.

@Beguiled
Copy link

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.

@taro-ball
Copy link

running into same issue on 2004 (19041.572)
ffs it's over 2 years already and still hasn't been fixed???

@taro-ball
Copy link

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

@clementbiron
Copy link

error: insufficient permission for adding an object to repository database .git/objects

This does not seem to me to be corrected either, does there exist a workaround ?

@therealkenc
Copy link
Collaborator

This one went fixininsiderbuilds Oct 2018, 18267

To the extent interested parties would like to open a new issue following the template, please ensure you've got (1) metadata enabled, (2) that the submission has a CLI reproduction step sequence that will execute when pasted into a terminal, (3) that the current working directory of any relative paths is indicated in the steps, and, (4) that the submission includes a link to a gist of a threaded strace(1) log.

Noting that error: insufficient permission for adding an object to repository database .git/objects is not the same error as fatal: fsync error on '/mnt/d/code/repo/.git/objects/pack/tmp_idx_QfTqP5': Permission denied.

@clementbiron
Copy link

Ok thanks 🤗

@xobs
Copy link

xobs commented May 24, 2021

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.

@amit133
Copy link

amit133 commented Jun 11, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests