dvc: error adding a file to dvc repo on NAS storage

DVC version is 0.62.1 installed by pip on Ubuntu.

I have shared NAS storage mounted on my system and want to create a DVC repo in the storage. I could successfully initialized a repo by dvc init command, but adding a file fails with an error message shown below.

$ ls -al
total 0
drwxrwxrwx 2 root root 0 Nov 20  2019 .  <-- has write permission
drwxrwxrwx 2 root root 0 Oct 25 10:37 ..
drwxrwxrwx 2 root root 0 Oct 29 15:30 data  <-- want to add this directory after creating a repo
$ dvc init --no-scm
+---------------------------------------------------------------------+
|                                                                     |
|        DVC has enabled anonymous aggregate usage analytics.         |
|     Read the analytics documentation (and how to opt-out) here:     |
|              https://dvc.org/doc/user-guide/analytics               |
|                                                                     |
+---------------------------------------------------------------------+

What's next?
------------
- Check out the documentation: https://dvc.org/doc
- Get help and share ideas: https://dvc.org/chat
- Star us on GitHub: https://github.com/iterative/dvc
$ ls -al
total 0
drwxrwxrwx 2 root root 0 Nov 20 09:50 .
drwxrwxrwx 2 root root 0 Oct 25 10:37 ..
drwxrwxrwx 2 root root 0 Oct 29 15:30 data
drwxrwxrwx 2 root root 0 Nov 20 09:50 .dvc  <-- repo created successfully
$ dvc add -R data  <-- trying to add the directory recursively
ERROR: unexpected error - [Errno 1] Operation not permitted  <-- failed with an error message which is unclear to find the cause 

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!  <-- made me write this issue
$

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 17 (9 by maintainers)

Most upvoted comments

@skshetry You are right! I tried again with considering your comment, and it turned out the error about dvc version -v was neither caused by the weird FS nor dvc itself. There must be incomplete ‘.git’ directory remained after git init before trying git status and caused the error. Thanks for make it clear.

I should be more precise. Sorry for my misleading report on dvc version command.

@midnightradio, the error in https://github.com/iterative/dvc/issues/2818#issuecomment-555885457 is due to git init earlier. But, anyway, version should quietly work here.

I was able to reproduce the same error with:

temp=$(mktemp -d)
cd $temp
dvc init --no-scm
mkdir .git
dvc version -v

Output is quite similar:

Traceback (most recent call last):
  File "/home/saugat/repos/iterative/dvc/dvc/scm/git/__init__.py", line 52, in __init__
    self.repo = git.Repo(self.root_dir)
  File "/home/saugat/repos/iterative/dvc/.env/py36/lib/python3.6/site-packages/git/repo/base.py", line 184, in __init__
    raise InvalidGitRepositoryError(epath)
git.exc.InvalidGitRepositoryError: /tmp/tmp.hOiYxhj5Wh

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/saugat/repos/iterative/dvc/dvc/main.py", line 49, in main
    ret = cmd.run()
  File "/home/saugat/repos/iterative/dvc/dvc/command/version.py", line 49, in run
    repo = Repo()
  File "/home/saugat/repos/iterative/dvc/dvc/repo/__init__.py", line 87, in __init__
    self.scm = SCM(self.root_dir)
  File "/home/saugat/repos/iterative/dvc/dvc/scm/__init__.py", line 26, in SCM
    return Git(root_dir)
  File "/home/saugat/repos/iterative/dvc/dvc/scm/git/__init__.py", line 55, in __init__
    raise SCMError(msg.format(self.root_dir))
dvc.scm.base.SCMError: /tmp/tmp.hOiYxhj5Wh is not a git repository
------------------------------------------------------------


Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!
ERROR: unexpected error - /tmp/tmp.hOiYxhj5Wh is not a git repository                                                                                   


Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!

/tmp/tmp.hOiYxhj5Wh via py36 
ERROR: unexpected error - /tmp/tmp.hOiYxhj5Wh is not a git repository

Thanks @midnightradio ! I think both issue are pretty valid. It’s a reasonable case when you run dvc add on the attached storage to get data initially under DVC control since it’s large enough to fit into your local disk/space. @efiop will decide if keep this one open or not (since it looks like you have a workaround), but will definitely keep this scenario in mind.

For the version issue - yes, let’s create a separate ticket and if you can contribute the PR that would be awesome 🙏 We’ll try to help you with that.

I think we still should do something about lock. Probably Git is not the best analogy for us in this case.

@midnightradio could you elaborate on your case a little bit please? Why do you want to run the repo on a NAS storage directly?