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

Error: EACCES: permission denied, mkdir '/network/workspace/.config' #9

Open
uaktags opened this issue Jan 29, 2024 · 5 comments
Open

Comments

@uaktags
Copy link

uaktags commented Jan 29, 2024

When attempting to start the network, it fails with the permissions issue above. This is after following the current "Getting Started" guide: https://github.com/GalaChain/sdk/blob/main/docs/getting-started.md


$ galachain network:up -C=product-channel -t=curator -n=basic-product -d=./ --envConfig=./.dev-env --watch
Network root directory: /home/tim/gala/test-network
Network target directory is empty

┌──────      .─.       ┌─────.    ╷           .────.
│           /   \      │      │   │         ╱        ╲
├─────     /     \     ├─────:    │        │          │
│         /───────\    │      │   │         ╲        ╱
╵        /         \   └─────'    └──────     '────'                      v1.1.0
┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
│ https://fablo.io | created at SoftwareMill | backed by Hyperledger Foundation│
└┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘
Generating network config
    FABLO_VERSION:      1.1.0
    FABLO_CONFIG:       /home/tim/gala/test-network/fablo-config.json
    FABLO_NETWORK_ROOT: /home/tim/gala/test-network/fablo-target
/usr/local/lib/node_modules/yo/node_modules/make-dir/index.js:77
                                throw err;
                                ^

Error: EACCES: permission denied, mkdir '/network/workspace/.config'

Node.js v18.3.0
    Error: Command failed: "/home/tim/gala/test-network/fablo" "up"
    error: script "network:start" exited with code 1
@herr-bubu
Copy link
Contributor

herr-bubu commented Jan 30, 2024

Hey @uaktags,
It seems like you don't have permissions to /home/tim/gala
Please give me more details like: machine type, OS

@uaktags
Copy link
Author

uaktags commented Jan 30, 2024

machine is a VM
uname: Linux 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
OS: Ubuntu 22.04.3LTS
nvm: v0.39.0
node: 18.17.0
npm: 9.6.7
galachain: $ whereis galachain galachain: /home/tim/.nvm/versions/node/v18.17.0/bin/galachain

/home/tim is the current user's (myself) home directory and gala is correctly permissioned

Steps to reproduce:

tim@galaTest:~$ galachain init testGala
Project template initialized at testGala
tim@galaTest:~$ ls -lah | grep testGala
drwxrwxr-x   6 tim  tim      4.0K Jan 30 10:26 testGala
tim@galaTest:~$ cd testGala
tim@galaTest:~/testGala$ ls
docker      e2e             package.json       README.md  tsconfig.base.json  tsconfig.spec.json
Dockerfile  jest.config.ts  package-lock.json  src        tsconfig.json
tim@galaTest:~/testGala$ npm i > /dev/null 2>&1
tim@galaTest:~/testGala$ npm run network:start

> @gala-chain/[email protected] network:start
> galachain network:up -C=product-channel -t=curator -n=basic-product -d=./ --envConfig=./.dev-env --watch

Network root directory: /home/tim/testGala/test-network
Network target directory is empty

┌──────      .─.       ┌─────.    ╷           .────.
│           /   \      │      │   │         ╱        ╲
├─────     /     \     ├─────:    │        │          │
│         /───────\    │      │   │         ╲        ╱
╵        /         \   └─────'    └──────     '────'                      v1.1.0
┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
│ https://fablo.io | created at SoftwareMill | backed by Hyperledger Foundation│
└┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘
Generating network config
    FABLO_VERSION:      1.1.0
    FABLO_CONFIG:       /home/tim/testGala/test-network/fablo-config.json
    FABLO_NETWORK_ROOT: /home/tim/testGala/test-network/fablo-target
/usr/local/lib/node_modules/yo/node_modules/make-dir/index.js:77
                                throw err;
                                ^

Error: EACCES: permission denied, mkdir '/network/workspace/.config'
    at Object.mkdirSync (node:fs:1385:3)
    at make (/usr/local/lib/node_modules/yo/node_modules/make-dir/index.js:61:12)
    at make (/usr/local/lib/node_modules/yo/node_modules/make-dir/index.js:68:5)
    at module.exports.sync (/usr/local/lib/node_modules/yo/node_modules/make-dir/index.js:84:9)
    at get store [as store] (/usr/local/lib/node_modules/yo/node_modules/conf/index.js:120:13)
    at new Conf (/usr/local/lib/node_modules/yo/node_modules/conf/index.js:44:57)
    at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/index.js:40:35)
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/lib/cli.js:54:17)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) {
  errno: -13,
  syscall: 'mkdir',
  code: 'EACCES',
  path: '/network/workspace/.config'
}

Node.js v18.3.0
    Error: Command failed: "/home/tim/testGala/test-network/fablo" "up"
tim@galaTest:~/testGala$ ls test-network/
browser-api             connection-profiles          fablo                       fablo-config.json
chaincode-dev-start.sh  connection-profiles-browser  fablo-config-default.json   fablo-post-generate.sh
configtx-policies.yml   dev-admin-key                fablo-config-dev-mode.json  fablo-target

@thejustinwalsh
Copy link

thejustinwalsh commented Jan 30, 2024

It may be this issue, from a yeoman dependency somewhere in fablo.
yeoman/yo#785

@uaktags
Copy link
Author

uaktags commented Jan 30, 2024

Hmm, so just to clarify, this is a normal VM, not WSL or a container.
Yo is not installed, atleast not globally.

Permissions definitely seems to be a concern here, if I cd into the test-network directory, and sudo call ./fablo up, it'll get through the process further but will still fail on
Error: open ./configtx-policies.yml: permission denied.

With this in mind, i'm wondering if the sdk was tested by a root user with a global install of node rather than nvm?

However, the weird part is that the original, non-sudo, permission is denied error is on /network/workspace, which according to fablo is a virtual directory that is actually from in the docker

executeOnFabloDocker() {
  local command_with_params="$1"
  local fablo_workspace="${2:-$FABLO_TEMP_DIR}"
  local fablo_config="$3"

  local fablo_workspace_params=(
    -v "$fablo_workspace":/network/workspace
  )

  local fablo_config_params=()
  if [ -n "$fablo_config" ]; then
    if [ ! -f "$fablo_config" ]; then
      echo "File $fablo_config does not exist"
      exit 1
    fi

    fablo_config="$(cd "$(dirname "$fablo_config")" && pwd)/$(basename "$fablo_config")"
    local chaincodes_base_dir="$(dirname "$fablo_config")"
    fablo_config_params=(
      -v "$fablo_config":/network/fablo-config.json
      --env "FABLO_CONFIG=$fablo_config"
      --env "CHAINCODES_BASE_DIR=$chaincodes_base_dir"
    )
  fi

  docker run -i --rm \
    "${fablo_workspace_params[@]}" \
    "${fablo_config_params[@]}" \
    -u "$(id -u):$(id -g)" \
    $FABLO_IMAGE sh -c "/fablo/docker-entrypoint.sh \"$command_with_params\"" \
    2>&1
}

@thejustinwalsh
Copy link

thejustinwalsh commented Jan 30, 2024

I missed the part about it being installed globally in the yeoman bug; it was a similar call stack, and I got excited.

I run nvm (installed via homebrew), though I am on macOS and do not have this issue.
$ whereis galachain galachain: /Users/tjw/.nvm/versions/node/v18.15.0/bin/galachain

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

No branches or pull requests

3 participants