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

fdLock invalid argument error on WSL Ubuntu Bionic #6551

Closed
ygale opened this issue Feb 20, 2020 · 13 comments
Closed

fdLock invalid argument error on WSL Ubuntu Bionic #6551

ygale opened this issue Feb 20, 2020 · 13 comments

Comments

@ygale
Copy link
Contributor

ygale commented Feb 20, 2020

Describe the bug

On Ubuntu Bionic running under WSL on Windows 10, after installing cabal-install-3.2 from the hvr PPA:

Every cabal command fails with the following error:

fdLock: invalid argument (Invalid argument)

To Reproduce

Run cabal init, or cabal update or any other cabal command except cabal --version.

I deleted the entire ~/.cabal directory and ran cabal update. Same issue.

System information

  • Operating system: Ubuntu 18.04 (bionic), on WSL 1, on Windows 10
  • cabal versions:
    cabal-install version 3.2.0.0
    compiled using version 3.2.0.0 of the Cabal library
  • ghc version: 8.8.2
@ygale
Copy link
Contributor Author

ygale commented Feb 20, 2020

Looks like cabal is trying to use fcntl(F_SETLK) or similar for locking, via the lukko library. That won't work on WSL 1, see microsoft/WSL#1927.

It seems clear that Microsoft will not fix this. They are focusing on WSL 2, which won't be generally released for at least a few more months.

Is there any way to teach cabal not to use that kind of locking on this platform? Perhaps a flag that lets you override autodetection of what kind of locking to use?

@phadej
Copy link
Collaborator

phadej commented Feb 20, 2020 via email

@ygale
Copy link
Contributor Author

ygale commented Feb 21, 2020

Thanks @phadej . I'll give it a try.

@phadej
Copy link
Collaborator

phadej commented Feb 29, 2020

@ygale any updates?

@phadej
Copy link
Collaborator

phadej commented Mar 11, 2020

Closing this. Turning off ofd-locking might or might not work, but there's nothing to do in Cabal or lukko.

@phadej phadej closed this as completed Mar 11, 2020
@sheaf
Copy link
Collaborator

sheaf commented Mar 17, 2020

To confirm that @phadej's fix works: I added

constraints:
  lukko -ofd-locking

to cabal-install's cabal.project file when building cabal-install. This solved the issue, which I was running into on an Alpine Linux WSL2 distribution.

@sir4ur0n
Copy link

For what it's worth: I had exactly this issue on my WSL 1 system, while building almost any project with Cabal. I just upgraded today to Windows 2004 and WSL 2, and now it seems to work.

In case anybody else wonders if WSL 2 does solve this problem 😄

@July541
Copy link

July541 commented Oct 17, 2020

I met the same problem and have no solution yet:(

@July541
Copy link

July541 commented Oct 17, 2020

I met the same problem and have no solution yet:(

It works after I updated wsl1 to wsl2 :)

@cn-ml
Copy link

cn-ml commented May 24, 2021

For what it's worth: I had exactly this issue on my WSL 1 system, while building almost any project with Cabal. I just upgraded today to Windows 2004 and WSL 2, and now it seems to work.

Thank you, this seems to fix the issue for me. I was running Ubuntu-18.04 on WSL 1. To upgrade it I first got the name of the image:

wsl -l -v

which showed me Ubuntu-18.04 Running 2 and then i ran

wsl --set-version Ubuntu-18.04 2

That took some time, but after that I restarted the Ubuntu shell and everything worked fine. Thank you for the solution, that saved me some time 👍

@Mikolaj
Copy link
Member

Mikolaj commented Nov 5, 2021

@leftaroundabout: How to reproduce your findings?

@leftaroundabout
Copy link

Fresh Debian i386 install, fresh GHC-8.6.5, Cabal HEAD version (5b4258), after running the bootstrap.py following the instructions the resulting cabal executable has the fdLock invalid argument problem discussed here. Nuking the cabal clone, re-cloning, adding the lukko constraints in cabal.project.bootstrap and again bootstrapping did not make any difference.

Ok, I think I got it: the cabal.project.bootstrap isn't actually what matters to the bootstrap (?) and the flag instead needs to be set in bootstrap/linux-8.6.5.json. After changing

      ...
      "package": "lukko"
      ...
      "flags": [
        "+ofd-locking"
      ]

to

      "flags": [
        "-ofd-locking"
      ]

in the JSON file, the fdLock issue is gone.

@Mikolaj
Copy link
Member

Mikolaj commented Nov 5, 2021

Congratulations! Indeed bootstrap/README.md confirms this project file is used to create bootstrap data for new architectures and that's how it's used in the Makefile.

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

8 participants