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

Permission denied error when trying to build ruby package with pkgr 1.6.0 #142

Open
obfuscoder opened this issue Jan 29, 2018 · 3 comments · May be fixed by pkgr/heroku-buildpack-ruby#3
Open

Comments

@obfuscoder
Copy link
Contributor

obfuscoder commented Jan 29, 2018

Running the following command in our project with pkgr 1.6.0 results in error:

~/project$ pkgr package . --name myproject --verbose --debug --clean --after-install=debian/after_install
sh: 1: svn: not found
[2018-01-29T12:23:05+01:00] DEBUG: Initializing builder with the following config: #<Pkgr::Config verbose=true, debug=true, buildpacks_cache_dir="/home/myuser/.pkgr/buildpacks", architecture="x86_64", category="none", iteration="20180129122304", dependencies=[], build_dependencies=[], auto=false, clean=true, edge=true, env=[], verify=true, data_dir="/home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/data", name="myproject", after_install="debian/after_install", version="0.0.0">
[2018-01-29T12:23:05+01:00] DEBUG: sh(tar xzf /tmp/pkgr-tarball20180129-10588-t8elvv.tar.gz -C /tmp/d20180129-10588-kmwqh2/opt/myproject)
[2018-01-29T12:23:05+01:00] DEBUG: Loading debian-8 from /tmp/d20180129-10588-kmwqh2/opt/myproject/.pkgr.yml.
[2018-01-29T12:23:05+01:00] DEBUG: Configuration from file: {"crons"=>["debian/cron.d"]} - Distribution: "debian-8".
[2018-01-29T12:23:05+01:00] DEBUG: Found .pkgr.yml file. Updated config is now: #<Pkgr::Config crons=["debian/cron.d"], verbose=true, debug=true, buildpacks_cache_dir="/home/myuser/.pkgr/buildpacks", architecture="x86_64", category="none", iteration="20180129122304", dependencies=[], build_dependencies=[], auto=false, clean=true, edge=true, env=[], verify=true, data_dir="/home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/data", name="myproject", after_install="debian/after_install", version="0.0.0">
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'curl' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'libpq-dev' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'libsqlite3-0' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'libevent-dev' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'libxml2-dev' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'libxslt1-dev' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'libreadline-dev' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'build-essential' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'libssl1.0.0' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'libssl-dev' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] DEBUG: sh(dpkg -s 'libmysqlclient-dev' > /dev/null 2>&1)
[2018-01-29T12:23:05+01:00] WARN: Missing build dependencies detected. Run the following to fix: sudo apt-get update && sudo apt-get install --force-yes -y "libpq-dev" "libevent-dev" "libxslt1-dev" "libreadline-dev"
[2018-01-29T12:23:05+01:00] WARN: Can't create "/opt/myproject", which may be needed by some buildpacks.
[2018-01-29T12:23:05+01:00] DEBUG: sh(git fetch origin && ( git reset --hard v164-1 || git reset --hard origin/v164-1 ) && chmod -f +x bin/detect && chmod -f +x bin/compile && chmod -f +x bin/release)
[2018-01-29T12:23:06+01:00] DEBUG: sh(find . -type f -not -path '*/.git/*' -print0 | xargs -0 perl -pi -e s,/app/,/opt/myproject/,g)
[2018-01-29T12:23:06+01:00] DEBUG: sh(env -i PATH="$PATH" TARGET="debian:8" BUILDPACK_NODE_VERSION="0.6.8" /home/myuser/.pkgr/buildpacks/builtin/719e4e8cb9227b4e7f6a118d958174bd6045fa93/heroku-buildpack-ruby/bin/detect "/tmp/d20180129-10588-kmwqh2/opt/myproject")
-----> Ruby app
[2018-01-29T12:23:06+01:00] DEBUG: Running "env -i PATH=\"$PATH\" TARGET=\"debian:8\" BUILDPACK_NODE_VERSION=\"0.6.8\" /home/myuser/.pkgr/buildpacks/builtin/719e4e8cb9227b4e7f6a118d958174bd6045fa93/heroku-buildpack-ruby/bin/compile \"/tmp/d20180129-10588-kmwqh2/opt/myproject\" \"/tmp/d20180129-10588-kmwqh2/opt/myproject/.git/cache\" \"/tmp/d20180129-10588-19o7l22\" "
-----> Compiling Ruby/Rails
sh: 1: /: Permission denied
sh: 10: /tmp/bundler/home/myuser-as-your-home-directory-temporarily.-ruby-2.3.4

Heroku recommends you use the latest supported Ruby version listed here:
  https://devcenter.heroku.com/articles/ruby-support#supported-runtimes

For more information on syntax for declaring a Ruby version see:
  https://devcenter.heroku.com/articles/ruby-versions


Debug InformationCommand: set: not found
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (22) The requested URL returned error: 403 Forbidden
sh: 1: -is-not-writable.-Bundler-will-use-: not found
 !
 !     An error occurred while installing `/`-is-not-writable.-Bundler-will-use-`/tmp/bundler/home/myuser'-as-your-home-directory-temporarily.-ruby-2.3.4
 !     
 !     Heroku recommends you use the latest supported Ruby version listed here:
 !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
 !     
 !     For more information on syntax for declaring a Ruby version see:
 !     https://devcenter.heroku.com/articles/ruby-versions
 !     
 !     
 !     Debug InformationCommand: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/`/`-is-not-writable.-Bundler-will-use-`/tmp/bundler/home/myuser'-as-your-home-directory-temporarily.-ruby-2.3.4.tgz -s -o - | tar zxf - ' failed unexpectedly:
 !     bash: -c: line 0: unexpected EOF while looking for matching ``'
 !     bash: -c: line 1: syntax error: unexpected end of file
 !
[2018-01-29T12:23:15+01:00] DEBUG: RuntimeError : compile failed
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/lib/pkgr/buildpack.rb:49:in `block in compile'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/lib/pkgr/buildpack.rb:42:in `chdir'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/lib/pkgr/buildpack.rb:42:in `compile'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/lib/pkgr/builder.rb:123:in `block in compile'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/lib/pkgr/builder.rb:121:in `each'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/lib/pkgr/builder.rb:121:in `compile'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/lib/pkgr/builder.rb:28:in `call'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/lib/pkgr/dispatcher.rb:33:in `call'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/lib/pkgr/cli.rb:170:in `package'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/gems/pkgr-1.6.0/bin/pkgr:8:in `<top (required)>'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/bin/pkgr:23:in `load'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/bin/pkgr:23:in `<main>'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/bin/ruby_executable_hooks:15:in `eval'
[2018-01-29T12:23:15+01:00] DEBUG: /home/myuser/.rvm/gems/ruby-2.3.4@mygemset/bin/ruby_executable_hooks:15:in `<main>'
     ! ERROR: compile failed

This seems to be a problem in the ruby buildpack. The used buildback is at https://github.com/pkgr/heroku-buildpack-ruby I can't create an issue there.

@obfuscoder
Copy link
Contributor Author

I added a fix to dealing with the bundler output. However, there are also situations when bundler platform --ruby outputs additional text after the version:

`/` is not writable.
Bundler will use `/tmp/bundler/home/myuser' as your home directory temporarily.
ruby 2.3.4p301
The latest bundler is 1.16.1, but you are currently running 1.15.1.
To update, run `gem install bundler`

In this case my fix of just using the last line of the output does not cut it.

@obfuscoder
Copy link
Contributor Author

Ok, I fixed it by selecting only the line(s) of the output matching an expected version pattern. Works with jruby and rbx as well.

@Jed-Giblin
Copy link

I had to do the same when running a job inside jenkins inside a docker container. Thanks @obfuscoder

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

Successfully merging a pull request may close this issue.

2 participants