Archive for the ‘Ubuntu’ Category

Ruby-on-Rails on Ubuntu 8.04

Friday, October 31st, 2008

Every time I build an Ubuntu machine I have to figure out all over again how to get it to work - so this time I’ll write the steps down!

Install the packages: postgresql, rake, ruby, rubygems, rcov, git-core

Update the RubgyGems distribution by running

sudo gem update –system

If you run gem now you’ll get the nasty looking error:

/usr/bin/gem:10:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)

You need to edit /usr/bin/gem and add an extra require:

require ‘rubygems/gem_runner’

Install the Postgres driver:

sudo gem install postgres-pr

You’ll need to change where Postgres writes it’s socket file, if you leave things unchanged you’ll see the error:

No such file or directory - /tmp/.s.PGSQL.5432

when attempting to connect to the database.

Edit /etc/postgresql/8.3/main/postgresql.conf and alter the unix_socket_directory parameter:

unix_socket_directory = ‘/tmp’

Restart Postgres using the init script /etc/init.d/postgresql-8.3

You should be able to leave your pg_hba.conf file unchanged - it should already look like:


# Database administrative login by UNIX sockets
local all postgres ident sameuser
# “local” is for Unix domain socket connections only
local all all ident sameuser
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5

You need to create a database user, and give that user a password and create a database. As the postgres user:

createuser -lqs db_username
createdb -O db_username db_name
psql -c “alter user db_username with password ‘db_password’;”

In the last command above make sure you don’t miss the ‘;’ character, if you miss it the statement isn’t actually executed, you should see the command confirmed with ALTER ROLE.

In you Rails application database.yml you need to specify the database name, database username and password and the host (even if it’s localhost)

development:
adapter: postgresql
encoding: unicode
database: db_name
host: localhost
username: db_username
password: db_password

White screen after login to X on Linux (Ubuntu)

Friday, October 31st, 2008

Given it’s taken me a while to sort this I thought I’d write down what I did in case it helps someone else (it might help me again in the future too, I’m sure if it happens again I won’t remember what I did to fix it)

So yesterday I installed VirtualBox 2.0, removed VirtualBox 1.5.x OSE and its related dependencies, and probably installed a whole load of updates too - I really can’t remember exactly what I did - at the time it all worked fine but after I switched the machine back on today and logged in I don’t see my desktop just a white screen and the mouse cursor.

Hitting ctrl-alt-F1 gets me to a command shell, so the machine hasn’t locked up.

From struggling to get my ATI based card to work in the past I know that dpkg-reconfigure xserver-org reverts X to a very basic configuration so I tried that from the shell and then rebooted. dpkg-reconfigure xserver-org obviously had an effect as the screen resolution of the login screen dropped down but I still got the white screen.

Rebooting again and choosing the recovery option from the bootloader prompt I chose the “Try to fix X server” menu option - *try* to fix X - I like that although I didn’t find it funny at the time. Reboot, login in - still a white screen.

A Google search from another machine threw up suggestions to remove the likes of

~/.config/compiz
~/.gconf/apps/compiz

This didn’t help either, but thinking about it it may have done if I’d gone about things differently. X obviously isn’t completely broken as you can get the login screen and a safe session (see later) also works fully. I think only removing the above directories (i.e. not doing any of the above dpkg-reconfigure etc stuff) may have worked if I’d been in safe mode when I removed them, as it was X was running and I used ctrl-alt-F1 to get a shell. I suspect that when I issued the reboot command and X shut down it just rewrote the files with the same values in them.

Finally I stumbled on a blog post. I did something similar, logged in using a “Gnome FailSafe” session, reinstalled the ATI drivers - I just downloaded them from http://ati.amd.com/support/drivers/linux/linux-radeon.html rather than using EnvyNG - and re-enabled the proprietary drivers under “System -> Administration -> Hardware Drivers” menu (which if I hadn’t run dpkg-reconfigure xserver-org in the first place I might not have needed to do), rebooted and everything was ok.

If nothing else a “Gnome FailSafe” session is your friend, at least you can get online to find answers.