Freebsd ports, installing Perl ./+INSTALL: Permission denied

Don't you just hate it when installing ports on a live server fail!
Well I do. Today the following happened:

===>  Installing for perl-5.16
===>  Checking if lang/perl5.16 already installed
./+INSTALL: Permission denied
pkg_add: install script returned error status
*** Error code 1

Big panic, couldn't install perl on my server.

On my server the /tmp drive is mounted with noexec. This script seems to need execute rights in the temporary directory

The work-around I used is the following:

mkdir /usr/tmp
export TMPDIR=/usr/tmp

Finally my make install works again :D

make install 

Ruby on Rails / ChiliProject encoding issues

This week I've decided to exchange Redmine for the ChiliProject. The reason for this is the support for Ruby 1.9. My Apache Passenger server runs Ruby 1.9 so for Redmine I needed a seperate webserver.

When I tried to access the "My Account" page I recieved the following error:

ArgumentError (invalid byte sequence in US-ASCII):
  <internal:prelude>:10:in `synchronize'
  passenger (3.0.7) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
  passenger (3.0.7) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
  passenger (3.0.7) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
  passenger (3.0.7) ...
`handle_spawn_application'
  passenger (3.0.7) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.7) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.7) helper-scripts/passenger-spawn-server:99:in `<main>'

Rendering /data/www/rails/chili/public/500.html (500 Internal Server Error)

Solution

How should I solve this? The chiliproject has an issue related to this: https://www.chiliproject.org/issues/591.

The following Apache configuration fixed the issue: (The sample is on a FreeBSD system)

I added the following code to a file in the /usr/local/apache22/envvars.d/environment.env

export LC_CTYPE="en_US.UTF-8"

Problems I ruled out or fixed

While trying I also made sure the following things were configured:

I made sure the database is UTF-8. I re-created the database
an ran the migrations again.

create database chiliproject character set utf8;

I used the mysql2 connector instead of the mysql connector in database.yml

Running Ruby on Rails 3.1 on FreeBSD

Are you trying to install / run Rails 3.1 on a FreeBSD system...?
You will probably get errors of a missing javascript engine.

You should try to install node and google V8 as javascript engine

cd /usr/ports/lang/v8
make install clean
cd /usr/ports/www/node
make install clean

Now it should work :-)

Freebsd – Broken Ruby Installation After Update

Yesterday I did a Ruby update of my Freebsd ports.
It mentioned Ruby needed to be updated. I always thinks this is Scary because I have several sites depending on the my Ruby installation.
You need to update once in a while, so I just upgraded it...

portupgrade -bapi

Today I saw my mysql-backup-cron Ruby script gave the following error:

mysql_backup.rb:3:in `require': no such file to load -- rubygems (LoadError)
	from mysql_backup.rb:3:in `<main>

WTF. I tried to run a rake task of my Rails apps.. The same error...

The gems still seem work. The command below nicely showed my Gems.

gem list 

After trying to reinstall the rubygems port which didn't do a thing.
I found the solution was to REINSTALL RUBY completely.

cd /usr/lang/ruby18
make 
make deinstall
make install clean

BTW. My Rails apps were not affected because they run in an RVM environment ...