Error: Cannot obtain a lock on data directory #19167

issue heaven openend this issue on June 4, 2020
  1. heaven commented at 2:14 pm on June 4, 2020: none

    Getting this error when trying to store the data directory on a network drive (using Time Capsule drive). I simply don’t have 280GB of disk space on my mac for the initial sync. Deleting the .lock and restarting the app doesn’t help. There’s no debug output also, it only creates the lock file and exists.

    Expected behavior

    It should be able to store the data on network-attached devices.

    Actual behavior

    Getting this error.

    To reproduce

    Install the wallet and choose the data directory to be on a network-attached drive.

    System information

    Bitcoin Core 0.20.0 Mac OS 10.15.5

  2. heaven added the label Bug on Jun 4, 2020
  3. MarcoFalke added the label macOS on Jun 4, 2020
  4. pstratem commented at 1:57 am on June 7, 2020: contributor

    Some network filesystems simply do not support file locking.

    Possibly this is one of them?

  5. fanquake commented at 7:26 am on August 13, 2020: member
    Closing this until more information is available.
  6. fanquake closed this on Aug 13, 2020

  7. dhruv commented at 9:19 pm on September 24, 2020: member

    I wanted to sync a full, non-pruned node on to an Apple Time Capsule storage drive. Thought solving this issue might be useful for others as well. But I hit a wall. Here are my notes in case it’s useful for the next person who gets interested in this issue:

    • bitcoind creates a .lock file on datadir
    • This is done using the fcntl sys call
    • Sidenote: Filesystem locks in unix are advisory only. They only really protected against other instances of well-behaved applications. Advisory file locks are made by the OS keeping track of a pid that currently holds the lock. This is more involved over NAS storage because the lock-holding process can be on other network computers as well.
    • Apple Time Capsule uses AFP(Apple Filing Protocol) over TCP and fcntl does not seem to work as expected.
    • Changing the code to use the is_wsl workaround in src/fs.cpp FileLock::TryLock for AFP allows bitcoind to capture the lock using the flock syscall instead of fcntl. However, then it seems that the lock is simply ignored by another well-behaved bitcoind process.
    • Further down the execution path, leveldb is unable to acquire locks as well. This is likely also because of a similar issue but changing leveldb is likely more involved in time.
    • I decided to give up on this approach to run a full node.
  8. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me