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

"cabal update" failing with "fdLock: invalid argument" (v1- and v2-) #7442

Closed
rudymatela opened this issue Jun 14, 2021 · 7 comments
Closed

Comments

@rudymatela
Copy link
Contributor

rudymatela commented Jun 14, 2021

cabal update is failing with fdLock: invalid argument (Invalid argument). This is happening to both v1- and v2-.

Reproducing with v1-update

$ rm -r ~/.ghc ~/.cabal  # starting fresh

$ cabal v1-update
Config file path source is default config file.
Config file ~/.cabal/config not found.
Writing default configuration to ~/.cabal/config
fdLock: invalid argument (Invalid argument)

Due to this issue I am not being able to install anything via cabal on my device. Cabal fails to "download-and-unpack" the package database:

$ cabal v1-install leancheck
fdLock: invalid argument (Invalid argument)

Reproducing with v2-update

$ rm -r ~/.ghc ~/.cabal  # starting fresh

$ cabal v2-update
Config file path source is default config file.
Config file ~/.cabal/config not found.
Writing default configuration to ~/.cabal/config
Unexpected response 503 for http://objects-us-east-1.dream.io/hackage-mirror/root.json

$ cabal v2-update
fdLock: invalid argument (Invalid argument)

Due to this issue I am not being able to install anything via cabal on my device. Cabal fails to "download-and-unpack" the package database:

$ cabal v2-install leancheck
fdLock: invalid argument (Invalid argument)

System information

  • 32-bit processor (Intel Atom N270 @ 1.6GHz)
  • Arch Linux 32 (v2021-06-14) with Linux v5.12.9
  • cabal-install v3.2.0.0
  • cabal library v3.2.1.0
  • GHC v8.10.4
  • glibc 2.33-5.1

Using -v

$ cabal v1-update -v 
Trying to locate mirrors via DNS for initial bootstrap of secure repository
'http://hackage.haskell.org/' ...
located 2 mirrors for http://hackage.haskell.org/ :
- http://hackage.fpcomplete.com/
- http://objects-us-east-1.dream.io/hackage-mirror/
Selected mirror http://hackage.haskell.org/
Downloading root
/usr/bin/curl 'http://hackage.haskell.org/root.json' --output /tmp/transportAdapterGet556-1 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.2.0.0 (linux; i386)' --silent --show-error --dump-header /tmp/curl-headers556-2.txt
Waiting to acquire cache lock on
~/.cabal/packages/hackage.haskell.org/hackage-security-lock
Exception fdLock: invalid argument (Invalid argument) when using mirror
http://hackage.haskell.org/
Selected mirror http://hackage.fpcomplete.com/
Downloading root
/usr/bin/curl 'http://hackage.fpcomplete.com/root.json' --output /tmp/transportAdapterGet556-4 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.2.0.0 (linux; i386)' --silent --show-error --dump-header /tmp/curl-headers556-5.txt
Waiting to acquire cache lock on
~/.cabal/packages/hackage.haskell.org/hackage-security-lock
Exception fdLock: invalid argument (Invalid argument) when using mirror
http://hackage.fpcomplete.com/
Selected mirror http://objects-us-east-1.dream.io/hackage-mirror/
Downloading root
/usr/bin/curl 'http://objects-us-east-1.dream.io/hackage-mirror/root.json' --output /tmp/transportAdapterGet556-7 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.2.0.0 (linux; i386)' --silent --show-error --dump-header /tmp/curl-headers556-8.txt
Waiting to acquire cache lock on
~/.cabal/packages/hackage.haskell.org/hackage-security-lock
fdLock: invalid argument (Invalid argument)

32-bit system issue?

My system is 32 bit, see:

$ file /usr/bin/cabal 
/usr/bin/cabal: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 4.4.0, BuildID[sha1]=836406dd5a3edf8e18075e91b98d149b89c55eeb, stripped

This may or may not be related to the problem, see:

$ strace cabal v1-update
...
unlink("~/.cabal/packages/hackage.haskell.org/timestamp.json") = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "~/.cabal/packages/hackage.haskell.org/hackage-security-lock", O_RDWR|O_CREAT|O_LARGEFILE, 0666) = 11
fcntl64(11, F_OFD_SETLKW, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=-5454117254805323776}) = -1 EINVAL (Invalid argument)
close(11)                               = 0
poll([{fd=2, events=POLLOUT}], 1, 0)    = 1 ([{fd=2, revents=POLLOUT}])
write(2, "fdLock: invalid argument (Invali"..., 44fdLock: invalid argument (Invalid argument)
) = 44
...
exit_group(1)                           = ?
+++ exited with 1 +++

The l_len argument above seems to have a suspicious 64-bit value...

64-bit works

Running the same v1-update / v2-update commands on my 64-bit box running Arch Linux works fine (Linux 5.10.6, GHC 8.10.4, cabal-install v3.2.0.0 and cabal-lib v3.2.1.0).

Fresh user

Just to be safe, I also replicated the bug on a fresh user with an empty home directory. Cabal still fails in the same way.

@rudymatela
Copy link
Contributor Author

rudymatela commented Jun 14, 2021

During the past week, this was the temporary fix I used:

this$ ssh my.other.64.bit.box.example.com

other$ rm -r ~/.ghc ~/.cabal

other$ cabal update
...

other$ exit

this$ scp -r other:.cabal .
...

this$ cabal v1-install leancheck
... successfully installs leancheck...

This works, but I'd like to be able to update without resorting to using another device.

@rudymatela rudymatela changed the title "cabal update" failing with "fdLock: invalid argument" "cabal update" failing with "fdLock: invalid argument" on both v1- and v2- Jun 14, 2021
@rudymatela rudymatela changed the title "cabal update" failing with "fdLock: invalid argument" on both v1- and v2- "cabal update" failing with "fdLock: invalid argument" (v1- and v2-) Jun 14, 2021
@Mikolaj
Copy link
Member

Mikolaj commented Jun 14, 2021

There is a series of issues that, I think, duplicate this one. In particular, taking the binary from here should probably fix this issue for you:

#7313 (comment)

Here is the upstream issue (work around a glibc bug?) that is probably not being work on, because of lack of i386 machine to test.

haskellari/lukko#15

I think originally this is a glibc bug, so in a few years it should be fixed in your distro, I guess.

@jneira
Copy link
Member

jneira commented Jun 15, 2021

duplicate of #7313
(to trigger the automatic github mark: https://github.blog/2017-07-14-manage-issues-and-pull-requests-with-keyword-updates/)

EDIT: It did not work, i guess due to permission over the repo, but it should work for you @Mikolaj

@Mikolaj
Copy link
Member

Mikolaj commented Jun 15, 2021

duplicate of #7313?

@Mikolaj
Copy link
Member

Mikolaj commented Jun 15, 2021

Duplicate of #7313

@Mikolaj Mikolaj marked this as a duplicate of #7313 Jun 15, 2021
@Mikolaj
Copy link
Member

Mikolaj commented Jun 15, 2021

Would you believe it, capitalisation makes a difference. :D

@ulysses4ever
Copy link
Collaborator

Closing as a dup

@ulysses4ever ulysses4ever closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants