Running with Ruby

Tag: Debian (page 1 of 3)

Ruby – Installation and compilation from sources on Debian

If you don’t want to use Ruby from your repositories and you don’t want (or can’t because of some reason) to use RVM, here’s a quick howto download and compile Ruby from sources (all the commands should be executed with sudo or as a super user):

First a small update and some neccessery libs:

sudo su
apt-get update

# Not sure if all of them are required but nothing bad will happen if you just install them

apt-get install build-essential bison openssl libreadline6 libreadline6-dev \
libyaml-dev libxml2-dev libxslt-dev zlib1g zlib1g-dev libssl-dev autoconf \
libc6-dev ncurses-dev libaprutil1-dev libffi-dev libcurl4-openssl-dev libapr1-dev

Then we should go here and download the most recent stable version:

# Still as root
cd ~

Of course we need to unpack it:

tar -xvf ruby-2.1.2.tar.gz
# go to where it was unpacked
cd ruby-2.1.2/

and now the whole installation process:

make test  
make install 

and a small cleanup:

cd ~
rm -rf ruby-2.1.2*

To test it, just:

ruby -v
# output: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

GitLab: Your changes could not be commited, because the file has been changed

Not long ago I’ve migrated last of my SVN-managed projects into Git with GitLab (finally!). Everything was OK, until this message occurred, when I tried to do an web-based repository file update:

Your changes could not be commited, because the file has been changed

After googling I’ve executed following command (because I didn’t create satellites earlier):

sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production

Unfortunately this didn’t solve my problem (although I’m pretty sure, that either way this was required). I’ve decided to check GitLab logs, but unluckily nothing suspicious was there. I suddenly remembered, that by default all my Rails/Rack Passenger applications are executed using www-data user. This was a good guess. I’ve added a user declaration in Apache vhost configuration file:

PassengerUser git

and after that I’ve finally started to get some new things in application log:

Errno::EACCES (Permission denied - /home/git/gitlab/tmp/satellite_15.lock):
  lib/gitlab/satellite/satellite.rb:57:in `initialize'
  lib/gitlab/satellite/satellite.rb:57:in `open'
  lib/gitlab/satellite/satellite.rb:57:in `lock'
  lib/gitlab/satellite/action.rb:23:in `block in in_locked_and_timed_satellite'
  lib/gitlab/satellite/action.rb:22:in `in_locked_and_timed_satellite'
  lib/gitlab/satellite/edit_file_action.rb:22:in `commit!'
  app/controllers/edit_tree_controller.rb:18:in `update'

All my satellite locks were created by www-data user with different set of privileges, so git user was not able to use them. After I removed all the locks and restarted both GitLab and Apache server, everything started to work just fine:

sudo rm /home/gitlab/tmp/satellite_*
/etc/init.d/apache2 restart
/etc/init.d/gitlab restart

Copyright © 2018 Running with Ruby

Theme by Anders NorenUp ↑