Skip to content

Quick Start Instructions On Code Space Wrong #2519

@ZAKosma

Description

@ZAKosma

Content pulled from this thread
rubygems/rubygems#6092

I think the following is the explanation of what's going on:

TL;DR

That wiki page tutorial is wrong, please submit an issue to Canvas-LMS so that they fix their "Quick Start" instructions. I think the long explanation below should be useful for Canvas-LMS maintainers to fix their instructions.

Long explanation

I don't see any codespace configuration in that repository. When there's no codespace configuration, GitHub will use a "universal image", which is defined here. That image includes Ruby as a feature here. That's the install script I linked to before. This means a default codespace includes Ruby 3.1 (and Ruby 3.0 additionally), both installed and managed by RVM.

Quick start instructions start by installing a OS-packaged Ruby (apt-get install ruby), which is Ruby 2.7. This should take no effect since RVM is configured, which takes priority. However, then there are several instructions recommending different sudo gem install commands. These are all wrong and unnecessary. There are several reasons for this which explain the error reported here:

  • sudo does not preserve the original PATH when invoked, so the binstubs installed by those commands will have a shebang pointing to the OS-packaged ruby (because RVM is no longer in PATH), and that will cause the OS packaged Ruby to be run when those binstubs are executed. In particular, because of this, the bundle _2.2.33_ install command will run under Ruby 2.7, but with environment configured for Ruby 3.1. This explains the mix and match between Ruby versions in the backtrace of the error.
  • Those sudo gem install not only install wrong binstubs, but also corrupt permissions of RVM managed folders, because they will be created with root permissions, and when the low privileges command bundle _2.2.33_ install runs, it cannot create any installed files on those folders due to this. This explains the Errno::EACCES: Permission denied @ dir_s_mkdir - /usr/local/rvm/gems/ruby-3.1.3/extensions/x86_64-linux/2.7.0/racc-1.6.0 wording in the error reported.

How to get unblocked

There's several things you can try until you get an answer from Canvas-LMS maintainers, such as:

  • Completely ignore all sudo commands and use preinstalled Ruby and Bundler. So, run bundle install as soon as the codespace is built.
  • If Canvas-LMS really needs Ruby 2.7, then use RVM to install and use that Ruby. Head over to https://github.com/rvm/rvm for instructions on how to do this. And again, don't install OS-packaged Ruby through apt get and don't run any gem install commands with sudo.

I hope you found this useful and can get rid of this problem and focus on what you were tying to do. Good luck!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions