Defect #38830
openInstallation of Redmine 5.0 with fresh Ubuntu 22.04 LTS stops at bundler install
0%
Description
Hi there,
I tried for days to install Redmine 5.0 using official redmine HowTos, but I always get stucked during bundle install:
my database manager version : PostgreSQL 14.8
my Ruby version : 3.0.2
my Rails version : Not yet installable
my Redmine version : 5.0 (co via svn)
my using plugins : None so far
So what did I do to reproduce the error:
1.) Take a fresh Virtual Machine and install Ubuntu 22.04 LTS Server with default options
2.) Configuring the Proxy of my organisation and some certs, nothing special
3.) sudo apt update && sudo apt -y upgrade && sudo apt -y dist-upgrade && sudo apt -y full-upgrade && sudo apt -y autoremove && sudo apt -y autopurge && sudo apt -y autoclean && sudo reboot
4.) sudo apt -y install postgresql postgresql-contrib php-pgsql
5.) sudo apt -y install subversion
6.) sudo svn co https://svn.redmine.org/redmine/branches/5.0-stable /opt/redmine-5.0
7.) cd ~postgres/
8.) sudo -u postgres psql -c "CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';"
9.) sudo -u postgres psql -c "CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;"
10.) sudo -u postgres psql -c "ALTER DATABASE redmine SET datestyle='ISO,MDY';"
11.) Configuring /opt/redmine-5.0/config/database.yml
production:
adapter: postgresql
database: redmine
host: localhost
username: redmine
password: "my_password"
encoding: utf8
schema_search_path: public
12.) sudo gem install bundler
13.) cd /opt/redmine-5.0
14.) bundle install
During bundle install the output is flodded with messages like
Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/docile-1.4.0.gem`. It is likely that you need to grant write permissions for that path.
Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/rack-2.2.7.gem`. It is likely that you need to grant write permissions for that path.
and ends with:
An error occurred while installing builder (3.2.4), and Bundler cannot continue.
I tried several recommended solutions outside redimine.org:
- Installing rbenv via Homebrew and installing ruby via rbenv
- Fixing permission errors by hand (which messes things up a lot)
- https://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_50x_on_Ubuntu_2004_with_Apache2
- https://www.redmine.org/projects/redmine/wiki/RedmineInstall
I am at the point where I have to install not the current versions of software but older versions to install redmine - but I first try to ask here, maybe there is something I have missed to do - despite reinstalling the whole server 4 times for now and getting stucked at the same point no matter which howto I follow.
My Guess:
Some versions ago bundler had the option to correct it's permission errors by using the sudo password. But that feature was removed from bundler for security reasons.
It seems that there is no updated install doc since bundler changed it's habit, but I may have missed one.
But I don't know for sure if that's the reason for my problem. Just a guess at the moment.
Am I able to install the latest Redmine version 5.0.x with the latest Ubuntu LTS Server 22.04.x?
And if it's possible - can anyone give me a hint how to get "bundler install" running under that combination?
Any help would be highly appreciated.
Regards
Dirk
Files
Updated by Jérôme Gallot over 1 year ago
Hi Dirk,
The major trouble : PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/docile-1.4.0.gem`
Your current system account can't deploy globally gems on your system.
Best way (?) : deploy gem in your local redmine directory with user dedicated to redmine :
Goto to redmine root directory, run :
bundle config --set local path vendor/bundle
and then:
bundle install
JG
Updated by Dirk Blanckenhorn over 1 year ago
Thank you for you quick response :-)
Jérôme Gallot wrote in #note-1:
Your current system account can't deploy globally gems on your system.
I use the system account created during installation of ubuntu server ...
Best way (?) : deploy gem in your local redmine directory with user dedicated to redmine :
Goto to redmine root directory, run :
bundle config --set local path vendor/bundle
and then:
bundle install
I startet with a clean VM again (as described above) and after the configuration of the redmine database I did
bundle config --set local path vendor/bundle
which gaves an error as I have no bundler on the system at this point:
Command 'bundle' not found, but can be installed with:
audo apt install ruby-bundler
For the first test I'll give it a try and installed ruby-bundler, keeping in mind that there were several other ways to install bundler.
So I tried it again:
bundle config --set local path vendor/bundle
bundle install
Then this pops up:
[...] Following files may not be writable, so sudo is needed: /usr/local/bin /var/lib/gems/3.0.0 /var/lib/gems/3.0.0/build_info /var/lib/gems/3.0.0/cache /var/lib/gems/3.0.0/doc /var/lib/gems/3.0.0/extensions /var/lib/gems/3.0.0/gems /var/lib/gems/3.0.0/plugins /var/lib/gems/3.0.0/specifications [...] Your user account isn't allowed to install to the system RubyGems. You can cancel this installation and run: bundle config set --local path 'vendor/bundle' bundle install to install the gems into ./vendor/bundle/, or you can enter your password and install the bundled gems to RubyGems using sudo. Password:
So as I already tried to set local path I tried to enter the sudo credentials.
I have to mention that I was never asked for sudo credentials on my attempts before, so I was happy - for some seconds as all started to go green.
But suddenly bundle install stopped with following errors:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension An error occurred while installing racc (1.7.1), and Bundler cannot continue An error occurred while installing nio4r (2.5.9), and Bundler cannot continue. An error occurred while installing websocket-driver (0.7.5), and Bundler cannot continue. An error occurred while installing commonmarker (0.23.9), and Bundler cannot continue. An error occurred while installing digest (3.1.1), and Bundler cannot continue. An error occurred while installing ffi (1.15.5), and Bundler cannot continue. An error occurred while installing strscan (3.0.6), and Bundler cannot continue. An error occurred while installing pg (1.2.3), and Bundler cannot continue. An error occurred while installing redcarpet (3.5.1), and Bundler cannot continue.
So basically the Ubuntu default user created during install has no rights to install Redmine - at least it seems so.
But why and how can I install Redmine?
Updated by Dirk Blanckenhorn over 1 year ago
- File bundle_install_using_sudo_password_and_ruby-bundler.txt bundle_install_using_sudo_password_and_ruby-bundler.txt added
In addition some more detailed error messages from "bundle install" using the sudo-password-variant:
Installing websocket-driver 0.7.5 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /tmp/bundler20230710-17365-jy5oukracc-1.7.1/gems/racc-1.7.1/ext/racc/cparse /usr/bin/ruby3.0 -I /usr/lib/ruby/vendor_ruby -r ./siteconf20230710-17365-4c2r1p.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. extconf failed, exit code 1 Gem files will remain installed in /tmp/bundler20230710-17365-jy5oukracc-1.7.1/gems/racc-1.7.1 for inspection. Results logged to /tmp/bundler20230710-17365-jy5oukracc-1.7.1/extensions/x86_64-linux/3.0.0/racc-1.7.1/gem_make.out /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:95:in `run' /usr/lib/ruby/vendor_ruby/rubygems/ext/ext_conf_builder.rb:47:in `block in build' /usr/lib/ruby/3.0.0/tempfile.rb:317:in `open' /usr/lib/ruby/vendor_ruby/rubygems/ext/ext_conf_builder.rb:26:in `build' /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:161:in `build_extension' /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:195:in `block in build_extensions' /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:192:in `each' /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:192:in `build_extensions' /usr/lib/ruby/vendor_ruby/rubygems/installer.rb:847:in `build_extensions' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/rubygems_gem_installer.rb:71:in `build_extensions' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/rubygems_gem_installer.rb:28:in `install' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/source/rubygems.rb:204:in `install' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/installer/gem_installer.rb:54:in `install' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/installer/parallel_installer.rb:186:in `do_install' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/installer/parallel_installer.rb:177:in `block in worker_pool' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/worker.rb:62:in `apply_func' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/worker.rb:57:in `block in process_queue' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/worker.rb:54:in `loop' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/worker.rb:54:in `process_queue' /usr/share/rubygems-integration/all/gems/bundler-2.3.5/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads' An error occurred while installing racc (1.7.1), and Bundler cannot continue.
See attached file with the complete output
Updated by Jérôme Gallot over 1 year ago
HI,
bundle config --set local path vendor/bundle
must be run with the user who will have write on redmine directory (so not by root)
after you run
bundle install with the same user.
It must do the trick
Updated by Dirk Blanckenhorn over 1 year ago
I always tried it with the user created during Ubuntu Install after first boot of an empty VM.
So I tried
bundle config --set local path vendor/bundle
bundle install
not with sudo or root, but with that regular user created during Installation of Ubuntu.
And that command gave me no feedback, so no error I suppose.
So I thought it should work.
I'll delete all again and try the same and I will post a current list of shell commands to reproduce my error, if I still run into it.
Thank you for your remarks, I will have an more intense view over these two specific steps.
Updated by Dirk Blanckenhorn over 1 year ago
I did again a fresh install and these are the current steps to reproduce the errors during bundle install:
* Fresh Ubuntu Install 22.04.2 LTS - Ubuntu Server (not minimized) - No third-party drivers - DHCP - No Proxy - Default Repo - Default harddisk layout - Create Credentials - Skip Ubuntu Pro - With OpenSSH-Server - Done, Reboot * Login using credentials created during Install * sudo touch /etc/cloud/cloud-init.disabled * Configure Proxy of the Organization to get Internet Access * sudo apt update && sudo apt -y upgrade && sudo apt -y dist-upgrade && sudo apt -y full-upgrade && sudo apt -y autoremove && sudo apt -y autopurge && sudo apt -y autoclean && sudo reboot * Install some Certs of the Organization using "sudo apt -y install smbclient" and getting the Certs from a Fileserver * sudo apt -y install apache2 php libapache2-mod-php php-gd php-curl php-imagick fop * sudo ufw allow in "Apache Full" * sudo ufw limit in "OpenSSH" * sudo apt -y install postgresql postgresql-contrib php-pgsql * sudo apt -y install subversion * sudo svn co https://svn.redmine.org/redmine/branches/5.0-stable /opt/redmine-5.0 * cd ~postgres/ * sudo -u postgres psql -c "CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';" * sudo -u postgres psql -c "CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;" * sudo -u postgres psql -c "ALTER DATABASE redmine SET datestyle='ISO,MDY';" * /opt/redmine-5.0/config/database.yml production: adapter: postgresql database: redmine host: localhost username: redmine password: "my_password" encoding: utf8 schema_search_path: public * cd /opt/redmine-5.0/ * sudo apt install ruby-bundler * bundle config --set local path vendor/bundle * bundle install * Stops with: Your user account isn't allowed to install to the system RubyGems. You can cancel this installation and run: bundle config set --local path 'vendor/bundle' bundle install to install the gems into ./vendor/bundle/, or you can enter your password and install the bundled gems to RubyGems using sudo. * Entering SUDO-Password * Errors: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. * Same errors with racc (1.7.1), nic4r (2.5.9), commonmarker (0.23.9), digest (3.1.1), strscan (3.0.6), redcarpet (3.5.1) * sudo apt install ruby-dev * bundle install * Stops again with: Your user account isn't allowed to install to the system RubyGems. You can cancel this installation and run: bundle config set --local path 'vendor/bundle' bundle install to install the gems into ./vendor/bundle/, or you can enter your password and install the bundled gems to RubyGems using sudo. * Entering SUDO-Password * Errors: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. * Same errors with racc (1.7.1), nic4r (2.5.9), commonmarker (0.23.9), digest (3.1.1), strscan (3.0.6), redcarpet (3.5.1)
So bundle install failed.
Any hints are highly appreciated, maybe something very simple, but I don't see it at this time.
Updated by Jérôme Gallot over 1 year ago
Sorry, my fault ....
run :
bundle config set --local path 'vendor/bundle'
instead of
bundle config --set local path vendor/bundle
Updated by Dirk Blanckenhorn over 1 year ago
I just found a strange error:
Jérôme Gallot suggested:
bundle config --set local path vendor/bundle
and bundle install itself suggested:
bundle config set --local path 'vendor/bundle'
Both are different.
I tried the line suggested by bundle installer and that leads to an error saying the User has no rights.
I gave up and did a
sudo chown -R <username> /opt/Redmine-5.0/
where <username> is the user created during install.
After a bundle install unfortunately the same error: Could not create makefile, See mkmf.log
So I did a
sudo find / -name "mkmf.log" and found 5 Files within /opt/redmine-5.0/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/
placed in the subfolders for ffi, pg, strscan, racc and nio4r
I opened all these log files, but most of them had no clue except ffi saying package configuration for libffi is not found.
Updated by Dirk Blanckenhorn over 1 year ago
- I do not create any user except of the one created during Install
- I login and use always the same User created during Install
As this user has no rights per default within /opt I chose to use "sudo svn co https://svn.redmine.org/redmine/branches/5.0-stable /opt/redmine-5.0" to download Redmine.
Which rights should /opt/redmine-5.0 have to work properly?
Am I completely wrong?
Updated by Dirk Blanckenhorn over 1 year ago
I finally created a workaround and bundler install gave no more errors. But I still don't have an idea why I have to do what I did.
After clean install and installing apache2 I did the following to solve the issue:
sudo apt -y install postgresql postgresql-contrib php-pgsql subversion ruby ruby-dev build-essential libapache2-mod-passenger libpq-dev sudo svn co https://svn.redmine.org/redmine/branches/5.0-stable /opt/redmine-5.0 cd ~postgres/ sudo -u postgres psql -c "CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';" sudo -u postgres psql -c "CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;" sudo -u postgres psql -c "ALTER DATABASE redmine SET datestyle='ISO,MDY';" sudo vi /opt/redmine-5.0/config/database.yml production: adapter: postgresql database: redmine host: localhost username: redmine password: "my_password" encoding: utf8 schema_search_path: public cd /opt/redmine-5.0/ sudo gem install bundler sudo mkdir /opt/redmine-5.0/.bundle sudo chmod 777 /opt/redmine-5.0/.bundle sudo mkdir /opt/redmine-5.0/vendor/bundle sudo chmod 777 /opt/redmine-5.0/vendor/bundle sudo touch /opt/redmine-5.0/Gemfile.lock sudo chmod 666 /opt/redmine-5.0/Gemfile.lock bundle config set --local path vendor/bundle bundle install
So I needed to create some directories, touched a file and installed libpq-dev.
Then bundle install finished with
Fetching gem metadata from https://rubygems.org/......... Resolving dependencies... Bundle complete! 43 Gemfile dependencies, 103 gems now installed. Bundled gems are installed into `./vendor/bundle`
Maybe someone has an Idea why these directories were not created?
At the moment I am not sure if Redmine works at least - I am just happy to finish bundle install without errors after 2 Weeks of trying and >7 fresh installations of Ubuntu.
Regards
Dirk
Updated by Mischa The Evil about 1 year ago
- Affected version changed from 5.0.4 to 5.0.5