Repository: iterative/dvc

Issue:
[HELP] Error when installing dvc, in Gdrive from Colab
# Bug Report

<!--
## Issue name

Issue names must follow the pattern `command: description` where the command is the dvc command that you are trying to run. The description should describe the consequence of the bug. 

Example: `repro: doesn't detect input changes`
-->

## Description
Hi everyone!
I am a student and I am starting in the field of data science, I hope you can help me, since I can not start the work environment.

Describe the current behavior:
I am installing dvc in the project that is hosted on drive and executed from colab.
When executing the line of code
'! dvc run -n prepare \
          -p prepare.seed, prepare.split \
          -d src / prepare.py -d data / data.xml \
          -o data / prepared \
          python src / prepare.py data / data.xml '
Extracted from the site:
https://dvc.org/doc/user-guide/setup-google-drive-remote

When running the tebngo command as a result

ERROR: Could not transfer 'md5: 6f597d341ceb7d8fbbe88859a892ef81' - [Errno 38] Function not implemented: '/ content / drive / My Drive / test_dvc_01 / data / ready / test.tsv' -> '/ content / drive / My Drive / test_dvc_01 /.dvc/cache/6f/597d341ceb7d8fbbe88859a892ef81 '
ERROR: Could not transfer 'md5: 32b715ef0d71ff4c9e61f55b09c15e75' - [Errno 38] Function not implemented: '/ content / drive / My Drive / test_dvc_01 / data / ready / train.tsv' -> '/ content / drive / My Drive / test_dvc_01 /.dvc/cache/32/b715ef0d71ff4c9e61f55b09c15e75 '
ERROR: could not load 'memory: //dvc-staging/bafae8ce6c348783d151e57a746d04ed8538943da267b8be4dcd571daa531b74/20/b786b6e6f80e2b3fcf17827ad18597.dir content' avc / drive / drive content /.
ERROR: 3 files could not be transferred

That from the analyzed it may be the space in the MyDrive folder, could you help me, I am a DC & IA student and I cannot start the project.
Thank you.
Octavio

<!--
A clear and concise description of what the bug is.
-->

### Reproduce

<!--
Step list of how to reproduce the bug
-->
1 - from google.colab import drive
drive.mount('/content/drive')
2 - %cd /content/drive/MyDrive
3 - !git init
4 -
! git config --global user.email "xxxxx.cba@gmail.com" #MAIL DE LOGIN
! git config --global user.name "xxxxxx" #NOMBRE EL PERFIL NO ES TAN RELEVANTE
!git clone https://github.com/xxxxxx/test_dvc_01.git

5 -  %cd test_dvc_01/ 
6 - !pip install dvc
7 -  !dvc init -f
8 - !dvc get https://github.com/iterative/dataset-registry \
          get-started/data.xml -o data/data.xml
9 - !dvc remote add -f proyecto01 gdrive://TOKEN
10 - !dvc push 
11 - !wget https://code.dvc.org/get-started/code.zip
!unzip code.zip
!rm -f code.zip
!tree 
12 - !pip install -r src/requirements.txt
13 - 
!dvc run -n prepare \
          -p prepare.seed,prepare.split \
          -d src/prepare.py -d data/data.xml \
          -o data/prepared \
          python src/prepare.py data/data.xml 

point 13 gives an error

Error:```

Running stage 'prepare':
> python src/prepare.py data/data.xml
Computing file/dir hashes (only done once)          |0.00 [00:00,      ?md5/s]
!
  0%|          |                                   0.00/? [00:00<?,        ?B/s]
                                                                                
!
  0%|          |                                   0.00/? [00:00<?,        ?B/s]
ERROR: failed to transfer 'md5: 6f597d341ceb7d8fbbe88859a892ef81' - [Errno 38] Function not implemented: '/content/drive/My Drive/test_dvc_01/data/prepared/test.tsv' -> '/content/drive/My Drive/test_dvc_01/.dvc/cache/6f/597d341ceb7d8fbbe88859a892ef81'
ERROR: failed to transfer 'md5: 32b715ef0d71ff4c9e61f55b09c15e75' - [Errno 38] Function not implemented: '/content/drive/My Drive/test_dvc_01/data/prepared/train.tsv' -> '/content/drive/My Drive/test_dvc_01/.dvc/cache/32/b715ef0d71ff4c9e61f55b09c15e75'
ERROR: failed to upload 'memory://dvc-staging/bafae8ce6c348783d151e57a746d04ed8538943da267b8be4dcd571daa531b74/20/b786b6e6f80e2b3fcf17827ad18597.dir' to '/content/drive/My Drive/test_dvc_01/.dvc/cache/20/b786b6e6f80e2b3fcf17827ad18597.dir'
ERROR: 3 files failed to transfer
```

<!--
Example:

1. dvc init
2. Copy dataset.zip to the directory
3. dvc add dataset.zip
4. dvc run -d dataset.zip -o model ./train.sh
5. modify dataset.zip
6. dvc repro
-->

### Expected

I hope I can finish executing the sentences to start working.




Discussion:
This is failing when dvc tries to hardlink. cc @efiop. 
```console
!echo foo > "foo"
!dvc run -vv -n copy -d foo -o bar "cat foo foo > bar"
```

<details>
<summary>Trace log</summary>

```
2021-11-11 04:07:40,975 TRACE: Namespace(always_changed=False, cd='.', checkpoints=[], cmd=['cat foo foo > bar'], cprofile=False, cprofile_dump=None, deps=['foo'], desc=None, external=False, file=None, force=False, func=<class 'dvc.command.run.CmdRun'>, instrument=False, instrument_open=False, live=None, live_no_cache=None, live_no_html=False, live_no_summary=False, metrics=[], metrics_no_cache=[], name='copy', no_commit=False, no_exec=False, no_run_cache=False, outs=['bar'], outs_no_cache=[], outs_persist=[], outs_persist_no_cache=[], params=[], pdb=False, plots=[], plots_no_cache=[], quiet=0, single_stage=False, verbose=2, version=None, wdir=None, yappi=False)
2021-11-11 04:07:41,794 DEBUG: Removing output 'bar' of stage: 'copy'.
2021-11-11 04:07:41,795 DEBUG: Removing 'bar'
2021-11-11 04:07:41,822 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,848 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,855 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,855 DEBUG: state save (745, 1636603660000000000, 4) d3b07384d113edec49eaa6238ad5ff00
2021-11-11 04:07:41,860 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,861 DEBUG: state save (745, 1636603660000000000, 4) d3b07384d113edec49eaa6238ad5ff00
2021-11-11 04:07:41,865 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,869 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,871 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,872 DEBUG: state save (745, 1636603660000000000, 4) d3b07384d113edec49eaa6238ad5ff00
2021-11-11 04:07:41,873 DEBUG: {'foo': 'modified'}
2021-11-11 04:07:41,876 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,881 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,883 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,883 DEBUG: state save (745, 1636603660000000000, 4) d3b07384d113edec49eaa6238ad5ff00
2021-11-11 04:07:41,906 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,910 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,913 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,913 DEBUG: state save (745, 1636603660000000000, 4) d3b07384d113edec49eaa6238ad5ff00
2021-11-11 04:07:41,961 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,963 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,964 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:41,964 DEBUG: state save (745, 1636603660000000000, 4) d3b07384d113edec49eaa6238ad5ff00
Running stage 'copy':
> cat foo foo > bar
2021-11-11 04:07:42,066 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:42,131 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:42,134 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:42,135 DEBUG: state save (745, 1636603660000000000, 4) d3b07384d113edec49eaa6238ad5ff00
2021-11-11 04:07:42,152 DEBUG: Adding 'bar' to '.gitignore'.
2021-11-11 04:07:42,160 TRACE: Path 'bar' inode '1042'
2021-11-11 04:07:42,161 TRACE: Path 'bar' inode '1042'
2021-11-11 04:07:42,165 TRACE: Path 'bar' inode '1042'
2021-11-11 04:07:42,166 DEBUG: state save (1042, 1636603662000000000, 8) 5fb7ba7e8447a836e774b66155f5776a
2021-11-11 04:07:42,176 TRACE: Path 'bar' inode '1042'
2021-11-11 04:07:42,177 DEBUG: state save (1042, 1636603662000000000, 8) 5fb7ba7e8447a836e774b66155f5776a
2021-11-11 04:07:42,181 DEBUG: Computed stage: 'copy' md5: '5cb3158cb072d7cf0c8fe58f056bc19a'
2021-11-11 04:07:42,182 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:42,185 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:42,187 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:42,187 DEBUG: state save (745, 1636603660000000000, 4) d3b07384d113edec49eaa6238ad5ff00
2021-11-11 04:07:42,195 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:42,201 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:42,203 TRACE: Path 'foo' inode '745'
2021-11-11 04:07:42,204 DEBUG: state save (745, 1636603660000000000, 4) d3b07384d113edec49eaa6238ad5ff00
2021-11-11 04:07:42,226 TRACE: Path 'bar' inode '1042'
2021-11-11 04:07:42,233 DEBUG: Preparing to transfer data from 'memory://dvc-staging/7b5ee8727839c074b81ad1d617fe13e627d8fbdc739c70366ef9e33ca74e772a' to '.dvc/cache'
2021-11-11 04:07:42,233 DEBUG: Preparing to collect status from '.dvc/cache'
2021-11-11 04:07:42,233 DEBUG: Collecting status from '.dvc/cache'
2021-11-11 04:07:42,236 DEBUG: Preparing to collect status from 'memory://dvc-staging/7b5ee8727839c074b81ad1d617fe13e627d8fbdc739c70366ef9e33ca74e772a'
2021-11-11 04:07:42,287 ERROR: failed to transfer 'md5: 5fb7ba7e8447a836e774b66155f5776a' - [Errno 38] Function not implemented: '/content/drive/My Drive/test_dvc/bar' -> '/content/drive/My Drive/test_dvc/.dvc/cache/5f/b7ba7e8447a836e774b66155f5776a'
------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/dvc/objects/transfer.py", line 25, in wrapper
    func(path_info, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/dvc/objects/transfer.py", line 164, in func
    hardlink=hardlink,
  File "/usr/local/lib/python3.7/dist-packages/dvc/objects/db/base.py", line 117, in add
    self._add_file(fs, path_info, cache_info, hash_info, hardlink=hardlink)
  File "/usr/local/lib/python3.7/dist-packages/dvc/objects/db/base.py", line 94, in _add_file
    hardlink=hardlink,
  File "/usr/local/lib/python3.7/dist-packages/dvc/fs/utils.py", line 55, in transfer
    return _link(from_fs, from_info, to_fs, to_info, hardlink=hardlink)
  File "/usr/local/lib/python3.7/dist-packages/dvc/fs/utils.py", line 36, in _link
    return func(from_info, to_info)
  File "/usr/local/lib/python3.7/dist-packages/dvc/fs/local.py", line 154, in hardlink
    System.hardlink(from_info, to_info)
  File "/usr/local/lib/python3.7/dist-packages/dvc/system.py", line 40, in hardlink
    os.link(src, link_name)
OSError: [Errno 38] Function not implemented: '/content/drive/My Drive/test_dvc/bar' -> '/content/drive/My Drive/test_dvc/.dvc/cache/5f/b7ba7e8447a836e774b66155f5776a'
------------------------------------------------------------
2021-11-11 04:07:42,356 ERROR: 1 files failed to transfer
------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/dvc/command/run.py", line 46, in run
    self.repo.run(**kwargs)
  File "/usr/local/lib/python3.7/dist-packages/dvc/repo/__init__.py", line 50, in wrapper
    return f(repo, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/dvc/repo/scm_context.py", line 14, in run
    return method(repo, *args, **kw)
  File "/usr/local/lib/python3.7/dist-packages/dvc/repo/run.py", line 33, in run
    stage.run(no_commit=no_commit, run_cache=run_cache)
  File "/usr/local/lib/python3.7/dist-packages/funcy/decorators.py", line 45, in wrapper
    return deco(call, *dargs, **dkwargs)
  File "/usr/local/lib/python3.7/dist-packages/dvc/stage/decorators.py", line 36, in rwlocked
    return call()
  File "/usr/local/lib/python3.7/dist-packages/funcy/decorators.py", line 66, in __call__
    return self._func(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/dvc/stage/__init__.py", line 548, in run
    self.commit(allow_missing=allow_missing)
  File "/usr/local/lib/python3.7/dist-packages/funcy/decorators.py", line 45, in wrapper
    return deco(call, *dargs, **dkwargs)
  File "/usr/local/lib/python3.7/dist-packages/dvc/stage/decorators.py", line 36, in rwlocked
    return call()
  File "/usr/local/lib/python3.7/dist-packages/funcy/decorators.py", line 66, in __call__
    return self._func(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/dvc/stage/__init__.py", line 509, in commit
    out.commit(filter_info=filter_info)
  File "/usr/local/lib/python3.7/dist-packages/dvc/output.py", line 599, in commit
    hardlink=True,
  File "/usr/local/lib/python3.7/dist-packages/dvc/objects/transfer.py", line 174, in transfer
    src, dest, status.new, status.missing, processor, **kwargs
  File "/usr/local/lib/python3.7/dist-packages/dvc/objects/transfer.py", line 115, in _do_transfer
    raise FileTransferError(total_fails)
dvc.exceptions.FileTransferError: 1 files failed to transfer
------------------------------------------------------------
2021-11-11 04:07:42,403 DEBUG: Analytics is enabled.
2021-11-11 04:07:42,473 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp5sh1p1s3']'
2021-11-11 04:07:42,477 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp5sh1p1s3']'
```

</details>


Resolving patch:
diff --git a/dvc/fs/utils.py b/dvc/fs/utils.py
--- a/dvc/fs/utils.py
+++ b/dvc/fs/utils.py
@@ -37,7 +37,11 @@ def _link(
         except RemoteActionNotImplemented:
             continue
         except OSError as exc:
-            if exc.errno not in [errno.EXDEV, errno.ENOTSUP]:
+            if exc.errno not in [
+                errno.EXDEV,
+                errno.ENOTSUP,
+                errno.ENOSYS,  # https://github.com/iterative/dvc/issues/6962
+            ]:
                 raise
 
     raise OSError(errno.ENOTSUP, "reflink and hardlink are not supported")
diff --git a/dvc/objects/checkout.py b/dvc/objects/checkout.py
--- a/dvc/objects/checkout.py
+++ b/dvc/objects/checkout.py
@@ -79,7 +79,7 @@ def _try_links(cache, from_info, to_info, link_types):
             return
 
         except OSError as exc:
-            if exc.errno not in [errno.EXDEV, errno.ENOTSUP]:
+            if exc.errno not in [errno.EXDEV, errno.ENOTSUP, errno.ENOSYS]:
                 raise
             logger.debug(
                 "Cache type '%s' is not supported: %s", link_types[0], exc


Test patch: