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

Unmounted database directory causes btcd to fail uninformatively #193

Closed
adamkrellenstein opened this issue Dec 21, 2014 · 4 comments
Closed
Labels

Comments

@adamkrellenstein
Copy link

On my system, ~/.btcd is symlinked to a mountable directory in /mnt (with the drive formatted with btrfs):

$ ls -ls ~/.btcd 
4 lrwxrwxrwx 1 adam users 20 Nov  8 12:33 /home/adam/.btcd -> /mnt/dot-btcd

When this directory isn't mounted, btcd always immediately fails without any error message at all:

$ btcd
$ btcd --help
$ btcd --debuglevel=trace
$ echo $?
1

C.f.:

$ mount /mnt
$ btcd
10:26:18 2014-12-21 [INF] BTCD: Version 0.9.0-beta
10:26:18 2014-12-21 [INF] BTCD: Loading block database from '/home/adam/.btcd/data/mainnet/blocks_leveldb'
10:26:18 2014-12-21 [INF] BTCD: Block database loaded with block height 335249
10:26:18 2014-12-21 [INF] BMGR: Generating initial block node index.  This may take a while...
[...]
@davecgh davecgh added the bug label Dec 21, 2014
@davecgh
Copy link
Member

davecgh commented Dec 21, 2014

Confirmed. The error is being logged before the logging system is initialized. I'll submit a pr to fix it shortly.

davecgh added a commit to davecgh/btcd that referenced this issue Dec 21, 2014
This commit improves a couple of issues surrounding the creation of the
btcd home directory.

First, the code was previously attempting to log any errors that occurred
while creating the directory using the logging system which is not
initialized at that point.  Thus, nothing was displayed to the user.

Second, if any component of btcd home directory path already exist, but
are not a directory, such as in the case of symlinks, the error returned
from the os.MkDirAll call indicates the directory can't be created.  While
this is true, it's not always the most helpful error to display to the
user.  So, this commit adds logic to detect when the failure case is due
to an existing symlink and displays a nicer error message suggesting the
user check if the destination of the link is mounted.

Fixes btcsuite#193.
@davecgh
Copy link
Member

davecgh commented Dec 21, 2014

@adamkrellenstein: Can you give pr #194 a try to see if that satisfactorily resolves the issue?

git checkout -b davecgh-fix193 master
git pull https://github.com/davecgh/btcd.git fix193
go build

@adamkrellenstein
Copy link
Author

@davecgh, yep, it works now:

~/g/s/g/c/btcd (davecgh-fix193) > ./btcd
loadConfig: Failed to create home directory: is symlink /home/adam/.btcd -> /mnt/dot-btcd mounted?

@davecgh
Copy link
Member

davecgh commented Dec 21, 2014

Reopened since the pull request isn't merged to master yet. It will close the issue when merged.

kcalvinalvin added a commit to kcalvinalvin/btcd that referenced this issue Nov 29, 2024
…ble-bridge

Make bridge nodes recoverable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants