Error: unsupported locale setting

While installing and configuring trac on my development VM it wouldn’t load over HTTP (500 error). Stracing the process returned the issue,

Error: unsupported locale setting

So it looks like it doesn’t have the locale installed (In my case EN_GB) this is easily fixed by running,

sudo dpkg-reconfigure locales

Then selecting the necessary locale, you’ll most likely want to default to UTF8.

reconfigure locale to en_gb.UTF8

You should then be able to run trac and have it accessible, in my case

sudo -u trac tracd -s -p 8000 –pidfile ~trac/dev/ -d –basic-auth=”*,/home/trac/dev/htpasswd,dev” ~trac/dev
curl -I localhost:8000
HTTP/1.0 200 OK
Server: tracd/0.11.7 Python/2.6.6
Date: Wed, 16 Jan 2013 07:38:32 GMT
Cache-Control: must-revalidate
Content-Type: text/html;charset=utf-8
Content-Length: 6184
Set-Cookie: trac_form_token=a83b66948209b4197936bd1a; Path=/
Set-Cookie: trac_session=d2dad341a8e80e6fd2f76551; expires=Tue, 16-Apr-2013 07:38:32 GMT; Path=/