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

ipfs daemon --init does not work #3773

Closed
mitar opened this issue Mar 10, 2017 · 7 comments
Closed

ipfs daemon --init does not work #3773

mitar opened this issue Mar 10, 2017 · 7 comments
Assignees
Labels
kind/bug A bug in existing code (including security flaws) need_tests
Milestone

Comments

@mitar
Copy link

mitar commented Mar 10, 2017

Version information:

go-ipfs version: 0.4.6-
Repo version: 5
System version: amd64/linux
Golang version: go1.8

Type: Bug

Priority: P4

Description:

I am passing --init, but it does not do what is saying it will do, which is, initialize the repo:

$ export IPFS_PATH=/ipfs
$ /usr/local/bin/ipfs daemon --init
Initializing daemon...
Error: no IPFS repo found in /ipfs.
please run: 'ipfs init'
@whyrusleeping
Copy link
Member

@mitar Thats odd... it works for me.
I was going to ask if it could be a permissions issue, but that prints out permission denied for me.

Does the /ifps folder contain anything?

@mitar
Copy link
Author

mitar commented Mar 11, 2017

It does not. You can do full reproduction using a Docker image:

$ docker run -d --name test-sgx tozd/sgx
$ docker exec -t -i test-sgx bash
$ wget -O - https://dist.ipfs.io/go-ipfs/v0.4.6/go-ipfs_v0.4.6_linux-amd64.tar.gz | tar zx --strip=1 -C /usr/local/bin go-ipfs/ipfs
$ mkdir /ipfs
$ export IPFS_PATH=/ipfs
$ ipfs daemon --init
Initializing daemon...
Error: no IPFS repo found in /ipfs.
please run: 'ipfs init'

@whyrusleeping
Copy link
Member

@mitar ah, ipfs init assumes that the directory youre giving it does not already exist.

@mitar
Copy link
Author

mitar commented Mar 19, 2017

Oh, but for ipfs init there is no such assumption. It just checks that the directory is empty. So this works:

mkdir -p /ipfs
export IPFS_PATH=/ipfs
ipfs init --empty-repo || true
ipfs daemon --migrate --enable-gc --enable-pubsub-experiment

But this does not:

mkdir -p /ipfs
export IPFS_PATH=/ipfs
ipfs daemon --init --migrate --enable-gc --enable-pubsub-experiment

It is not really possible inside Docker for a directory to not exist, because in practice I am mounting external volume to /ipfs. So it exists because Docker puts a volume there.

BTW, having --init-empty would be great for daemon.

@whyrusleeping
Copy link
Member

Ah interesting. Thats a weird discrepancy. Lets make sure the --init flag on the daemon has the same exact behaviour as ipfs init

@whyrusleeping whyrusleeping added the kind/bug A bug in existing code (including security flaws) label Mar 19, 2017
@whyrusleeping whyrusleeping added this to the Ipfs 0.4.8 milestone Mar 19, 2017
@kevina kevina self-assigned this Mar 20, 2017
@kevina
Copy link
Contributor

kevina commented Mar 20, 2017

I will look into this today.

@kevina
Copy link
Contributor

kevina commented Mar 20, 2017

#3805 should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need_tests
Projects
None yet
Development

No branches or pull requests

4 participants