Tag Archives: tech

Berkeley DB, CentOS 4.4 and Xen/Amazon EC2

I am trying to get a CentOS 4.4 image running on Amazon EC2, and hit a helluva bug.  A time consuming bug at least…  CentOS comes with Berkeley db4 compiled with ‘–enable-posixmutexes’.  But this doesn’t work under Xen.  When installing the perl BerleleyDB package I get a bunch of this:

Berkeley DB library configured to support only DB_PRIVATE environments

The BerkeleyDB README mentions this Red Hat bug.  So I compiled my own copy of db-4.4.20 with ‘–disable-posixmutexes’ and installed it to /usr/local/BerkeleyDB.4.4 and linked it from /usr/local/BerkeleyDB.  Then while installing perl BerkeleyDB, I started getting a bunch of this crap:

Can't load '/var/tmp/BerkeleyDB-0.31/blib/arch/auto/BerkeleyDB/BerkeleyDB.so' for
module BerkeleyDB: libdb-4.4.so: cannot open shared object file: No such file or
directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.

I was stuck at this point for a while, then a google search for "libdb-4.4.so: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230." (no quotes) turned up exactly one match – this site.

So the entire solution is:

  tar -zxvf db-4.4.20.tar.gz
  cd db-4.4.20/build_unix/
  ../dist/configure --disable-posixmutexes
  make
  make install
  cd /usr/local
  ln -s BerkeleyDB.4.4 BerkeleyDB
  echo "/usr/local/BerkeleyDB/lib" > /etc/ld.so.conf.d/BerkeleyDB.conf
  /sbin/ldconfig

  FTP_PASSIVE=1 LANG=en_US LC_CTYPE=en_US perl -MCPAN -e shell
  >  install BerkeleyDB

Carbon neutral email

I watched An Inconvenient Truth last weekend.  Aside of learning how great of a person Al Gore is (according to himself), it got me thinking about how much power our data center uses, the carbon dioxide that is released into our atmosphere to produce the power and how much it would cost to offset that CO2.  So I ran some numbers…

My assumptions:

  DEVICE               WATTS
  Motherboard           25
  AMD Athlon 64 3200+   89
  AMD Opteron           85
  PC133 SDRAM           12
  IDE Hard Drive        25
  SATA Hard Drive       25
  NIC                    4
  CPU Fan                3
  System Fan             2

We have several different server hardware configurations, but with a few shortcuts they can all be classified into three types…

  Type A: 191 Watts
  Type B: 272 Watts
  Type C: 241 Watts

In our Dulles VA data center, we have 90 servers of type A, 5 of type B and 69 of type C.  That equals 35,179 Watts.  But there’s more… According to Cisco, servers account for 26% of the power consumption in a typical data center.  The remaining power is consumed by networking equipment (11%), power conversion losses (10%), lighting (3%)  and cooling (50%).

This yields…

  Servers   26%   35,179
  Network   11%   14,883
  Cooling   50%   67,652
  Lighting   3%    4,059
  Loss      10%   13,530

  Total =  135,304 Watts

  Converting to kilowatt-hours (*24*365/1000) = 1,185,263 kWh

We host 400,000 mailboxes in the Dulles data center, so that means each mailbox consumes 2.9631576 kWh each year.

So if you want to have carbon neutral email, just multiply 2.96 kWh by the number of email accounts you have with Webmail.us, and plug that number into a carbon offset calculator such as the one at Carbonfund.org.  Then donate the amount they say.  Your donation will go to the production of renewable energy, reforestation and/or energy efficiency projects.  These projects have the net effect of canceling out the CO2 produced.

According to my rough calculations (and please correct me if I made any errors or incorrect assumptions), our customers can offset the CO2 emissions created by each email account for just under $0.01 per year.

You’ll need to look at offsetting more than just your email accounts if you want to save the world.  But it’s a start.

Two updates…

Update on post “I want to merge the 2 Linux clipboards“…

Ramy posted a comment this morning that led me to autocutsel, which is now doing exactly what I wanted:

First, I had to install libxaw7, libxaw7-dev, libxaw7-headers.  Then, install autocutsel (./configure; make; make install).  Then, I start one autocutsel process that syncs PRIMARY with cutbuffer 0 on mouse-button-up events, and a second autocutsel process that syncs CLIPBOARD WITH cutbuffer 0 always.

~/.bashrc:
..
# Start syncing clipboards
autocutsel -selection PRIMARY -buttonup -fork
autocutsel -selection CLIPBOARD -fork

Update on post “Subscribe via Email“…

It has been two months since I added the Feedburner “subscribe via email” tool to my blog.  And so far I have only one person who subscribes via email – me.  I guess everybody knows how to use RSS these days… at least those who read my blog.

I want to merge the 2 Linux clipboards

Linux has 2 clipboards… PRIMARY, which is set when selecting text via the mouse and CLIPBOARD, which is set the MS-way (Ctrl-c or Edit > Copy).  Anyone know how I can configure gnome-terminal to set both PRIMARY and CLIPBOARD when I select text via the mouse?  I’m running Ubuntu 6.10.

I’m sure its something that needs to be set in ~/.Xresources, but I can’t figure it out.

I’ve switched to Ubuntu Linux

One of my goals this quarter was to finally ditch the last piece of non open source software on my computer… the Operating System.

Last week I did it.  I switched from Windows XP to Ubuntu 6.10.  I had tried Fedora Core about a year and a half ago, but couldn’t get it to push the right resolution to my wide-screen monitor (1680×1050), so at that time I reverted back to XP.  I had similar problems this go round with Ubuntu, but I decided to not let it stop me.  Jesse helped me figure out that Linux support for the on-board video card on my Dell motherboard just sucks.  So I went out and purchased the cheapest Nvidia video card that they have at PC Land… and voilà, now everything just works!

Why Ubuntu? and Why now?… To avoid restating what has been said by many, I’ll quote a post from Jeremy Zawodny last year:

Ubuntu is the first real "desktop" Linux I’ve ever seen. There’s a lot of polish to it, most of the "right" things have been hidden from non-Linux geeks, and it just works. …  If you’ve been waiting years and years for desktop Linux (or laptop Linux) to finally arrive, give Ubuntu a shot. Seriously.

Once I got over the video card silliness, I spent a while (a bit too long) customizing things.  Below are my tweaks, so now whenever I need to do this again I can look back at this post:

– Made the "panel" look like what I was used to with my Windows taskbar.  Moved it to the bottom of the screen.  From left to right I have: programs menu, separator, quick-launch icons (file browser, show desktop, terminal, firefox), shortcut menu with more quick-launch icons (gaim, terminal server client, calculator, gedit text editor, openoffice docs & spreadsheets), open windows list, desktop switcher, system tray icons (aka notification area), trash, system monitor, clock (format: 9:12 PM).

– To make the shortcuts menu that I mentioned above, I added a new submenu to Applications, assigned it an up-arrow icon, and put the programs listed above into it.  Then I went to the main menu on my panel, went into Shortcuts, right-click, Entire menu > Add this menu to panel.  I could have accomplished the same thing using a "drawer", but drawers load the program list slower then normal menus for some reason.  And I hate slow desktop features.

– Configure /etc/fstab to auto-mount the "U: drive" (the Webmail.us samba file server),

– Auto-start Gaim: ~/.config/autostart/gaim.desktop
  [Desktop Entry]
  Name=No name
  Encoding=UTF-8
  Version=1.0
  Exec=gaim
  X-GNOME-Autostart-enabled=true

– Gaim preferences:
  send unknown slash commands as messages
  tabs on left
  no sounds
  log IM sessions
  auto-away: 5 min
  Plugins: buddy state notification, history, iconify on away, message notification, system tray icon,

– Install Firefox extensions: google toolbar (if Firefox would add a "search site" button I wouldn’t need this), google browser sync, nagios checker, download manager

– Preferences > Preferred Applications: Mail Reader = Custom, Command = (empty)  one day we’ll figure out how this can be webmail

– Turned off text under application icons (Preferences > Menus & Toolbars)

– ~/.bashrc: alias ll=’ls -l’

– added additional software repositories to Synaptic Package Manager

– Install vim-full (why isn’t this the default?)

– Install Sun Java JRE

– Install MS TrueType core fonts

– Install Wine

– Install Beryl so that I can be like all of the other cool kids.  Hmm… too damn slow.  Annoying .25 sec pause when switching windows.  Turned off, until I have a faster machine.

– Install VMWare Server and Windows XP virtual machine (for testing stuff in Windows)

– Preferences > Font:
  Application font = Bitstream Vera Sans Roman, 8
  Document font = Bitstream Vera Sans Roman, 8
  Desktop font = Bitstream Vera Sans Roman, 8
  Window title font = Bitstream Vera Sans Bold, 8
  Fixed width font = Bitstream Vera Sans Mono Roman, 9
  Font Rendering = Subpixel smoothing (LCDs)

– gnome-terminal preferences:
  disable menubar
  Font = Bitstream Vera Sans Mono Roman, 9
  Forground/Background = White on Black
  Color Palette = Xterm
  Scrollback = 5000 lines
  Keyboard shortcuts:
    Ctrl-t for new tab
    Ctrl-n for new window
    Ctrl-x copy
    Ctrl-v paste

– gedit preferneces:
  disable text wrapping
  highlight current line
  enable automatic indentation
  disable create backup copy of files before saving
  Font = Bitstream Vera Sans Mono Roman, 9
  Added plugins: change case, sort

So far the only thing I miss from Windows is a text editor that can do column-mode editing (block copy/paste, insert column of incrementing numbers, etc).  While I love vi, I’d still like to use a text editor with a decent GUI from time to time.  I wish gedit had column-mode features.

Anybody know of a good text editor that has column-mode editing?

100,000 automated emails

Yay! I’ve passed the 100,000 unread email milestone…

It’s really time that I clean up the info-alerts that are sent to our engineers from our servers.  Do we really need to get an email every time each of our servers downloads a virus signature update?  We should just log it, and get an email if too much time goes by without them downloading an update… Lol, which already happens as well.