stove-labs / granary-starter-kit

Starter kit for Granary, the All-in toolkit for Tezos development
MIT License
4 stars 2 forks source link

Permission denied with Getting Started #1

Open desar opened 5 years ago

desar commented 5 years ago

I got error below, following the Getting started instruction.

$ granary node start tezos-node: Error: Unix error in open: Permission denied

There's an exited docker instance after the error. $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a51a70b684f1 stovelabs/granary-tezos-node-sandboxnet "/usr/local/bin/tezo…" 6 seconds ago Exited (1) 4 seconds ago granary-tezos-node-sandbox

desar commented 5 years ago

Additional info. Restarting container results in the same error. Now, how do I get into that container to see what happen...

$ docker ps -a
CONTAINER ID        IMAGE                                     COMMAND                  CREATED             STATUS                      PORTS               NAMES
e2cdc020f8cb        stovelabs/granary-tezos-node-sandboxnet   "/usr/local/bin/tezo…"   18 minutes ago      Exited (1) 48 seconds ago                       granary-tezos-node-sandbox
$ docker start -a -i e
tezos-node: Error:
              Unix error in open: Permission denied
maht0rz commented 5 years ago

@desar can you please elaborate on which commands exactly did you run and how does your file system looks like currently?

Also to get detailed logs, you should be able to run something like:

docker logs <container_id / container_name>

desar commented 5 years ago

@maht0rz I'm following the instruction on the granary-starter-kit README.md https://github.com/stove-labs/granary-starter-kit (after installing docker, node.js, and granary itself) $git clone https://github.com/stove-labs/granary-starter-kit.git my-granary-project $cd my-granary-project $npm i $npm run init $npm run start <- the error happens here.

docker logs don't reveal more:

$ docker ps -a
CONTAINER ID        IMAGE                                     COMMAND                  CREATED             STATUS                      PORTS               NAMES
a9f9fc2467b6        stovelabs/granary-tezos-node-sandboxnet   "/usr/local/bin/tezo…"   41 seconds ago      Exited (1) 36 seconds ago                       granary-tezos-node-sandbox
$ docker logs a
tezos-node: Error:
              Unix error in open: Permission denied

I also read the tezos documentation. I can run alphanet.sh (running tezos docker images). I also can compile tezos from the source, and run the sandbox command line on the same env (sandboxed mode on tezos doc). I'm trying to run Michelson sample and bit confused with their doc, and wonder if there's a simple way, where I found this granary.

maht0rz commented 5 years ago

@desar can you show me your current file system, please? The Tezos node will try saving it's state under .granary/* so i'm mainly interested in that folder. Honestly it could be a simple perm. issue, so you could try running chmod 777 .granary to update the permissions so the container can write into that folder.

desar commented 5 years ago

Here's the ls result. I don't see any file/folder permissions problem.

vagrant@ubuntu1804:~/my-granary-project$ pwd
/home/vagrant/my-granary-project
vagrant@ubuntu1804:~/my-granary-project$ ls -la
total 264
drwxrwxr-x   7 vagrant vagrant   4096 Jun  4 14:41 .
drwxr-xr-x  15 vagrant vagrant   4096 Jun  5 07:35 ..
-rwxrwxr-x   1 vagrant vagrant    639 Jun  3 04:36 activate_alpha.sh
-rwxrwxr-x   1 vagrant vagrant     56 Jun  3 04:36 bake.sh
-rwxrwxr-x   1 vagrant vagrant     80 Jun  3 04:36 get_storage.sh
drwxrwxr-x   8 vagrant vagrant   4096 Jun  3 04:36 .git
drwxrwxr-x   3 vagrant vagrant   4096 Jun  3 04:36 .github
-rw-rw-r--   1 vagrant vagrant     34 Jun  3 04:36 .gitignore
drwxrwxr-x   3 vagrant vagrant   4096 Jun  3 04:37 .granary
-rw-------   1 vagrant vagrant   1485 Jun  4 14:41 granary.json
-rwxrwxr-x   1 vagrant vagrant    130 Jun  3 04:36 invoke.sh
-rw-rw-r--   1 vagrant vagrant   1068 Jun  3 04:36 LICENSE
-rw-rw-r--   1 vagrant vagrant    257 Jun  3 04:36 Makefile
drwxrwxr-x 410 vagrant vagrant  16384 Jun  4 07:10 node_modules
-rwxrwxr-x   1 vagrant vagrant    195 Jun  3 04:36 originate.sh
-rw-rw-r--   1 vagrant vagrant    839 Jun  3 04:36 package.json
-rw-rw-r--   1 vagrant vagrant 176952 Jun  3 04:53 package-lock.json
-rw-rw-r--   1 vagrant vagrant    342 Jun  3 04:36 protocol_parameters.json
-rw-rw-r--   1 vagrant vagrant   1002 Jun  3 04:36 README.md
drwxrwxr-x   2 vagrant vagrant   4096 Jun  3 04:36 src
vagrant@ubuntu1804:~/my-granary-project$ ls -laR .granary/
.granary/:
total 12
drwxrwxr-x 3 vagrant vagrant 4096 Jun  3 04:37 .
drwxrwxr-x 7 vagrant vagrant 4096 Jun  4 14:41 ..
drwxrwxr-x 4 vagrant vagrant 4096 Jun  3 04:37 sandboxnet

.granary/sandboxnet:
total 16
drwxrwxr-x 4 vagrant vagrant 4096 Jun  3 04:37 .
drwxrwxr-x 3 vagrant vagrant 4096 Jun  3 04:37 ..
drwxrwxr-x 2 vagrant vagrant 4096 Jun  3 04:37 client
drwxrwxr-x 2 vagrant vagrant 4096 Jun  4 14:39 node

.granary/sandboxnet/client:
total 8
drwxrwxr-x 2 vagrant vagrant 4096 Jun  3 04:37 .
drwxrwxr-x 4 vagrant vagrant 4096 Jun  3 04:37 ..

.granary/sandboxnet/node:
total 24
drwxrwxr-x 2 vagrant vagrant 4096 Jun  4 14:39 .
drwxrwxr-x 4 vagrant vagrant 4096 Jun  3 04:37 ..
-rw-rw-r-- 1 vagrant vagrant  428 Jun  4 14:40 config.json
-rw-rw-r-- 1 vagrant vagrant  310 Jun  4 14:40 identity.json
-rw-rw-r-- 1 vagrant vagrant   88 Jun  4 14:40 sandbox.json
-rw-rw-r-- 1 vagrant vagrant   22 Jun  4 14:40 version.json
vagrant@ubuntu1804:~/my-granary-project$
pw374 commented 5 years ago

my two cents since no one has mentioned it yet: have you checked the permissions of the parent folder(s) (/home/vagrant, and possibly of /home) ?

fbertoia commented 5 years ago

Hello, I raise again that same issue since I am facing the same problem. I followed the process written here, but I have issues to launch the node, as showed as following :

➜ my - granary - project git: (master)✗ ls - la
total 440
drwxrwxrwx 20 fbertoia staff 640 Oct 29 18: 52.
drwxrwxrwx 10 fbertoia staff 320 Oct 29 18: 40..
drwxrwxrwx 12 fbertoia staff 384 Oct 29 18: 52.git
drwxrwxrwx 3 fbertoia staff 96 Oct 29 18: 40.github -
    rwxrwxrwx 1 fbertoia staff 34 Oct 29 18: 40.gitignore
drwxrwxrwx 3 fbertoia staff 96 Oct 29 18: 42.granary -
    rwxrwxrwx 1 fbertoia staff 1068 Oct 29 18: 40 LICENSE -
    rwxrwxrwx 1 fbertoia staff 257 Oct 29 18: 40 Makefile -
    rwxrwxrwx 1 fbertoia staff 1101 Oct 29 18: 40 README.md -
    rwxrwxrwx 1 fbertoia staff 640 Oct 29 18: 40 activate_proto.sh -
    rwxrwxrwx 1 fbertoia staff 56 Oct 29 18: 40 bake.sh -
    rwxrwxrwx 1 fbertoia staff 80 Oct 29 18: 40 get_storage.sh -
    rw-- -- -- - 1 fbertoia staff 1377 Oct 29 18: 52 granary.json -
    rwxrwxrwx 1 fbertoia staff 130 Oct 29 18: 40 invoke.sh
drwxrwxrwx 406 fbertoia staff 12992 Oct 29 18: 45 node_modules -
    rwxrwxrwx 1 fbertoia staff 195 Oct 29 18: 40 originate.sh -
    rwxrwxrwx 1 fbertoia staff 174381 Oct 29 18: 45 package - lock.json -
    rwxrwxrwx 1 fbertoia staff 839 Oct 29 18: 40 package.json -
    rwxrwxrwx 1 fbertoia staff 342 Oct 29 18: 40 protocol_parameters.json
drwxrwxrwx 4 fbertoia staff 128 Oct 29 18: 40 src
➜ my - granary - project git: (master)✗ docker container rm granary - tezos - node - sandbox &&
    chmod - R 777. &&
    granary node start
granary - tezos - node - sandbox
tezos - node: Error:
    Unix error in open: Permission denied
➜ my - granary - project git: (master)✗ docker container rm granary - tezos - node - sandbox &&
    chmod - R 777. &&
    granary node start
granary - tezos - node - sandbox
Oct 29 17: 53: 50 - node.main: Starting the Tezos node...
    Oct 29 17: 53: 50 - node.main: No local peer discovery.
Oct 29 17: 53: 50 - node.main: Not listening to P2P calls.
Oct 29 17: 53: 50 - main: shell - node initialization: p2p_layer_disabled
tezos - node: Error:
    Permission denied

The errors are not exactly the same. Is there a verbose version for granary to have a bit more logs. I have no idea where is the permission problem.

elenoir commented 4 years ago

Hi,

I've been able to reproduce your issues and decided to investigate a little bit further into it. It appears that it's indeed a permission problem with the filesystem.

I had a look on the granary-tezos-node-sandbox container :

Basically you can reproduce what granary does with these steps:

It appears that some error details came:

tezos-node: internal error, uncaught exception: Unix.Unix_error(Unix.EACCES, "mkdir", "/home/erik/tezos-sandbox/.granary/sandboxnet/node--no-bootstrap-peers")

Finally by typing something such as chmod -R 777 /home/erik/tezos-sandbox/.granary/sandboxnet/ it made the errors gone.

Last comment: I had to add

granary-tezos-node-sandbox localhost

in my /etc/hosts file to ensure that all the ganary client commands worked fine.

Hope this helps!

7-- commented 4 years ago

@elenoir thanks I had the same issue. running sudo chmod -R 777 <granary-starter-kit-base-dir>/.granary/sandboxnet/ then running npm run start got the node to start.

tylerhough commented 3 years ago

@elenoir yessir, thank you

Pl8tinium commented 3 years ago

hi did you guys find a solution which doesnt use chmod 777? My idea was to add the docker user "tezos" to the docker group so that its permitted to write in the directorys where the docker group can access a folder. The problem with that is that you cant add a user to a group who doesnt exist on the host.... So i searched for alternative ideas to add unknown user accs to this group and found this post: https://medium.com/@nielssj/docker-volumes-and-file-system-permissions-772c1aee23ca in this post the writer describes that its possible to "set file/directory ownership to a GID which does not belong to any actual group" I couldnt figure out how to do that so i couldnt try it out...

Pl8tinium commented 3 years ago

nevermind guys, i found a solution: go to the shell of the docker container and get the gid "id -g username", then go to the folder you want to add as a volume and at the gid "chgrp gid path" the docker user was then able to access the folder dont know if thats a better way than chmod 777 but yea