cloudfoundry/cflinuxfs2

rm: cannot remove ‘/app/support_heroku_buildpacks’: Permission denied

Closed this issue · 5 comments

Hi,

I am trying to build my own stack by cloning this repository (master branch) and then running $ make (eg. as my own user).

This successfully outputs a (seemingly valid) cflinuxfs2.tar.gz file in the project root directory, which I then install into my development Cloud Foundry installation.

However, after updating my stack, I seem to run into a Permission-related error when trying to use the stack:

daniel@lenovo-daniel:~/Projects/misc/python-hello-world-flask$ cf push
Using manifest file /home/daniel/Projects/misc/python-hello-world-flask/manifest.yml

Updating app hello-world-flask in org system / space space as admin...
OK

Uploading hello-world-flask...
Uploading app files from: /home/daniel/Projects/misc/python-hello-world-flask
Uploading 13.3K, 5 files
Done uploading               
OK

Stopping app hello-world-flask in org system / space space as admin...
OK

Starting app hello-world-flask in org system / space space as admin...
-----> Downloaded app package (8.0K)
-------> Buildpack version 1.3.5
rm: cannot remove ‘/app/support_heroku_buildpacks’: Permission denied
Staging failed: Buildpack compilation step failed

FAILED
BuildpackCompileFailed

TIP: use 'cf logs hello-world-flask --recent' for more information

Which outputs:

2015-11-27T11:30:39.22+0100 [DEA/1]      OUT Got staging request for app with id 2bd6ad8c-021d-4cf5-9d74-14da1b737279
2015-11-27T11:30:40.29+0100 [API/0]      OUT Updated app with guid 2bd6ad8c-021d-4cf5-9d74-14da1b737279 ({"state"=>"STARTED"})
2015-11-27T11:30:40.39+0100 [STG/1]      OUT -----> Downloaded app package (8.0K)
2015-11-27T11:30:41.20+0100 [STG/0]      OUT -------> Buildpack version 1.3.5
2015-11-27T11:30:41.21+0100 [STG/0]      ERR rm: cannot remove ‘/app/support_heroku_buildpacks’: Permission denied
2015-11-27T11:30:41.22+0100 [STG/0]      OUT Staging failed: Buildpack compilation step failed
2015-11-27T11:30:41.34+0100 [API/0]      ERR encountered error: App staging failed in the buildpack compile phase

The DEA log output is not very helpful either:

{"timestamp":1448615161.1140583,"message":"staging.task.making-app-dir","log_level":"info","source":"Staging","data":{"app_guid":"2bd6ad8c-021d-4cf5-9d74-14da1b737279","task_id":"4dcbc93ebf754d688e82d4a4318b7248","script":"mkdir -p /app && touch /app/support_heroku_buildpacks && chown -R vcap:vcap /app"},"thread_id":70217601618680,"fiber_id":70217602811780,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/staging/staging_task.rb","lineno":215,"method":"block in promise_app_dir"}
{"timestamp":1448615161.3639486,"message":"staging.task.unpacking-app","log_level":"info","source":"Staging","data":{"app_guid":"2bd6ad8c-021d-4cf5-9d74-14da1b737279","task_id":"4dcbc93ebf754d688e82d4a4318b7248","destination":"/tmp/unstaged"},"thread_id":70217601618680,"fiber_id":70217614231040,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/staging/staging_task.rb","lineno":276,"method":"block in promise_unpack_app"}
{"timestamp":1448615161.4671323,"message":"staging.task.execute-staging","log_level":"debug","source":"Staging","data":{"app_guid":"2bd6ad8c-021d-4cf5-9d74-14da1b737279","task_id":"4dcbc93ebf754d688e82d4a4318b7248","script":"set -o pipefail; export VCAP_APPLICATION=\\{\\\"limits\\\":\\{\\\"mem\\\":128,\\\"disk\\\":1024,\\\"fds\\\":16384\\},\\\"application_version\\\":\\\"0de739cd-0379-4145-a08b-8c12ad5658f2\\\",\\\"application_name\\\":\\\"hello-world-flask\\\",\\\"application_uris\\\":\\[\\\"hello-world-flask.52.31.205.104.xip.io\\\"\\],\\\"version\\\":\\\"0de739cd-0379-4145-a08b-8c12ad5658f2\\\",\\\"name\\\":\\\"hello-world-flask\\\",\\\"space_name\\\":\\\"space\\\",\\\"space_id\\\":\\\"c6e4c1df-2c08-4486-81d6-7183f7be6e40\\\",\\\"uris\\\":\\[\\\"hello-world-flask.52.31.205.104.xip.io\\\"\\],\\\"users\\\":null\\};\nexport VCAP_SERVICES=\\{\\};\nexport MEMORY_LIMIT=\"128m\";\nexport STAGING_TIMEOUT=\"900.0\";\nexport MEMORY_LIMIT=\"128m\";\nexport CF_STACK=\"cflinuxfs2\";\n /usr/bin/ruby /var/vcap/packages/dea_next/buildpacks/bin/run /var/vcap/data/dea_next/staging/d20151127-7360-eo7hdz/plugin_config | tee -a /tmp/staged/logs/staging_task.log"},"thread_id":70217601618680,"fiber_id":70217614084920,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/staging/staging_task.rb","lineno":226,"method":"block in promise_stage"}
{"timestamp":1448615161.4743373,"message":"snapshot_attributes","log_level":"debug","source":"Staging","data":{"app_guid":"2bd6ad8c-021d-4cf5-9d74-14da1b737279","task_id":"4dcbc93ebf754d688e82d4a4318b7248","properties":{"services":[],"resources":{"memory":128,"disk":1024,"fds":16384},"environment":["CF_STACK=cflinuxfs2"],"meta":{"console":false}}},"thread_id":70217601618680,"fiber_id":70217614084920,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/staging/staging_task.rb","lineno":506,"method":"snapshot_attributes"}
{"timestamp":1448615161.475204,"message":"Saving snapshot took: 0.001s","log_level":"debug","source":"Snapshot","data":{},"thread_id":70217601618680,"fiber_id":70217614084920,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/snapshot.rb","lineno":41,"method":"save"}
{"timestamp":1448615162.4541252,"message":"staging.task.execute-staging.failed","log_level":"error","source":"Staging","data":{"app_guid":"2bd6ad8c-021d-4cf5-9d74-14da1b737279","task_id":"4dcbc93ebf754d688e82d4a4318b7248","error":"Script exited with status 1"},"thread_id":70217601618680,"fiber_id":70217614084920,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/staging/staging_task.rb","lineno":248,"method":"rescue in block in promise_stage"}
{"timestamp":1448615162.4543753,"message":"staging.task-info.copying-out","log_level":"info","source":"Staging","data":{"app_guid":"2bd6ad8c-021d-4cf5-9d74-14da1b737279","task_id":"4dcbc93ebf754d688e82d4a4318b7248","source":"/tmp/staged/staging_info.yml","destination":"/var/vcap/data/dea_next/staging/d20151127-7360-eo7hdz/staging_info.yml"},"thread_id":70217601618680,"fiber_id":70217613069060,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/staging/staging_task.rb","lineno":267,"method":"block in promise_staging_info"}
{"timestamp":1448615162.5065234,"message":"staging.task-log.copying-out","log_level":"info","source":"Staging","data":{"app_guid":"2bd6ad8c-021d-4cf5-9d74-14da1b737279","task_id":"4dcbc93ebf754d688e82d4a4318b7248","source":"/tmp/staged/logs/staging_task.log","destination":"/var/vcap/data/dea_next/staging/d20151127-7360-eo7hdz/staging_task.log"},"thread_id":70217601618680,"fiber_id":70217613046200,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/staging/staging_task.rb","lineno":258,"method":"block in promise_task_log"}
{"timestamp":1448615162.537548,"message":"staging.task.failed","log_level":"info","source":"Staging","data":{"app_guid":"2bd6ad8c-021d-4cf5-9d74-14da1b737279","task_id":"4dcbc93ebf754d688e82d4a4318b7248","error":"Script exited with status 1","backtrace":["/var/vcap/packages/dea_next/lib/container/container.rb:184:in `link_or_raise'","/var/vcap/packages/dea_next/lib/dea/staging/staging_task.rb:245:in `block in promise_stage'","/var/vcap/packages/dea_next/lib/dea/promise.rb:92:in `call'","/var/vcap/packages/dea_next/lib/dea/promise.rb:92:in `block in run'"]},"thread_id":70217601618680,"fiber_id":70217611626220,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/staging/staging_task.rb","lineno":57,"method":"block in start"}
{"timestamp":1448615162.5392828,"message":"Saving snapshot took: 0.000s","log_level":"debug","source":"Snapshot","data":{},"thread_id":70217601618680,"fiber_id":70217611626220,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/snapshot.rb","lineno":41,"method":"save"}
{"timestamp":1448615162.8901799,"message":"Caught exception: Script exited with status 1","log_level":"warn","source":"Dea::Promise","data":{"backtrace":["/var/vcap/packages/dea_next/lib/container/container.rb:184:in `link_or_raise'","/var/vcap/packages/dea_next/lib/dea/staging/staging_task.rb:245:in `block in promise_stage'","/var/vcap/packages/dea_next/lib/dea/promise.rb:92:in `call'","/var/vcap/packages/dea_next/lib/dea/promise.rb:92:in `block in run'"]},"thread_id":70217601618680,"fiber_id":70217611626220,"process_id":7360,"file":"/var/vcap/packages/dea_next/lib/dea/promise.rb","lineno":22,"method":"rescue in block in resolve"}

Running # make (eg. as root on my local machine, Linux) doesn't seem to make any difference here.

Can you help me out in debugging and/or resolving this matter?

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/109062258.

Do we need to run this rootfs building (eg. make) in a fakeroot, I don't think this should make a huge difference since I already did a (real) root run on my local machine?

@djvdorp - I don't think this is related to your stack; it sounds like it's an issue with the python buildpack.

Can you tell us:

  • what version of cf-release you're running
  • what version of the python buildpack you're running (cached or uncached? did you build it yourself or are you using stock from cf-release?)

@flavorjones - Thanks for your reply!
I have the feeling that the error thrown is related to this line in dea_ng where the directory support_heroku_buildpacks occurs.

We were actually just trying to build our own stack to experiment with, and just used a very simple python project to check if the stack was still functioning and had no issues (like this one). We eventually want to use that custom stack with our own buildpack instead.

Could this, by any chance, be related to this issue regarding rootfs permissions I just stumbled upon:
cf-release Issue #722 Preserve rootfs permissions

The fix for this happens to be added to the next version of cf, cf-release v213.