Entries from September 2008 ↓

Installing ubuntu with tftpd-hpa and udhcpd

I needed to install a computer for my sister. She want a laptop, but until she has the money for it, she’ll be using one of my old computers.

It’s one with no dvd/cd drive (she doesn’t know that :) ), so I had to install ubuntu over the network.

First, like I always do:

aptitude install tftpd-hpa

Then make sure /etc/default/tftpd-hpa looks like:

#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot -vvvvv"

And make sure you copy the right files to /var/lib/tftpboot. I don’t want to explain that here. If you’re interested in how to make that work: e-mail me or read the Ubuntu wiki.

Then you need a dhcp server that can send where to find the files. My router doesn’t support that (US Robotics), so I needed to install a local dhcp server. Usually I installed a fully-flexed dhcp server, but this time I wanted something simple. Apt-cache search showed me udhcpd. So:

aptitude install udhcpd

Then create /etc/udhcpd.conf and make it look like this (if you have a wireless interface):

dns 192.168.2.1 #Ip address of the local dns server (router in my case)

boot_file hardy/pxelinux.0

Then (re)start both services:

/etc/init.d/tftpd-hpa restart
/etc/init.d/udhcpd restart

Start the computer you want to install and select an option similar to: “Boot from network” and go!!!!!!

I really liked udhcpd: it’s really simple and fast. Tftpd-hpa always has worked great for me, so that’s why I picked it this time too.

There could be errors in this post, I typed it largely without checking. If you can’t figure out how to install it yourself: please let me know via a comment.

Rails vs. Merb

This will be a short post: I like merb/datamapper better. It’s cleaner and faster.

But, I have to finish a project this week and merb/datamapper is not just stable yet, has less documentation, less plugins, less helpers and less features.

For example, the “has and belongs to many” association in datamapper isn’t fully implemented (look a the tests). There are some nice backend generators for Rails. And if you have to finish a project in too little time, it’s a quick decision.

I know, I could also make/fix this stuff for merb and datamapper myself and I would love to. But there just isn’t enough time! Aaarghhh…

Setting up the “show desktop” button in Gnome

I’ve been using Ubuntu/Gnome fulltime now for some 2 years I believe. I never found out what the “show desktop” shortcup was. I always used the little icon. But while I was tweaking compiz I found out that the shortcut was <ctrl><alt>d. I Windows it was Super+D (Windows key + D). So I decided to change the keybinding to that. I couldn’t manage it via the “Keyboard shortcuts” configuration. I kept insisting on Super_L. So I “hacked” it via the gconf-editor. See the screenshot for the correct value:

But, I realized I had to set this up every time I reinstalled Gnome/Ubuntu. So I changed it back to Ctrl+D. Convention over configuration maybe?

Asset directories and capistrano

I have this public/images/cars directory but it gets overwritten everytime I use “cap deploy”. So in order to have my images/cars directory saved every time, I used this addon for capistrano:

set :assets, ['images/cars']

namespace :deploy do
  task :after_deploy do
    copy_assets
  end
end

namespace :deploy do
  desc "Link in the production database.yml"
  task :copy_assets do
  self.assets ||= []
    assets.each do |asset|
      run "cp -r #{previous_release}/public/#{asset} #{release_path}/public/#{asset}"
    end
  end
end

Worked like a charm for me!

Screw tonemapping: long live enfuse!


Because I recently bought a new motorcycle I wanted to sell my old GS500. Most important when selling your stuff online: good pictures of the item you’re selling. So I dusted of my Nikon, gave my trusty Suzuki a nice cleaning and started taking pictures. With HDR in my mind I used a little tripod and took 3 pictures of every position with the bracketing function. +2EV, 0EV and -2EV. No raw but plain jpeg’s. For some reason I don’t like raws. It just takes too much time to get them ready for publishing.

I shot 10×3 pictures, uploaded them to my laptop and started looking for some HDR/tone-mapping software for linux. Qtpfsgui looked very nice and I tried it out. It was available from the ubuntu repositories. I have the Intrepid repositories enabled and installed hugin-tools (a dependency for qtpfsgui) from there. The added benefit was that qtpfsgui could align the pictures for you. I used a tripod but I didn’t use a remote control. So some pictures were not perfectly the same.

Qtpfsgui seemed like everything I needed: a nice gui, automatic aligning of images and a lot of different algorithms for creating tone mapped images.

But I couldn’t create a realistic tonemapped image. Qtpfsgui creates a lot of those fantasy-like HDR images. Nice if you like the style, but I wanted realistic images. Exit qtpfsgui.

After doing some more research I found a commandline utility called enfuse. There were some very positive and exciting comments on it, so I decided to check it out. I wanted enfuse, which is part of the enblend package on ubuntu. But the newest enblend package on Ubuntu was 3.0. And I needed something newer for enfuse to be part of it. So I had to compile it from source. What I did:


sudi aptitude install build-essential
sudo aptitude install pkg-config libtiff4-dev libboost-graph-dev libboost-thread1.34.1 liblcms1-dev libglew1.5-dev libplot-dev libglut3-dev libopenexr-dev libopenexr2ldbl libxi-dev
cd ~/src
wget http://kent.dl.sourceforge.net/sourceforge/enblend/enblend-enfuse-3.2.tar.gz
tar -xzvf enblend-enfuse-*.tar.gz
cd enblend-enfuse-*
./configure
make

You can optionally do:

sudo make install

I decided to first try it from the build directory:

cd ~/Pictures/test
~/src/enblend-enfuse-3.2/src/enfuse DSC_080* -o enfuse_test.tiff

And it worked perfectly. Without any tweaking of the parameters, it resulted in a nicer, better looking image than with a fully tweaked qtpfsgui.

But…. what if your images aren’t perfectly aligned as in my case? Install the latest hugin-tools package which contains the align_image_stack program:

sudo aptitude install hugin-tools=0.7.0~svn3191+beta5-1ubuntu1
align_image_stack -a aligned_ DSC_080*
~/src/enblend-enfuse-3.2/src/enfuse aligned_* -o enfuse_test_2.tiff

Perfect! I would really recommend enfuse.

Maybe I’ll create a small ruby script to ease this process.

Deploying, merb, capistrano & passenger

First of all I did a:

capify .

And used this deploy.rb

Then to setup the current, releases, etc. directories:

cap deploy:setup

Then, when I tried to login via ssh with shared key: nothing!
After some searching I found out that capistrano messed up the permissions on the .ssh directory :(

To fix it:

chmod 755 $HOME
chmod 755 $HOME/.ssh
chmod 644 $HOME/.ssh/authorized_keys

Installing merb on phusion passenger


I’ve created a little merb app for a customer. The reason I chose merb because I really like the :provides-api. The app had to generate a lot of xml, so using Merb was really nice.

But the installation on the server was a little troublesome. I had to install some gems (which I of course forgot to do) and I had to figure out how the file permissions had to be.

First step: installing software

aptitude install build-essential ruby1.8-dev libxml2-dev libmysql++-dev
gem install merb datamapper do_mysql merb_datamapper --include-dependencies --no-ri --no-rdoc
gem update --include-dependencies
passenger-install-apache2-module

Step two: project’s dependency packages

aptitude install libmagick9-dev libtidy-0.99-0
gem install orderedhash shared-mime-info rmagick tidy

But the big problem here was libtidy! All the packages keep segfaulting. So I had to use the Gutsy or Feisty package (don’t remember which one exactly. One of the two :) ).

Step three: config.ru

Because I wanted to run Merb on apache2 with Phusion passenger I had to create a config.ru file. The contents of the file can be found on the merbivore wiki.

Last step: Adjusting permissions

I was ready to start merb, but when I tried to start it, it kept complaining about permission errors. So after a little fiddling I chmod’ed the whole shebang to 750. I think it will be solved if I install suexec on the server.

Brother HL-2030 & Ubuntu Hardy


Ah, time for my yearrly recurring troubles with my Brother HL2030. Very nice printer. But the driver support under Linux is terrible. Yes, brother released some (crapy) closed source drivers for Linux. But in my opinion that’s even worse than no drivers for linux at all. If there’re no drivers, some opensource Kernel guru creates them. If there are drivers available, no matter how crappy they are, no one’s going throught the trouble of creating them.

I first picked the HL2060 drivers. But I had troubles printing pages in the landscape format. So after some searching I found the appropriate drivers. Just do:

aptitude install brother-cups-wrapper-extra brother-cups-wrapper-laser

I had to reboot before the drivers showed up in the system-config-printer tool. After the reboot I could select the HL-2030 drivers. But too bad,the same problem remained. When tweaking the default job options, I could set the orientation to landscape. Very weird. I believe it’s a bug in Gnome but I couldn’t find any similar cases.

So for now, it’s very annoying to set the default job options every time, but it works…