Solvedbootsnap Errno::EACCES: Permission denied

When we added bootsnap to our application we started getting the following errors whenever we run anything:

"Errno::EACCES: Permission denied",
"/app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.1.2/lib/bootsnap/compile_cache/iseq.rb:37:in `fetch'",
"/app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.1.2/lib/bootsnap/compile_cache/iseq.rb:37:in `load_iseq'",
"/app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.1.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'",
"/app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.1.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'",
"/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `block in require'",
"/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'",
"/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'",
"/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.2/lib/active_record/railtie.rb:34:in `block (3 levels) in <class:Railtie>'",
"/app/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'",

Cache path is /app/tmp/cache/bootsnap-compile-cache, which writable for the processes running tasks.

Also, some files are created:

$ /app/tmp/cache/bootsnap-compile-cache$ ls
00  05  0a  0f  14  19  1e  23  28  2d  32  37  3c  41  46  4b  50  55  5a  5f  64  69  6e  73  78  7d  82  87  8c  91  96  9b  a0  a5  aa  af  b4  b9  be  c3  c8  cd  d2  d7  dc  e1  e6  eb  f0  f5  fa  ff
01  06  0b  10  15  1a  1f  24  29  2e  33  38  3d  42  47  4c  51  56  5b  60  65  6a  6f  74  79  7e  83  88  8d  92  97  9c  a1  a6  ab  b0  b5  ba  bf  c4  c9  ce  d3  d8  dd  e2  e7  ec  f1  f6  fb
02  07  0c  11  16  1b  20  25  2a  2f  34  39  3e  43  48  4d  52  57  5c  61  66  6b  70  75  7a  7f  84  89  8e  93  98  9d  a2  a7  ac  b1  b6  bb  c0  c5  ca  cf  d4  d9  de  e3  e8  ed  f2  f7  fc
03  08  0d  12  17  1c  21  26  2b  30  35  3a  3f  44  49  4e  53  58  5d  62  67  6c  71  76  7b  80  85  8a  8f  94  99  9e  a3  a8  ad  b2  b7  bc  c1  c6  cb  d0  d5  da  df  e4  e9  ee  f3  f8  fd
04  09  0e  13  18  1d  22  27  2c  31  36  3b  40  45  4a  4f  54  59  5e  63  68  6d  72  77  7c  81  86  8b  90  95  9a  9f  a4  a9  ae  b3  b8  bd  c2  c7  cc  d1  d6  db  e0  e5  ea  ef  f4  f9  fe

Ruby 2.4.1, bootsnap 1.1.2.

34 Answers

✔️Accepted Answer

For me, I removed bootsnap gem from the Gemfile as well as a line of code loading bootsnap from boot.rb. The problem solved.

Other Answers:

You can't just chown -R $appuser tmp/cache before starting?

@niyando we added the ec2 user to the same group as the user who creates the app. Credit goes to @a14m.

This is the ebextensions file:

commands:
  25_add_ec2_user_to_webapp_group:
    command: "usermod -a -G webapp ec2-user"
  30_create_post_deploy_dir:
    command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
    ignoreErrors: true
 files:
  "/opt/elasticbeanstalk/hooks/appdeploy/post/99_grant_group_ownership_over_new_app_version":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      chmod -R g=u /var/app/current

I get this error with a Rails app deployed via AWS ElasticBeanstalk whenever I want to run a rails/rake command on the EC2 instance. I couldn't find a work-around so far.

I had this issue (Permission denied - bs_fetch:atomic_write_cache_file:open) when upgrading my project to Rails 5.2 on Ubuntu and Nginx. Changing permissions of cache/bootsnap-compile-cache to 777 solved the problem - although it doesn't sound right.

More Issues: