jekyll-docker: an error while trying to write to `/usr/gem/cache`

  • [ X] I Am on Linux
    • [X ] Ubuntu
  • [ X] I’m on Docker
    • [ X] I understand Docker may be unsupported

Description

➜ docker run --volume="$PWD:/srv/jekyll" -p 4000:4000 -it jekyll/jekyll jekyll serve                          Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Using concurrent-ruby 1.1.6
Using i18n 0.9.5
Bundler::PermissionError: There was an error while trying to write to `/usr/gem/cache`. It is likely that you
need to grant write permissions for that path.
An error occurred while installing minitest (5.14.0), and Bundler cannot continue.
Make sure that `gem install minitest -v '5.14.0' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  github-pages was resolved to 204, which depends on
    jekyll-mentions was resolved to 1.5.1, which depends on
      html-pipeline was resolved to 2.12.3, which depends on
        activesupport was resolved to 6.0.2.2, which depends on
          minitest

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 17
  • Comments: 21 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Taking a look at this now, to figure out what’s changed in the base image that’s breaking everything and to re-fix builds that are broken.

We have been using jekyll/jekyll:4.0.0 for a few weeks without any such issues, until yesterday (April 23rd 2020) when it suddenly looks like the base image has radically changed and nothing seems to work anymore.

With an enormous amount of chown, mkdir -p and customisation we’ve gotten this to work, but that’s beside the point. The pont here is: Did jekyll/jekyll:4.0.0 change in any way a day ago? From the information on Docker Hub, it certainly looks like it:

Last pushed: a day ago by envygeeks

Information about what was pushed a day ago would be highly appreciated. I don’t know if “last pushed” metadata is for the jekyll/jekyll container in general or the :4.0.0 tag specifically, but if it is for the tag, this is pretty bad. A major.minor.patch tag shouldn’t be changed, imho.

Regardless of what was pushed to Docker Hub yesterday, it’s a bit worrying that it is without trace in this GitHub repository, as the latest commit here (d567ca8e579ba0798a1a1137f3aab0fd06a75fb6) was made almost two months ago, on March 6th – creating FUNDING.yml, completely unrelated to the problems we’re experiencig here.

This issue has been fixed, new images have been deployed, and the builders have moved to Github actions, I’ve not implemented the nightly cron yet for security updates, but I have kicked off the initial build, new images should be up within 10 minutes.

Another ticket points that Gem might also be causing issues, so I’ll need to do a bit more work this weekend to get everything sorted out. I’ll have to shim Gem like I do bundle to make sure that it keeps it’s permissions, or sets keeps them.

I fixed this by chown /usr/gem with jekyll:jekyll user:

docker run --rm -p 4000:4000 --volume="$PWD:/srv/jekyll" -it jekyll/jekyll bash -c 'chown jekyll:jekyll -R /usr/gem && jekyll serve'

To add tho this I found a similar problem when running this in a concourse pipeline. Error started on Thursday April 23rd as well. It looks like adding the chown jekyll:jekyll -R /usr/gem before jekyll build -d /var/jekyll is a work around. Still following if the image gets updated for this.

  • rm -fr ‘/var/jekyll/*’
  • jekyll build -d /var/jekyll Fetching gem metadata from https://rubygems.org/Bundler::PermissionError: There was an error while trying to write to /usr/gem/cache. It is likely that you need to grant write permissions for that path. An error occurred while installing public_suffix (3.1.0), and Bundler cannot continue. Make sure that gem install public_suffix -v '3.1.0' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile: jekyll-asciidoc was resolved to 2.1.1, which depends on jekyll was resolved to 3.8.5, which depends on addressable was resolved to 2.6.0, which depends on public_suffix

Yesterday I was indeed able to trace the problem back to bunder in some way, I just didn’t know if it was related to Dockers Alpine Ruby image or if it was related to something else. Bundler seems to entirely ignore BUNDLE_HOME and BUNDLE_CACHE_PATH since at least late March, I do have a bug open as rubygems/rubygems#3572 and I do have a fix in place ready to deploy I do not however understand how it happened, or why, part of me feels like the Bundler RubyGems merge mucked up a lot of features that have existed for a long while.

Thank you for this offer! I’ve stripped down the project to a shareable minimal example, available here (Git URL: https://dgit.cs.uni-saarland.de/fefrei/depend-web-mwe.git). A failing build log is here.

@fefrei is your source available somewhere I can clone and debug why it’s falling?

I can do an outright chown, which I considered but that would pose a performance issue on boot. Not that most people will notice or care but I’ll consider it.

It should be deploying another fix.