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

[Bug?]: Error: EXDEV: cross-device link not permitted #6457

Open
1 task
Climenty opened this issue Aug 12, 2024 · 5 comments
Open
1 task

[Bug?]: Error: EXDEV: cross-device link not permitted #6457

Climenty opened this issue Aug 12, 2024 · 5 comments
Labels
bug Something isn't working waiting for feedback Will autoclose in a while unless more data are provided

Comments

@Climenty
Copy link

Self-service

  • I'd be willing to implement a fix

Describe the bug

Any yarn dlx command ends with error on Linux because it tries to link tmp file system and local one.

To reproduce

yarn dlx @yarnpkg/sdks vscode (for example)

Result:

➤ YN0000: · Failed with errors in 3s 660ms                                        
node:internal/process/promises:391                                                
    triggerUncaughtException(err, true /* fromPromise */);
    ^                                                                             
[Error: EXDEV: cross-device link not permitted, link '/home/xxx/.yarn/berry/i
ndex/52/5220208b882bf713918c25d953de5127c523db71.dat' -> '/tmp/xfs-3c6297d8/dlx-30
676/node_modules/.store/@yarnpkg-sdks-npm-3.2.0-03b1f3c8a8/package/README.md'] {
  errno: -18,                                                                     
  code: 'EXDEV',                                                                  
  syscall: 'link',                                                                
  path: '/home/xxx/.yarn/berry/index/52/5220208b882bf713918c25d953de5127c523db71.dat',
  dest: '/tmp/xfs-3c6297d8/dlx-30676/node_modules/.store/@yarnpkg-sdks-npm-3.2.0-03b1f3c8a8/package/README.md'                                                      
}

Environment

System:
Linux OpenSuse Leap 15.6 (6.4.0 kernel)
Binaries:
Node.js v20.15.1
Yarn 4.4.0

Additional context

It is really simple error, read how-to-fix-nodejs-error-exdev for workaround.

@Climenty Climenty added the bug Something isn't working label Aug 12, 2024
@clemyan
Copy link
Member

clemyan commented Sep 17, 2024

Looks like a duplicate of #6497? See #6497 (comment)

@clemyan clemyan added the waiting for feedback Will autoclose in a while unless more data are provided label Sep 17, 2024
@Climenty
Copy link
Author

Climenty commented Sep 17, 2024

Looks like a duplicate of #6497? See #6497 (comment)

Yes, the source of problem is the same - hardlinks. But we should not use links between temporary folder and any other at all, cause temporary partition may has different file system by design.

@yarnbot
Copy link
Collaborator

yarnbot commented Oct 17, 2024

Hi! 👋

It seems like this issue as been marked as probably resolved, or missing important information blocking its progression. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it.

@yarnbot yarnbot added the stale Issues that didn't get attention label Oct 17, 2024
@clemyan
Copy link
Member

clemyan commented Oct 22, 2024

The problem is you are explicitly requesting two conflicting constraints for Yarn:

  1. Hardlink all packages to the global store
  2. Install this package into the temp folder

Do we ignore one of them? If so, which one?

If we ignore 1, all dlx calls will use up much more space in the temp folder. This may be unexpected to the user given they expect packages to hardlink to the global store, and may cause problems given that some systems do not clean the temp folder by default.

If we ignore 2, then where do we install the package?


In more general terms, the problem is using an install strategy that involves hardlinking to a global store system-wide, when projects on that system are spread across multiple devices.

FWIW pnpm also suffers from it, but they solved it simply by having multiple stores. Personally I don't think just putting stuff everywhere is a great solution, especially given that it is happening silently.

Maybe we can add a config for users to opt into that behavior?

cc @frg2089

@yarnbot yarnbot removed the stale Issues that didn't get attention label Oct 22, 2024
@Climenty
Copy link
Author

In more general terms, the problem is using an install strategy that involves hardlinking to a global store system-wide, when projects on that system are spread across multiple devices.

@clemyan, you are absolutely right. This part from pnpm FAQ tells the same: "The package store should be on the same drive and filesystem as installations, otherwise packages will be copied, not linked. This is due to a limitation in how hard linking works, in that a file on one filesystem cannot address a location in another."

The current problem with yarn - trying to use link without checking for error condition. The right behavior - break installation process from the start with warning message that your project and package storage are on different devices/FS and could not be linked.

And the user should decide for himself - move project or storage location. But I want to return to an important point once again. When a user choose another drive for both places, we should NOT use link mechanic from Temp folder to outside, cause it is 100% that temporary folder on another drive (or filesystem volume).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for feedback Will autoclose in a while unless more data are provided
Projects
None yet
Development

No branches or pull requests

3 participants