Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

75%
+4 −0
Q&A How to get QPixel bundle install working without sudo privileges on Debian?

2 answers  ·  posted 10mo ago by zetyty‭  ·  last activity 10mo ago by zetyty‭

Question support
#6: Post edited by user avatar zetyty‭ · 2023-07-14T20:22:12Z (10 months ago)
change Debian 12 install iso link
  • When I tried to install QPixel with `bundle install` I got the following message (on Debian 11):
  • ```
  • ~/qpixel$ bundle install
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • ```
  • Then I am asked for the sudo password and afterwards a lot of orange warnings appear like this one (several for each "fetched" `gem`):
  • ```
  • Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • And then the installation stops with the following red error message (similar error messages are displayed):
  • <details>
  • <summary>
  • ```
  • Bundler::PermissionError: There was an error while trying to write to
  • `/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that
  • you need to grant write permissions for that path.
  • ```
  • </summary>
  • ```
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • An error occurred while installing minitest (5.16.3), and Bundler cannot continue.
  • [..] # Similar error messages apears after
  • ```
  • </details>
  • So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
  • ```
  • ~/qpixel$ sudo bundle install
  • Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
  • [..] # After, the installation proceeds correctly
  • ```
  • It seems to work fine because I have not detected any problem when running the local instance of QPixel, even if I start it with `rails s` without `sudo`.
  • But my questions are:
  • 1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
  • 2. **How to avoid using `sudo` to obtain a successful QPixel `bundle install`?**
  • I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...
  • **EDIT 1.1 after [answer](https://collab.codidact.org/posts/288973/288978#answer-288978):** If I try to install bundle WITHOUT sudo, I got the following error message:
  • ```
  • ~/qpixel$ gem install bundler
  • Fetching bundler-2.4.16.gem
  • ERROR: While executing gem ... (Gem::FilePermissionError)
  • You don't have write permissions for the /var/lib/gems/3.1.0 directory.
  • ```
  • # Set up
  • ## WSL2 Debian 11
  • I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:
  • ```
  • sudo apt install bundler
  • ```
  • Ruby installed with:
  • ```
  • curl -sSL https://get.rvm.io | bash -s stable
  • ```
  • **EDIT 1.2 after [answer](https://collab.codidact.org/posts/288973/288978#answer-288978):**
  • <details>
  • <summary>
  • Output of `gem env` ("tyty" is the Debian user and "Rigal" is the Windows host user)
  • </summary>
  • ```
  • ~/qpixel$ gem env
  • RubyGems Environment:
  •   - RUBYGEMS VERSION: 3.3.15
  •   - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  •   - INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  •   - USER INSTALLATION DIRECTORY: /home/tyty/.local/share/gem/ruby/3.1.0
  •   - RUBY EXECUTABLE: /usr/bin/ruby3.1
  •   - GIT EXECUTABLE: /usr/bin/git
  •   - EXECUTABLE DIRECTORY: /usr/local/bin
  •   - SPEC CACHE DIRECTORY: /home/tyty/.local/share/gem/specs
  •   - SYSTEM CONFIGURATION DIRECTORY: /etc
  •   - RUBYGEMS PLATFORMS:
  •      - ruby
  •      - x86_64-linux
  •   - GEM PATHS:
  •      - /var/lib/gems/3.1.0
  •      - /home/tyty/.local/share/gem/ruby/3.1.0
  •      - /usr/local/lib/ruby/gems/3.1.0
  •      - /usr/lib/ruby/gems/3.1.0
  •      - /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
  •      - /usr/share/rubygems-integration/3.1.0
  •      - /usr/share/rubygems-integration/all
  •      - /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  •   - GEM CONFIGURATION:
  •      - :update_sources => true
  •      - :verbose => true
  •      - :backtrace => false
  •      - :bulk_threshold => 1000
  •   - REMOTE SOURCES:
  •      - https://rubygems.org/
  •   - SHELL PATH:
  •      - /usr/local/sbin
  •      - /usr/local/bin
  •      - /usr/sbin
  •      - /usr/bin
  •      - /sbin
  •      - /bin
  •      - /usr/games
  •      - /usr/local/games
  •      - /usr/lib/wsl/lib
  •      - /mnt/c/Python311/Scripts/
  •      - /mnt/c/Python311/
  •      - /mnt/c/Program Files/ImageMagick-7.1.1-Q16-HDRI
  •      - /mnt/c/Program Files/ImageMagick-7.1.0-Q16-HDRI
  •      - /mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath
  •      - /mnt/c/WINDOWS/system32
  •      - /mnt/c/WINDOWS
  •      - /mnt/c/WINDOWS/System32/Wbem
  •      - /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/
  •      - /mnt/c/WINDOWS/System32/OpenSSH/
  •      - /mnt/c/Program Files (x86)/Calibre2/
  •      - /mnt/c/Strawberry/c/bin
  •      - /mnt/c/Strawberry/perl/site/bin
  •      - /mnt/c/Strawberry/perl/bin
  •      - /mnt/c/Program Files/MATLAB/R2021b/bin
  •      - /mnt/c/Program Files/nodejs/
  •      - /mnt/c/ProgramData/chocolatey/bin
  •      - /mnt/c/Ruby32-x64/bin
  •      - /mnt/c/Users/Rigal/AppData/Local/Microsoft/WindowsApps
  •      - /mnt/c/Users/Rigal/AppData/Local/atom/bin
  •      - /mnt/c/Users/Rigal/AppData/Local/Programs/MiKTeX/miktex/bin/x64/
  •      - /mnt/c/Users/Rigal/AppData/Local/Programs/Git/cmd
  •      - /mnt/c/Users/Rigal/AppData/Roaming/npm
  •      - /mnt/c/Users/Rigal/AppData/Local/Microsoft/WindowsApps
  •      - /home/tyty/.rvm/bin
  •      - /home/tyty/.rvm/binSylvain RIGAL
  • ```
  • </details>
  • ## Debian 12 on VBox
  • Also tried with a fresh install of Debian 12 (iso image [debian-12.0.0-amd64-netinst.iso](https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.0.0-amd64-netinst.iso)) on Virtual Box (version 7.0.8) on Windows 11 22H2 Host.
  • Ruby installed with rbenv:
  • ```
  • sudo apt install rbenv
  • rbenv install 3.1.2 # WITHOUT sudo!
  • sudo gem install bundler
  • ```
  • The same errors occurs when trying the QPixel `bundle install` without `sudo` and if I tried to install `bundle` without `sudo` (i.e. with `gem install bundler`), see EDIT 1.1.
  • <details>
  • <summary>
  • Output of `gem env` ("tyty" is the Debian user, and note that I tried to install first Ruby with rvm (but it fails) before to install it with rbenv...)
  • </summary>
  • ```
  • ~/qpixel$ gem env
  • RubyGems Environment:
  • - RUBYGEMS VERSION: 3.3.15
  • - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  • - INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  • - USER INSTALLATION DIRECTORY: /home/tyty/.local/share/gem/ruby/3.1.0
  • - RUBY EXECUTABLE: /usr/bin/ruby3.1
  • - GIT EXECUTABLE: /usr/bin/git
  • - EXECUTABLE DIRECTORY: /usr/local/bin
  • - SPEC CACHE DIRECTORY: /home/tyty/.local/share/gem/specs
  • - SYSTEM CONFIGURATION DIRECTORY: /etc
  • - RUBYGEMS PLATFORMS:
  • - ruby
  • - x86_64-linux
  • - GEM PATHS:
  • - /var/lib/gems/3.1.0
  • - /home/tyty/.local/share/gem/ruby/3.1.0
  • - /usr/local/lib/ruby/gems/3.1.0
  • - /usr/lib/ruby/gems/3.1.0
  • - /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
  • - /usr/share/rubygems-integration/3.1.0
  • - /usr/share/rubygems-integration/all
  • - /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  • - GEM CONFIGURATION:
  • - :update_sources => true
  • - :verbose => true
  • - :backtrace => false
  • - :bulk_threshold => 1000
  • - REMOTE SOURCES:
  • - https://rubygems.org/
  • - SHELL PATH:
  • - /usr/local/bin
  • - /usr/bin
  • - /bin
  • - /usr/local/games
  • - /usr/games
  • - /home/tyty/.rvm/bin
  • - /home/tyty/.rvm/bin
  • - /home/tyty/.rvm/bin
  • ```
  • </details>
  • When I tried to install QPixel with `bundle install` I got the following message (on Debian 11):
  • ```
  • ~/qpixel$ bundle install
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • ```
  • Then I am asked for the sudo password and afterwards a lot of orange warnings appear like this one (several for each "fetched" `gem`):
  • ```
  • Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • And then the installation stops with the following red error message (similar error messages are displayed):
  • <details>
  • <summary>
  • ```
  • Bundler::PermissionError: There was an error while trying to write to
  • `/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that
  • you need to grant write permissions for that path.
  • ```
  • </summary>
  • ```
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • An error occurred while installing minitest (5.16.3), and Bundler cannot continue.
  • [..] # Similar error messages apears after
  • ```
  • </details>
  • So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
  • ```
  • ~/qpixel$ sudo bundle install
  • Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
  • [..] # After, the installation proceeds correctly
  • ```
  • It seems to work fine because I have not detected any problem when running the local instance of QPixel, even if I start it with `rails s` without `sudo`.
  • But my questions are:
  • 1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
  • 2. **How to avoid using `sudo` to obtain a successful QPixel `bundle install`?**
  • I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...
  • **EDIT 1.1 after [answer](https://collab.codidact.org/posts/288973/288978#answer-288978):** If I try to install bundle WITHOUT sudo, I got the following error message:
  • ```
  • ~/qpixel$ gem install bundler
  • Fetching bundler-2.4.16.gem
  • ERROR: While executing gem ... (Gem::FilePermissionError)
  • You don't have write permissions for the /var/lib/gems/3.1.0 directory.
  • ```
  • # Set up
  • ## WSL2 Debian 11
  • I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:
  • ```
  • sudo apt install bundler
  • ```
  • Ruby installed with:
  • ```
  • curl -sSL https://get.rvm.io | bash -s stable
  • ```
  • **EDIT 1.2 after [answer](https://collab.codidact.org/posts/288973/288978#answer-288978):**
  • <details>
  • <summary>
  • Output of `gem env` ("tyty" is the Debian user and "Rigal" is the Windows host user)
  • </summary>
  • ```
  • ~/qpixel$ gem env
  • RubyGems Environment:
  •   - RUBYGEMS VERSION: 3.3.15
  •   - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  •   - INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  •   - USER INSTALLATION DIRECTORY: /home/tyty/.local/share/gem/ruby/3.1.0
  •   - RUBY EXECUTABLE: /usr/bin/ruby3.1
  •   - GIT EXECUTABLE: /usr/bin/git
  •   - EXECUTABLE DIRECTORY: /usr/local/bin
  •   - SPEC CACHE DIRECTORY: /home/tyty/.local/share/gem/specs
  •   - SYSTEM CONFIGURATION DIRECTORY: /etc
  •   - RUBYGEMS PLATFORMS:
  •      - ruby
  •      - x86_64-linux
  •   - GEM PATHS:
  •      - /var/lib/gems/3.1.0
  •      - /home/tyty/.local/share/gem/ruby/3.1.0
  •      - /usr/local/lib/ruby/gems/3.1.0
  •      - /usr/lib/ruby/gems/3.1.0
  •      - /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
  •      - /usr/share/rubygems-integration/3.1.0
  •      - /usr/share/rubygems-integration/all
  •      - /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  •   - GEM CONFIGURATION:
  •      - :update_sources => true
  •      - :verbose => true
  •      - :backtrace => false
  •      - :bulk_threshold => 1000
  •   - REMOTE SOURCES:
  •      - https://rubygems.org/
  •   - SHELL PATH:
  •      - /usr/local/sbin
  •      - /usr/local/bin
  •      - /usr/sbin
  •      - /usr/bin
  •      - /sbin
  •      - /bin
  •      - /usr/games
  •      - /usr/local/games
  •      - /usr/lib/wsl/lib
  •      - /mnt/c/Python311/Scripts/
  •      - /mnt/c/Python311/
  •      - /mnt/c/Program Files/ImageMagick-7.1.1-Q16-HDRI
  •      - /mnt/c/Program Files/ImageMagick-7.1.0-Q16-HDRI
  •      - /mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath
  •      - /mnt/c/WINDOWS/system32
  •      - /mnt/c/WINDOWS
  •      - /mnt/c/WINDOWS/System32/Wbem
  •      - /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/
  •      - /mnt/c/WINDOWS/System32/OpenSSH/
  •      - /mnt/c/Program Files (x86)/Calibre2/
  •      - /mnt/c/Strawberry/c/bin
  •      - /mnt/c/Strawberry/perl/site/bin
  •      - /mnt/c/Strawberry/perl/bin
  •      - /mnt/c/Program Files/MATLAB/R2021b/bin
  •      - /mnt/c/Program Files/nodejs/
  •      - /mnt/c/ProgramData/chocolatey/bin
  •      - /mnt/c/Ruby32-x64/bin
  •      - /mnt/c/Users/Rigal/AppData/Local/Microsoft/WindowsApps
  •      - /mnt/c/Users/Rigal/AppData/Local/atom/bin
  •      - /mnt/c/Users/Rigal/AppData/Local/Programs/MiKTeX/miktex/bin/x64/
  •      - /mnt/c/Users/Rigal/AppData/Local/Programs/Git/cmd
  •      - /mnt/c/Users/Rigal/AppData/Roaming/npm
  •      - /mnt/c/Users/Rigal/AppData/Local/Microsoft/WindowsApps
  •      - /home/tyty/.rvm/bin
  •      - /home/tyty/.rvm/binSylvain RIGAL
  • ```
  • </details>
  • ## Debian 12 on VBox
  • Also tried with a fresh install of Debian 12 (iso image [debian-12.0.0-amd64-netinst.iso](https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/)) on Virtual Box (version 7.0.8) on Windows 11 22H2 Host.
  • Ruby installed with rbenv:
  • ```
  • sudo apt install rbenv
  • rbenv install 3.1.2 # WITHOUT sudo!
  • sudo gem install bundler
  • ```
  • The same errors occurs when trying the QPixel `bundle install` without `sudo` and if I tried to install `bundle` without `sudo` (i.e. with `gem install bundler`), see EDIT 1.1.
  • <details>
  • <summary>
  • Output of `gem env` ("tyty" is the Debian user, and note that I tried to install first Ruby with rvm (but it fails) before to install it with rbenv...)
  • </summary>
  • ```
  • ~/qpixel$ gem env
  • RubyGems Environment:
  • - RUBYGEMS VERSION: 3.3.15
  • - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  • - INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  • - USER INSTALLATION DIRECTORY: /home/tyty/.local/share/gem/ruby/3.1.0
  • - RUBY EXECUTABLE: /usr/bin/ruby3.1
  • - GIT EXECUTABLE: /usr/bin/git
  • - EXECUTABLE DIRECTORY: /usr/local/bin
  • - SPEC CACHE DIRECTORY: /home/tyty/.local/share/gem/specs
  • - SYSTEM CONFIGURATION DIRECTORY: /etc
  • - RUBYGEMS PLATFORMS:
  • - ruby
  • - x86_64-linux
  • - GEM PATHS:
  • - /var/lib/gems/3.1.0
  • - /home/tyty/.local/share/gem/ruby/3.1.0
  • - /usr/local/lib/ruby/gems/3.1.0
  • - /usr/lib/ruby/gems/3.1.0
  • - /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
  • - /usr/share/rubygems-integration/3.1.0
  • - /usr/share/rubygems-integration/all
  • - /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  • - GEM CONFIGURATION:
  • - :update_sources => true
  • - :verbose => true
  • - :backtrace => false
  • - :bulk_threshold => 1000
  • - REMOTE SOURCES:
  • - https://rubygems.org/
  • - SHELL PATH:
  • - /usr/local/bin
  • - /usr/bin
  • - /bin
  • - /usr/local/games
  • - /usr/games
  • - /home/tyty/.rvm/bin
  • - /home/tyty/.rvm/bin
  • - /home/tyty/.rvm/bin
  • ```
  • </details>
#5: Post edited by user avatar zetyty‭ · 2023-07-13T11:03:34Z (10 months ago)
add "sudo apt install rbenv" to the "Debian 12 VBox install" section
  • When I tried to install QPixel with `bundle install` I got the following message (on Debian 11):
  • ```
  • ~/qpixel$ bundle install
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • ```
  • Then I am asked for the sudo password and afterwards a lot of orange warnings appear like this one (several for each "fetched" `gem`):
  • ```
  • Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • And then the installation stops with the following red error message (similar error messages are displayed):
  • <details>
  • <summary>
  • ```
  • Bundler::PermissionError: There was an error while trying to write to
  • `/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that
  • you need to grant write permissions for that path.
  • ```
  • </summary>
  • ```
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • An error occurred while installing minitest (5.16.3), and Bundler cannot continue.
  • [..] # Similar error messages apears after
  • ```
  • </details>
  • So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
  • ```
  • ~/qpixel$ sudo bundle install
  • Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
  • [..] # After, the installation proceeds correctly
  • ```
  • It seems to work fine because I have not detected any problem when running the local instance of QPixel, even if I start it with `rails s` without `sudo`.
  • But my questions are:
  • 1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
  • 2. **How to avoid using `sudo` to obtain a successful QPixel `bundle install`?**
  • I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...
  • **EDIT 1.1 after [answer](https://collab.codidact.org/posts/288973/288978#answer-288978):** If I try to install bundle WITHOUT sudo, I got the following error message:
  • ```
  • ~/qpixel$ gem install bundler
  • Fetching bundler-2.4.16.gem
  • ERROR: While executing gem ... (Gem::FilePermissionError)
  • You don't have write permissions for the /var/lib/gems/3.1.0 directory.
  • ```
  • # Set up
  • ## WSL2 Debian 11
  • I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:
  • ```
  • sudo apt install bundler
  • ```
  • Ruby installed with:
  • ```
  • curl -sSL https://get.rvm.io | bash -s stable
  • ```
  • **EDIT 1.2 after [answer](https://collab.codidact.org/posts/288973/288978#answer-288978):**
  • <details>
  • <summary>
  • Output of `gem env` ("tyty" is the Debian user and "Rigal" is the Windows host user)
  • </summary>
  • ```
  • ~/qpixel$ gem env
  • RubyGems Environment:
  •   - RUBYGEMS VERSION: 3.3.15
  •   - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  •   - INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  •   - USER INSTALLATION DIRECTORY: /home/tyty/.local/share/gem/ruby/3.1.0
  •   - RUBY EXECUTABLE: /usr/bin/ruby3.1
  •   - GIT EXECUTABLE: /usr/bin/git
  •   - EXECUTABLE DIRECTORY: /usr/local/bin
  •   - SPEC CACHE DIRECTORY: /home/tyty/.local/share/gem/specs
  •   - SYSTEM CONFIGURATION DIRECTORY: /etc
  •   - RUBYGEMS PLATFORMS:
  •      - ruby
  •      - x86_64-linux
  •   - GEM PATHS:
  •      - /var/lib/gems/3.1.0
  •      - /home/tyty/.local/share/gem/ruby/3.1.0
  •      - /usr/local/lib/ruby/gems/3.1.0
  •      - /usr/lib/ruby/gems/3.1.0
  •      - /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
  •      - /usr/share/rubygems-integration/3.1.0
  •      - /usr/share/rubygems-integration/all
  •      - /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  •   - GEM CONFIGURATION:
  •      - :update_sources => true
  •      - :verbose => true
  •      - :backtrace => false
  •      - :bulk_threshold => 1000
  •   - REMOTE SOURCES:
  •      - https://rubygems.org/
  •   - SHELL PATH:
  •      - /usr/local/sbin
  •      - /usr/local/bin
  •      - /usr/sbin
  •      - /usr/bin
  •      - /sbin
  •      - /bin
  •      - /usr/games
  •      - /usr/local/games
  •      - /usr/lib/wsl/lib
  •      - /mnt/c/Python311/Scripts/
  •      - /mnt/c/Python311/
  •      - /mnt/c/Program Files/ImageMagick-7.1.1-Q16-HDRI
  •      - /mnt/c/Program Files/ImageMagick-7.1.0-Q16-HDRI
  •      - /mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath
  •      - /mnt/c/WINDOWS/system32
  •      - /mnt/c/WINDOWS
  •      - /mnt/c/WINDOWS/System32/Wbem
  •      - /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/
  •      - /mnt/c/WINDOWS/System32/OpenSSH/
  •      - /mnt/c/Program Files (x86)/Calibre2/
  •      - /mnt/c/Strawberry/c/bin
  •      - /mnt/c/Strawberry/perl/site/bin
  •      - /mnt/c/Strawberry/perl/bin
  •      - /mnt/c/Program Files/MATLAB/R2021b/bin
  •      - /mnt/c/Program Files/nodejs/
  •      - /mnt/c/ProgramData/chocolatey/bin
  •      - /mnt/c/Ruby32-x64/bin
  •      - /mnt/c/Users/Rigal/AppData/Local/Microsoft/WindowsApps
  •      - /mnt/c/Users/Rigal/AppData/Local/atom/bin
  •      - /mnt/c/Users/Rigal/AppData/Local/Programs/MiKTeX/miktex/bin/x64/
  •      - /mnt/c/Users/Rigal/AppData/Local/Programs/Git/cmd
  •      - /mnt/c/Users/Rigal/AppData/Roaming/npm
  •      - /mnt/c/Users/Rigal/AppData/Local/Microsoft/WindowsApps
  •      - /home/tyty/.rvm/bin
  •      - /home/tyty/.rvm/binSylvain RIGAL
  • ```
  • </details>
  • ## Debian 12 on VBox
  • Also tried with a fresh install of Debian 12 (iso image [debian-12.0.0-amd64-netinst.iso](https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.0.0-amd64-netinst.iso)) on Virtual Box (version 7.0.8) on Windows 11 22H2 Host.
  • Ruby installed with rbenv:
  • ```
  • rbenv install 3.1.2 # WITHOUT sudo!
  • sudo gem install bundler
  • ```
  • The same errors occurs when trying the QPixel `bundle install` without `sudo` and if I tried to install `bundle` without `sudo` (i.e. with `gem install bundler`), see EDIT 1.1.
  • <details>
  • <summary>
  • Output of `gem env` ("tyty" is the Debian user, and note that I tried to install first Ruby with rvm (but it fails) before to install it with rbenv...)
  • </summary>
  • ```
  • ~/qpixel$ gem env
  • RubyGems Environment:
  • - RUBYGEMS VERSION: 3.3.15
  • - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  • - INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  • - USER INSTALLATION DIRECTORY: /home/tyty/.local/share/gem/ruby/3.1.0
  • - RUBY EXECUTABLE: /usr/bin/ruby3.1
  • - GIT EXECUTABLE: /usr/bin/git
  • - EXECUTABLE DIRECTORY: /usr/local/bin
  • - SPEC CACHE DIRECTORY: /home/tyty/.local/share/gem/specs
  • - SYSTEM CONFIGURATION DIRECTORY: /etc
  • - RUBYGEMS PLATFORMS:
  • - ruby
  • - x86_64-linux
  • - GEM PATHS:
  • - /var/lib/gems/3.1.0
  • - /home/tyty/.local/share/gem/ruby/3.1.0
  • - /usr/local/lib/ruby/gems/3.1.0
  • - /usr/lib/ruby/gems/3.1.0
  • - /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
  • - /usr/share/rubygems-integration/3.1.0
  • - /usr/share/rubygems-integration/all
  • - /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  • - GEM CONFIGURATION:
  • - :update_sources => true
  • - :verbose => true
  • - :backtrace => false
  • - :bulk_threshold => 1000
  • - REMOTE SOURCES:
  • - https://rubygems.org/
  • - SHELL PATH:
  • - /usr/local/bin
  • - /usr/bin
  • - /bin
  • - /usr/local/games
  • - /usr/games
  • - /home/tyty/.rvm/bin
  • - /home/tyty/.rvm/bin
  • - /home/tyty/.rvm/bin
  • ```
  • </details>
  • When I tried to install QPixel with `bundle install` I got the following message (on Debian 11):
  • ```
  • ~/qpixel$ bundle install
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • ```
  • Then I am asked for the sudo password and afterwards a lot of orange warnings appear like this one (several for each "fetched" `gem`):
  • ```
  • Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • And then the installation stops with the following red error message (similar error messages are displayed):
  • <details>
  • <summary>
  • ```
  • Bundler::PermissionError: There was an error while trying to write to
  • `/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that
  • you need to grant write permissions for that path.
  • ```
  • </summary>
  • ```
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • An error occurred while installing minitest (5.16.3), and Bundler cannot continue.
  • [..] # Similar error messages apears after
  • ```
  • </details>
  • So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
  • ```
  • ~/qpixel$ sudo bundle install
  • Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
  • [..] # After, the installation proceeds correctly
  • ```
  • It seems to work fine because I have not detected any problem when running the local instance of QPixel, even if I start it with `rails s` without `sudo`.
  • But my questions are:
  • 1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
  • 2. **How to avoid using `sudo` to obtain a successful QPixel `bundle install`?**
  • I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...
  • **EDIT 1.1 after [answer](https://collab.codidact.org/posts/288973/288978#answer-288978):** If I try to install bundle WITHOUT sudo, I got the following error message:
  • ```
  • ~/qpixel$ gem install bundler
  • Fetching bundler-2.4.16.gem
  • ERROR: While executing gem ... (Gem::FilePermissionError)
  • You don't have write permissions for the /var/lib/gems/3.1.0 directory.
  • ```
  • # Set up
  • ## WSL2 Debian 11
  • I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:
  • ```
  • sudo apt install bundler
  • ```
  • Ruby installed with:
  • ```
  • curl -sSL https://get.rvm.io | bash -s stable
  • ```
  • **EDIT 1.2 after [answer](https://collab.codidact.org/posts/288973/288978#answer-288978):**
  • <details>
  • <summary>
  • Output of `gem env` ("tyty" is the Debian user and "Rigal" is the Windows host user)
  • </summary>
  • ```
  • ~/qpixel$ gem env
  • RubyGems Environment:
  •   - RUBYGEMS VERSION: 3.3.15
  •   - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  •   - INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  •   - USER INSTALLATION DIRECTORY: /home/tyty/.local/share/gem/ruby/3.1.0
  •   - RUBY EXECUTABLE: /usr/bin/ruby3.1
  •   - GIT EXECUTABLE: /usr/bin/git
  •   - EXECUTABLE DIRECTORY: /usr/local/bin
  •   - SPEC CACHE DIRECTORY: /home/tyty/.local/share/gem/specs
  •   - SYSTEM CONFIGURATION DIRECTORY: /etc
  •   - RUBYGEMS PLATFORMS:
  •      - ruby
  •      - x86_64-linux
  •   - GEM PATHS:
  •      - /var/lib/gems/3.1.0
  •      - /home/tyty/.local/share/gem/ruby/3.1.0
  •      - /usr/local/lib/ruby/gems/3.1.0
  •      - /usr/lib/ruby/gems/3.1.0
  •      - /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
  •      - /usr/share/rubygems-integration/3.1.0
  •      - /usr/share/rubygems-integration/all
  •      - /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  •   - GEM CONFIGURATION:
  •      - :update_sources => true
  •      - :verbose => true
  •      - :backtrace => false
  •      - :bulk_threshold => 1000
  •   - REMOTE SOURCES:
  •      - https://rubygems.org/
  •   - SHELL PATH:
  •      - /usr/local/sbin
  •      - /usr/local/bin
  •      - /usr/sbin
  •      - /usr/bin
  •      - /sbin
  •      - /bin
  •      - /usr/games
  •      - /usr/local/games
  •      - /usr/lib/wsl/lib
  •      - /mnt/c/Python311/Scripts/
  •      - /mnt/c/Python311/
  •      - /mnt/c/Program Files/ImageMagick-7.1.1-Q16-HDRI
  •      - /mnt/c/Program Files/ImageMagick-7.1.0-Q16-HDRI
  •      - /mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath
  •      - /mnt/c/WINDOWS/system32
  •      - /mnt/c/WINDOWS
  •      - /mnt/c/WINDOWS/System32/Wbem
  •      - /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/
  •      - /mnt/c/WINDOWS/System32/OpenSSH/
  •      - /mnt/c/Program Files (x86)/Calibre2/
  •      - /mnt/c/Strawberry/c/bin
  •      - /mnt/c/Strawberry/perl/site/bin
  •      - /mnt/c/Strawberry/perl/bin
  •      - /mnt/c/Program Files/MATLAB/R2021b/bin
  •      - /mnt/c/Program Files/nodejs/
  •      - /mnt/c/ProgramData/chocolatey/bin
  •      - /mnt/c/Ruby32-x64/bin
  •      - /mnt/c/Users/Rigal/AppData/Local/Microsoft/WindowsApps
  •      - /mnt/c/Users/Rigal/AppData/Local/atom/bin
  •      - /mnt/c/Users/Rigal/AppData/Local/Programs/MiKTeX/miktex/bin/x64/
  •      - /mnt/c/Users/Rigal/AppData/Local/Programs/Git/cmd
  •      - /mnt/c/Users/Rigal/AppData/Roaming/npm
  •      - /mnt/c/Users/Rigal/AppData/Local/Microsoft/WindowsApps
  •      - /home/tyty/.rvm/bin
  •      - /home/tyty/.rvm/binSylvain RIGAL
  • ```
  • </details>
  • ## Debian 12 on VBox
  • Also tried with a fresh install of Debian 12 (iso image [debian-12.0.0-amd64-netinst.iso](https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.0.0-amd64-netinst.iso)) on Virtual Box (version 7.0.8) on Windows 11 22H2 Host.
  • Ruby installed with rbenv:
  • ```
  • sudo apt install rbenv
  • rbenv install 3.1.2 # WITHOUT sudo!
  • sudo gem install bundler
  • ```
  • The same errors occurs when trying the QPixel `bundle install` without `sudo` and if I tried to install `bundle` without `sudo` (i.e. with `gem install bundler`), see EDIT 1.1.
  • <details>
  • <summary>
  • Output of `gem env` ("tyty" is the Debian user, and note that I tried to install first Ruby with rvm (but it fails) before to install it with rbenv...)
  • </summary>
  • ```
  • ~/qpixel$ gem env
  • RubyGems Environment:
  • - RUBYGEMS VERSION: 3.3.15
  • - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  • - INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  • - USER INSTALLATION DIRECTORY: /home/tyty/.local/share/gem/ruby/3.1.0
  • - RUBY EXECUTABLE: /usr/bin/ruby3.1
  • - GIT EXECUTABLE: /usr/bin/git
  • - EXECUTABLE DIRECTORY: /usr/local/bin
  • - SPEC CACHE DIRECTORY: /home/tyty/.local/share/gem/specs
  • - SYSTEM CONFIGURATION DIRECTORY: /etc
  • - RUBYGEMS PLATFORMS:
  • - ruby
  • - x86_64-linux
  • - GEM PATHS:
  • - /var/lib/gems/3.1.0
  • - /home/tyty/.local/share/gem/ruby/3.1.0
  • - /usr/local/lib/ruby/gems/3.1.0
  • - /usr/lib/ruby/gems/3.1.0
  • - /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
  • - /usr/share/rubygems-integration/3.1.0
  • - /usr/share/rubygems-integration/all
  • - /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  • - GEM CONFIGURATION:
  • - :update_sources => true
  • - :verbose => true
  • - :backtrace => false
  • - :bulk_threshold => 1000
  • - REMOTE SOURCES:
  • - https://rubygems.org/
  • - SHELL PATH:
  • - /usr/local/bin
  • - /usr/bin
  • - /bin
  • - /usr/local/games
  • - /usr/games
  • - /home/tyty/.rvm/bin
  • - /home/tyty/.rvm/bin
  • - /home/tyty/.rvm/bin
  • ```
  • </details>
#4: Post edited by user avatar zetyty‭ · 2023-07-13T10:46:13Z (10 months ago)
EDIT 1.1 and 1.2 after follow-up answer
  • How to get QPixel bundle install working without sudo privileges?
  • How to get QPixel bundle install working without sudo privileges on Debian?
  • When I tried to install QPixel with `bundle install` I got the following message (on Debian 11):
  • ```
  • ~/qpixel$ bundle install
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • ```
  • Then I am asked for the sudo password and afterwards a lot of orange warnings appear like this one (several for each "fetched" `gem`):
  • ```
  • Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • And then the installation stops with the following red error message (similar error messages are displayed):
  • <details>
  • <summary>
  • ```
  • Bundler::PermissionError: There was an error while trying to write to
  • `/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that
  • you need to grant write permissions for that path.
  • ```
  • </summary>
  • ```
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • An error occurred while installing minitest (5.16.3), and Bundler cannot continue.
  • [..] # Similar error messages apears after
  • ```
  • </details>
  • So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
  • ```
  • ~/qpixel$ sudo bundle install
  • Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
  • [..] # After, the installation proceeds correctly
  • ```
  • It seems to work fine because I have not detected any problem when running the local instance of QPixel, even if I start it with `rails s` without `sudo`.
  • But my questions are:
  • 1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
  • 2. **How to avoid using `sudo` to obtain a successful QPixel `bundle install`?**
  • I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...
  • # Set up
  • I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:
  • ```
  • sudo apt install bundler
  • ```
  • Ruby installed with:
  • ```
  • curl -sSL https://get.rvm.io | bash -s stable
  • ```
  • When I tried to install QPixel with `bundle install` I got the following message (on Debian 11):
  • ```
  • ~/qpixel$ bundle install
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • ```
  • Then I am asked for the sudo password and afterwards a lot of orange warnings appear like this one (several for each "fetched" `gem`):
  • ```
  • Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • And then the installation stops with the following red error message (similar error messages are displayed):
  • <details>
  • <summary>
  • ```
  • Bundler::PermissionError: There was an error while trying to write to
  • `/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that
  • you need to grant write permissions for that path.
  • ```
  • </summary>
  • ```
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • An error occurred while installing minitest (5.16.3), and Bundler cannot continue.
  • [..] # Similar error messages apears after
  • ```
  • </details>
  • So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
  • ```
  • ~/qpixel$ sudo bundle install
  • Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
  • [..] # After, the installation proceeds correctly
  • ```
  • It seems to work fine because I have not detected any problem when running the local instance of QPixel, even if I start it with `rails s` without `sudo`.
  • But my questions are:
  • 1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
  • 2. **How to avoid using `sudo` to obtain a successful QPixel `bundle install`?**
  • I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...
  • **EDIT 1.1 after [answer](https://collab.codidact.org/posts/288973/288978#answer-288978):** If I try to install bundle WITHOUT sudo, I got the following error message:
  • ```
  • ~/qpixel$ gem install bundler
  • Fetching bundler-2.4.16.gem
  • ERROR: While executing gem ... (Gem::FilePermissionError)
  • You don't have write permissions for the /var/lib/gems/3.1.0 directory.
  • ```
  • # Set up
  • ## WSL2 Debian 11
  • I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:
  • ```
  • sudo apt install bundler
  • ```
  • Ruby installed with:
  • ```
  • curl -sSL https://get.rvm.io | bash -s stable
  • ```
  • **EDIT 1.2 after [answer](https://collab.codidact.org/posts/288973/288978#answer-288978):**
  • <details>
  • <summary>
  • Output of `gem env` ("tyty" is the Debian user and "Rigal" is the Windows host user)
  • </summary>
  • ```
  • ~/qpixel$ gem env
  • RubyGems Environment:
  •   - RUBYGEMS VERSION: 3.3.15
  •   - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  •   - INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  •   - USER INSTALLATION DIRECTORY: /home/tyty/.local/share/gem/ruby/3.1.0
  •   - RUBY EXECUTABLE: /usr/bin/ruby3.1
  •   - GIT EXECUTABLE: /usr/bin/git
  •   - EXECUTABLE DIRECTORY: /usr/local/bin
  •   - SPEC CACHE DIRECTORY: /home/tyty/.local/share/gem/specs
  •   - SYSTEM CONFIGURATION DIRECTORY: /etc
  •   - RUBYGEMS PLATFORMS:
  •      - ruby
  •      - x86_64-linux
  •   - GEM PATHS:
  •      - /var/lib/gems/3.1.0
  •      - /home/tyty/.local/share/gem/ruby/3.1.0
  •      - /usr/local/lib/ruby/gems/3.1.0
  •      - /usr/lib/ruby/gems/3.1.0
  •      - /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
  •      - /usr/share/rubygems-integration/3.1.0
  •      - /usr/share/rubygems-integration/all
  •      - /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  •   - GEM CONFIGURATION:
  •      - :update_sources => true
  •      - :verbose => true
  •      - :backtrace => false
  •      - :bulk_threshold => 1000
  •   - REMOTE SOURCES:
  •      - https://rubygems.org/
  •   - SHELL PATH:
  •      - /usr/local/sbin
  •      - /usr/local/bin
  •      - /usr/sbin
  •      - /usr/bin
  •      - /sbin
  •      - /bin
  •      - /usr/games
  •      - /usr/local/games
  •      - /usr/lib/wsl/lib
  •      - /mnt/c/Python311/Scripts/
  •      - /mnt/c/Python311/
  •      - /mnt/c/Program Files/ImageMagick-7.1.1-Q16-HDRI
  •      - /mnt/c/Program Files/ImageMagick-7.1.0-Q16-HDRI
  •      - /mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath
  •      - /mnt/c/WINDOWS/system32
  •      - /mnt/c/WINDOWS
  •      - /mnt/c/WINDOWS/System32/Wbem
  •      - /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/
  •      - /mnt/c/WINDOWS/System32/OpenSSH/
  •      - /mnt/c/Program Files (x86)/Calibre2/
  •      - /mnt/c/Strawberry/c/bin
  •      - /mnt/c/Strawberry/perl/site/bin
  •      - /mnt/c/Strawberry/perl/bin
  •      - /mnt/c/Program Files/MATLAB/R2021b/bin
  •      - /mnt/c/Program Files/nodejs/
  •      - /mnt/c/ProgramData/chocolatey/bin
  •      - /mnt/c/Ruby32-x64/bin
  •      - /mnt/c/Users/Rigal/AppData/Local/Microsoft/WindowsApps
  •      - /mnt/c/Users/Rigal/AppData/Local/atom/bin
  •      - /mnt/c/Users/Rigal/AppData/Local/Programs/MiKTeX/miktex/bin/x64/
  •      - /mnt/c/Users/Rigal/AppData/Local/Programs/Git/cmd
  •      - /mnt/c/Users/Rigal/AppData/Roaming/npm
  •      - /mnt/c/Users/Rigal/AppData/Local/Microsoft/WindowsApps
  •      - /home/tyty/.rvm/bin
  •      - /home/tyty/.rvm/binSylvain RIGAL
  • ```
  • </details>
  • ## Debian 12 on VBox
  • Also tried with a fresh install of Debian 12 (iso image [debian-12.0.0-amd64-netinst.iso](https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.0.0-amd64-netinst.iso)) on Virtual Box (version 7.0.8) on Windows 11 22H2 Host.
  • Ruby installed with rbenv:
  • ```
  • rbenv install 3.1.2 # WITHOUT sudo!
  • sudo gem install bundler
  • ```
  • The same errors occurs when trying the QPixel `bundle install` without `sudo` and if I tried to install `bundle` without `sudo` (i.e. with `gem install bundler`), see EDIT 1.1.
  • <details>
  • <summary>
  • Output of `gem env` ("tyty" is the Debian user, and note that I tried to install first Ruby with rvm (but it fails) before to install it with rbenv...)
  • </summary>
  • ```
  • ~/qpixel$ gem env
  • RubyGems Environment:
  • - RUBYGEMS VERSION: 3.3.15
  • - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  • - INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  • - USER INSTALLATION DIRECTORY: /home/tyty/.local/share/gem/ruby/3.1.0
  • - RUBY EXECUTABLE: /usr/bin/ruby3.1
  • - GIT EXECUTABLE: /usr/bin/git
  • - EXECUTABLE DIRECTORY: /usr/local/bin
  • - SPEC CACHE DIRECTORY: /home/tyty/.local/share/gem/specs
  • - SYSTEM CONFIGURATION DIRECTORY: /etc
  • - RUBYGEMS PLATFORMS:
  • - ruby
  • - x86_64-linux
  • - GEM PATHS:
  • - /var/lib/gems/3.1.0
  • - /home/tyty/.local/share/gem/ruby/3.1.0
  • - /usr/local/lib/ruby/gems/3.1.0
  • - /usr/lib/ruby/gems/3.1.0
  • - /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
  • - /usr/share/rubygems-integration/3.1.0
  • - /usr/share/rubygems-integration/all
  • - /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  • - GEM CONFIGURATION:
  • - :update_sources => true
  • - :verbose => true
  • - :backtrace => false
  • - :bulk_threshold => 1000
  • - REMOTE SOURCES:
  • - https://rubygems.org/
  • - SHELL PATH:
  • - /usr/local/bin
  • - /usr/bin
  • - /bin
  • - /usr/local/games
  • - /usr/games
  • - /home/tyty/.rvm/bin
  • - /home/tyty/.rvm/bin
  • - /home/tyty/.rvm/bin
  • ```
  • </details>
#3: Post edited by user avatar zetyty‭ · 2023-07-12T10:57:10Z (10 months ago)
edit summary section code nlock to avoid "block extends past the right hand edge"
  • When I tried to install QPixel with `bundle install` I got the following message (on Debian 11):
  • ```
  • ~/qpixel$ bundle install
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • ```
  • Then I am asked for the sudo password and afterwards a lot of orange warnings appear like this one (several for each "fetched" `gem`):
  • ```
  • Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • And then the installation stops with the following red error message (similar error messages are displayed):
  • <details>
  • <summary>
  • ```
  • Bundler::PermissionError: There was an error while trying to write to
  • `/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • </summary>
  • ```
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • An error occurred while installing minitest (5.16.3), and Bundler cannot continue.
  • [..] # Similar error messages apears after
  • ```
  • </details>
  • So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
  • ```
  • ~/qpixel$ sudo bundle install
  • Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
  • [..] # After, the installation proceeds correctly
  • ```
  • It seems to work fine because I have not detected any problem when running the local instance of QPixel, even if I start it with `rails s` without `sudo`.
  • But my questions are:
  • 1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
  • 2. **How to avoid using `sudo` to obtain a successful QPixel `bundle install`?**
  • I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...
  • # Set up
  • I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:
  • ```
  • sudo apt install bundler
  • ```
  • Ruby installed with:
  • ```
  • curl -sSL https://get.rvm.io | bash -s stable
  • ```
  • When I tried to install QPixel with `bundle install` I got the following message (on Debian 11):
  • ```
  • ~/qpixel$ bundle install
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • ```
  • Then I am asked for the sudo password and afterwards a lot of orange warnings appear like this one (several for each "fetched" `gem`):
  • ```
  • Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • And then the installation stops with the following red error message (similar error messages are displayed):
  • <details>
  • <summary>
  • ```
  • Bundler::PermissionError: There was an error while trying to write to
  • `/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that
  • you need to grant write permissions for that path.
  • ```
  • </summary>
  • ```
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • An error occurred while installing minitest (5.16.3), and Bundler cannot continue.
  • [..] # Similar error messages apears after
  • ```
  • </details>
  • So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
  • ```
  • ~/qpixel$ sudo bundle install
  • Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
  • [..] # After, the installation proceeds correctly
  • ```
  • It seems to work fine because I have not detected any problem when running the local instance of QPixel, even if I start it with `rails s` without `sudo`.
  • But my questions are:
  • 1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
  • 2. **How to avoid using `sudo` to obtain a successful QPixel `bundle install`?**
  • I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...
  • # Set up
  • I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:
  • ```
  • sudo apt install bundler
  • ```
  • Ruby installed with:
  • ```
  • curl -sSL https://get.rvm.io | bash -s stable
  • ```
#2: Post edited by user avatar trichoplax‭ · 2023-07-12T09:13:53Z (10 months ago)
Typo plus tidying
How to get QPixel bundle install working without sudo privileges?
  • When I try to install QPixel with `bundle install` I got the following message (on Debian 11):
  • ```
  • ~/qpixel$ bundle install
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • ```
  • Then I am asked for the sudo password and after a lot of orange warnings apears like this one (several for each "fletched" `gem`):
  • ```
  • Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • And then the installation stops with the following red error message (similar error messages are displayed):
  • <details>
  • <summary>
  • ```
  • Bundler::PermissionError: There was an error while trying to write to
  • `/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • </summary>
  • ```
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • An error occurred while installing minitest (5.16.3), and Bundler cannot continue.
  • [..] # Similar error messages apears after
  • ```
  • </details>
  • So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
  • ```
  • ~/qpixel$ sudo bundle install
  • Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
  • [..] # After, the installation proceeds correctly
  • ```
  • It seems to works fine because I don't have detected any problem when running the local instance of QPixel even if I start it with `rails s` without `sudo`.
  • But my questions are:
  • 1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
  • 2. **How to avoid using `sudo` to obtain a successful QPixel `bundle install`?**
  • I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...
  • # Set up
  • I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:
  • ```
  • sudo apt install bundler
  • ```
  • Ruby installed with:
  • ```
  • curl -sSL https://get.rvm.io | bash -s stable
  • ```
  • When I tried to install QPixel with `bundle install` I got the following message (on Debian 11):
  • ```
  • ~/qpixel$ bundle install
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • ```
  • Then I am asked for the sudo password and afterwards a lot of orange warnings appear like this one (several for each "fetched" `gem`):
  • ```
  • Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • And then the installation stops with the following red error message (similar error messages are displayed):
  • <details>
  • <summary>
  • ```
  • Bundler::PermissionError: There was an error while trying to write to
  • `/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that you need to grant write permissions for that path.
  • ```
  • </summary>
  • ```
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  • /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
  • An error occurred while installing minitest (5.16.3), and Bundler cannot continue.
  • [..] # Similar error messages apears after
  • ```
  • </details>
  • So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
  • ```
  • ~/qpixel$ sudo bundle install
  • Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
  • Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
  • Fetching gem metadata from https://rubygems.org/.
  • Fetching bundler 2.4.13
  • Installing bundler 2.4.13
  • Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
  • [..] # After, the installation proceeds correctly
  • ```
  • It seems to work fine because I have not detected any problem when running the local instance of QPixel, even if I start it with `rails s` without `sudo`.
  • But my questions are:
  • 1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
  • 2. **How to avoid using `sudo` to obtain a successful QPixel `bundle install`?**
  • I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...
  • # Set up
  • I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:
  • ```
  • sudo apt install bundler
  • ```
  • Ruby installed with:
  • ```
  • curl -sSL https://get.rvm.io | bash -s stable
  • ```
#1: Initial revision by user avatar zetyty‭ · 2023-07-12T06:38:27Z (10 months ago)
How to get QPixel bundle install working without sudo privileges?
When I try to install QPixel with `bundle install` I got the following message (on Debian 11):

```
~/qpixel$ bundle install
Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
Fetching gem metadata from https://rubygems.org/.
Fetching bundler 2.4.13
Installing bundler 2.4.13
```

Then I am asked for the sudo password and after a lot of orange warnings apears like this one (several for each "fletched" `gem`):
```
Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.1.0/cache/erubi-1.11.0.gem`. It is likely that you need to grant write permissions for that path.
```

And then the installation stops with the following red error message (similar error messages are displayed):

<details>
<summary>

```
Bundler::PermissionError: There was an error while trying to write to
`/var/lib/gems/3.1.0/cache/concurrent-ruby-1.1.10.gem`. It is likely that you need to grant write permissions for that path.
```

</summary>

```   
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
  /var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/3.1.0/cache/minitest-5.16.3.gem`. It is likely that you need to grant write permissions for that path.
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:40:in `run'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/retry.rb:30:in `attempt'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/rubygems_integration.rb:474:in `download_gem'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:481:in `download_gem'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:443:in `fetch_gem'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:427:in `fetch_gem_if_possible'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:156:in `install'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in `install'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in `apply_func'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in `block in process_queue'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `loop'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in `process_queue'
/var/lib/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing minitest (5.16.3), and Bundler cannot continue.

[..] # Similar error messages apears after
```

</details>


So I have to run `bundle` with `sudo`: `sudo bundle install` and I got the following message (but the installation is successful):
```
~/qpixel$ sudo bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
Bundler 2.3.15 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
Fetching gem metadata from https://rubygems.org/.
Fetching bundler 2.4.13
Installing bundler 2.4.13
Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
[..] # After, the installation proceeds correctly
```

It seems to works fine because I don't have detected any problem when running the local instance of QPixel even if I start it with `rails s` without `sudo`.

But my questions are:   
1. **What are the possible issues related to a QPixel `bundle install` with `sudo`?**
2. **How to avoid using `sudo` to obtain a successful QPixel  `bundle install`?**  
    I tried to install first the "good" version of `bundle` with `sudo gem install bundler:2.4.13` but I got the same `PermissionError` messages during the `bundle install`...

# Set up
I tried on a fresh Debian 11 bullseye on Windows Subsystem Linux Version 2 (WSL2), Windows 11 22H2 host and `bundle` installed with:

```
sudo apt install bundler
```
Ruby installed with:
```
curl -sSL https://get.rvm.io | bash -s stable
```