Hyper-V + Opteron 6100 + RHEL5 = Kernel panic - not syncing: Fatal exception

I'm trying out Hyper-V on Windows Server 2008 R2. My first attempt is to create a VM running Red Hat 5.5. This is what I get after the initial screen:

The VM has 2GB of memory which should be plenty (I upped it to 4GB and got the same result). I get a slightly different message when using 32-bit instead of 64-bit:

I'm using a legacy virtual network adapter as the documentation suggests. Hints are welcome. This is on a Dell PowerEdge R815 with two AMD Opteron 6100's and 40GB of RAM.

Update: Thanks to Heine for pointing me to this bug.

[ Submitted by John on Tue, 2010-08-31 11:17. | | ]

Multiple monitors with Windows 7 and an ATI FirePro 2460 (FireMV)

When planning a triple or quad monitor setup with Windows 7 and an ATI FirePro™ 2460 Multi-View Professional Graphics card, read the small print.

In my case, reading the following small print from the data sheet carefully would have saved some time:

Important: When using mini DisplayPort-to-singlelink DVI adapters, quad output is divided into two pairs (displays 1 and 2, and displays 3 and 4). The displays used in each pair must be identical (with the same manufacturer and model number) and must be identically configured (with the same resolution)...

In my case, I had two identical Dell 19" displays and one of the new energy-efficient G2210 displays. I paired the two 19-inchers on DisplayPort connectors 1 and 2, and put the G2210 on the third DisplayPort connector. All used the DisplayPort-to-singlelink DVI connectors that came in the box with the card.

Problem: In Windows 7 x64, when trying to configure multiple monitors in the control panel (Control Panel\Appearance and Personalization\Display\Screen Resolution), I kept getting the message "Unable to save display settings" when I tried to extend the desktop.

Solution: What was meant by that cryptic message was really "the two displays you think are identical really aren't". Sure enough, one of the 19-inch displays was an UltraSharp 1901 and the other was an UltraSharp 1905. They look identical and have the same native resolution and connectors. I scuttled around, found another 1905, and swapped it in. When I powered up, sure enough, with two UltraSharp 1905's the control panel doesn't complain at all.

Did I mention the 2460 is fanless? Yum.

[ Submitted by John on Fri, 2010-08-06 10:29. | | ]

Command-line backup for VMWare Fusion Virtual Machines

If you have a bunch of VMWare Fusion virtual machines running, you can suspend them programmatically using vmrun and rsync them to a mounted volume. Then, with the copy completed, you can resume the virtual machines.

#!/bin/bash

BACKUPDIR=/Volumes/Backup/VMs

/Library/Application\ Support/VMware\ Fusion/vmrun list | tail -n +2 | while read VM
do
  echo "Suspending $VM"
  time /Library/Application\ Support/VMware\ Fusion/vmrun -T fusion suspend "$VM"
  echo "Suspended $VM"
  
  DIR=`dirname "$VM"`
  echo "Rsyncing $DIR"
  rsync -av "$DIR" "$BACKUPDIR"
 
  echo "Resuming $VM"
  time /Library/Application\ Support/VMware\ Fusion/vmrun -T fusion start "$VM"
  echo "Resumed $VM"
done

Note: this hung on Windows VMs until I updated VMWare Tools to the latest version on the guest. The above is currently working on Fusion 3.1 for RHEL5 and Windows 2008 R2 Server guests.

[ Submitted by John on Tue, 2010-06-08 14:28. | | ]

Changing Drupal database URLs programmatically from the command line

I had a need today to batch-change a lot of database connection strings in Drupal installations. You might need to do this if you have a lot of sites and are switching from webserver-and-database-server-on-the-same-box to Drupal with a separate database server. Here were some handy shell commands that I used.

Find all the settings.php files in this directory tree:

find /var/www/html -name settings.php -print

Show all the current database connection strings (make sure no one's looking over your shoulder!):

find . -name settings.php -exec grep -nH ^\$db_url {} \;

The grep finds lines beginning with $db_url. The -n switch prints out the line number of the match; the -H switch prints the filepath. Sample output:

./foo/site1/sites/default/settings.php:93:$db_url = 'mysql://myuser:secret@localhost/database1';
./foo/site2/sites/default/settings.php:93:$db_url = 'mysql://myotheruser:othersecret@localhost/database2';
...

Now, change the sites from pointing to localhost to pointing to database.example.com:

find /var/www/html -name settings.php -exec sed -i '80,95s#t@localhost#t@database.example.com#' {} \;

Translation to English: descend recursively into the /var/www/html directory. When you find a file named settings.php, look in lines 80-95 of the file. If you find a string that contains t@localhost, change it to t@database.example.com. Save the file, overwriting the file that is currently there (that's the -i switch to sed). The # characters are delimiters.

Note that I'm cheating here, because I happen to know that all passwords end with the letter t which makes my string matching easier.

[ Submitted by John on Mon, 2010-06-07 15:27. | | ]

FreeBSD vfs.ufs.dirhash_maxmem FTW

I have a busy web frontend server many files in a single directory. The server is running FreeBSD 8 amd64. Here is the result of changing the sysctl vfs.ufs.dirhash_maxmem to 67108864. Note the change in system (red) area. The vertical arrow shows when the change was made:

[ Submitted by John on Mon, 2010-05-24 10:14. | | ]

CrashPlan PRO and Java for Mac OS X 10.5 Update 7

I updated two servers using my normal upgrade process and all is well. My process:

  1. Stop CrashPlan

  2. Clone server using SuperDuper! with the Smart Update option
  3. Install update
  4. Restart server
  5. Start CrashPlan
  6. Verify that everything is working
[ Submitted by John on Wed, 2010-05-19 15:32. | | ]

Setting Up GeoIP Lookup in awstats on RHEL5

I assume awstats (and awstats-selinux) are already installed.

Step 1: Install the most excellent GeoLite data from MaxMind

mkdir /usr/local/share/GeoIP
cd /usr/local/share/GeoIP
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
gunzip *gz

Step 2: Install the GeoIP C API

There will be a dependency on zlib so make sure zlib-devel is installed:

yum install zlib-devel

Now download and compile:

wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.6.tar.gz
tar xvzf GeoIP-1.4.6.tar.gz
cd GeoIP-1.4.6
./configure
make
make check
sudo make install

Make it possible to link against the geoip library:

sudo echo '/usr/local/lib' > /etc/ld.so.conf.d/geoip.conf
sudo ldconfig

Step 3: Install the Geo::IP Perl Module

cd ~
wget http://geolite.maxmind.com/download/geoip/api/perl/Geo-IP-1.38.tar.gz
tar xzvf Geo-IP-1.38.tar.gz
cd Geo-IP-1.38
perl Makefile.PL LIBS='-L/usr/local/lib'
make
make test
sudo make install

Step 4: Enable the GeoIP Plugin

Edit /etc/awstats/awstats.yourdomain.conf to add these lines:

LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat"
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoLiteCity.dat"
LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoIPASNum.dat"

Reference: GeoIP Information for AWStats
Speedup Awstats by using GeoIP instead of DNS Lookups

[ Submitted by John on Wed, 2010-05-19 13:12. | | ]

Good job, G-Tech

I've been buying G-DRIVE external hard drives since firing LaCie. G-Tech drives were formerly made by Fabrik, which was bought out by Hitachi last year.

I had my first G-DRIVE hard drive failure happen, on a 1TB G-DRIVE Q (for quad interface: eSATA, USB 2.0, and Firewire 400/800). There was no data loss since this particular drive was the primary drive on a Mac Mini, and I've been using the excellent SuperDuper! to do scheduled cloning from the external drive to the Mini's internal drive. Thus, when the external hard drive failed, the Mini silently failed over to the internal drive. But I digress.

Two weeks after getting an RMA number and shipping the drive back, I received a package from Hitachi. I expected the old enclosure back, possibly with a refurbished drive in it. Instead, a brand-new 2TB drive. That's right, 2TB instead of 1TB. New power supply and everything. Even a Firewire 400-to-800 cable enclosed.

Thanks, Hitachi.

[ Submitted by John on Mon, 2010-05-17 13:05. | ]

Slides from Batch vs. Queue: an API Smackdown

Here are the slides and the two testing modules from my presentation at DrupalCon San Francisco 2010. The modules run on Drupal 7.

Slides from Batch vs Queue: an API Smackdown (5.8 MB PDF)

[ Submitted by John on Tue, 2010-04-20 13:39. | | ]

Installing Microsoft TrueType fonts on RHEL5, Step by Step

I'm doing some experimentation with JpGraph on Red Hat Enterprise Linux 5.5. So I wanted to install some TrueType fonts. Here's a step-by-step of how I did it, following the superb instructions given here.

Installed the rpm-build utility.

# yum install rpm-build

Then installed the cabextract utility, available on EPEL.

# yum install cabextract

Downloaded the latest spec file for msttcorefonts:

curl -O http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec

Created a ~/.rpmmacros file containing one line:
%_topdir %(echo $HOME)/rpmbuild

Then I followed the instructions to create necessary directories:

$ mkdir -p ~/rpmbuild/BUILD
$ mkdir -p ~/rpmbuild/RPMS/noarch

Built the rpm:

$ rpmbuild -bb msttcorefonts-2.0-1.noarch.rpm

For me, it stopped once during the build with a 500 error from Sourceforge:

Resolving hivelocity.dl.sourceforge.net... 74.50.111.26
Connecting to hivelocity.dl.sourceforge.net|74.50.111.26|:80... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2010-04-12 13:26:10 ERROR 500: Internal Server Error.

error: Bad exit status from /var/tmp/rpm-tmp.51326 (%prep)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.51326 (%prep)

I simply ran the previous command again and it worked.

Installed the rpm as root:

# rpm -ivh /home/john/rpmbuild/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm

I now see that the fonts are in /usr/share/

# find /usr -name *ttf -print

...
/usr/share/fonts/msttcorefonts/georgiaz.ttf
/usr/share/fonts/msttcorefonts/comic.ttf
/usr/share/fonts/msttcorefonts/times.ttf
/usr/share/fonts/msttcorefonts/timesbi.ttf
/usr/share/fonts/msttcorefonts/impact.ttf
/usr/share/fonts/msttcorefonts/verdanaz.ttf
/usr/share/fonts/msttcorefonts/georgiab.ttf
/usr/share/fonts/msttcorefonts/arialbi.ttf
/usr/share/fonts/msttcorefonts/arialbd.ttf
/usr/share/fonts/msttcorefonts/ariblk.ttf
/usr/share/fonts/msttcorefonts/trebucbd.ttf
/usr/share/fonts/msttcorefonts/couri.ttf
/usr/share/fonts/msttcorefonts/trebuc.ttf
/usr/share/fonts/msttcorefonts/timesi.ttf
/usr/share/fonts/msttcorefonts/verdanab.ttf
/usr/share/fonts/msttcorefonts/timesbd.ttf
/usr/share/fonts/msttcorefonts/courbd.ttf
/usr/share/fonts/msttcorefonts/arial.ttf
/usr/share/fonts/msttcorefonts/georgiai.ttf
/usr/share/fonts/msttcorefonts/ariali.ttf
/usr/share/fonts/msttcorefonts/courbi.ttf
/usr/share/fonts/msttcorefonts/comicbd.ttf
/usr/share/fonts/msttcorefonts/webdings.ttf
/usr/share/fonts/msttcorefonts/trebucbi.ttf
/usr/share/fonts/msttcorefonts/georgia.ttf
/usr/share/fonts/msttcorefonts/trebucit.ttf
/usr/share/fonts/msttcorefonts/cour.ttf
/usr/share/fonts/msttcorefonts/tahoma.ttf
/usr/share/fonts/msttcorefonts/verdanai.ttf
/usr/share/fonts/msttcorefonts/verdana.ttf
/usr/share/fonts/msttcorefonts/andalemo.ttf
...

Reference: An easy way to install Microsoft's TrueType core fonts on linux

[ Submitted by John on Mon, 2010-04-12 13:45. | | ]