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
Recovering from a terminal full of gibberish
Have you ever accidentally tried to view a binary file and your terminal started spewing all sorts of weird characters?
$ cat /etc/localtime
???w?qˈ???#?p?a???u??@???U?? ???5?????????????
???s??ޗ?ݩ?py?߉rp??[??iTp?~=??I6p?^?
pa
?p@?0?p?'? ?p ??
?p
???
?u???????t??tyV?iVY8?I89?)"7?p???p?????p?܀??p v!??p"U?#j??$5?%J??&?'*??'?р)
p???q5?ro??s?tO??t??v8?pv?πx?px???y?hpz???{?Jp|~u?}?,p~^W??GәI
????????LMTCDTCSTESTCWTCPT
CST6CDT,M3.2.0,M11.1.0
▒⎼±␋⎺⎻␊#
The solution is to type reset and hit return.
▒⎼±␋⎺⎻␊# ⎼␊⎽␊├
Erase set to backspace.
$
There. All better.
Solution for "Could not create the Java Virtual Machine"
The problem: we wanted to give more memory to Blast2GO running on Windows 7 x64, but we kept getting the error *beep* "Could not create the Java Virtual Machine".
Looking at the makeJnlp.php file that the Blast2GO website gives you, I noticed the max-heap-size line:
<jnlp spec="1.0+" codebase="http://bioinfo.cipf.es/blast2go/webstart" href="http://bioinfo.cipf.es/blast2go/webstart/makeJnlp.php?mem=2048">
<information>
<title>Blast2GO 2048M</title>
<vendor>CIPF - UPV - IVIA</vendor>
<homepage href="http://www.blast2go.org"/>
<description>Blast2GO 2048M</description>
<description kind="short">Blast2GO 2048M</description>
<icon href="splash.gif"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+" initial-heap-size="64m" max-heap-size="2048M"/>
...
When I removed the max-heap-size assignment the JNLP file started just fine with Java Web Start (javaws.exe). Conclusion: somehow the machine could not actually allocate the amount of heap space we were asking for.
Sure enough, further investigation showed that the 32-bit version of Java had been installed instead of the 64-bit version.
After installing the 64-bit version and running the JNLP file with 64-bit javaws.exe, everything was fine.
Adding memory to a Dell Latitude D620
After adding a stick of RAM to a Dell Latitude D620 laptop and starting up, I saw this message:
The amount of system memory has changed.
If you did not change your memory...
To resolve this issue, try to reseat the memory
And it just hangs there. The solution: be patient. After a minute or so it will beep twice and let you enter setup or continue. Don't get all freaked out and start Googling around. Everything's fine.
In the meantime, contemplate the mystery contained in the elipsis above.
Solution to 100% CPU Usage by Linux Guest on VMWare Fusion
As part of my testing setup, I have an Intel Mac Pro with Mac OS X 10.6 Server (which runs with the 64-bit kernel) on which I run VMWare Fusion 3.0.1 and several Red Hat virtual machines.
I noticed that even at idle, each VM was taking up a high amount (like 100%!) of a CPU core. Additionally, on one VM top was displaying in near-real-time, which was kind of neat but I doubt the intended behavior. Because of this, I suspected the time management in the kernel was off.
Sure enough, Timekeeping Best Practices for Linux Guests has some hints, and for more information than you'll ever want, try Timekeeping in VMWare Virtual Machines (I was particularly interested in the Clocksource Kernels section).
Making the following modification to /etc/grub.conf on RHEL5 brought my CPU usage down from 100% to barely noticeable:
Before:
kernel /vmlinuz-2.6.18-164.11.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
After:
kernel /vmlinuz-2.6.18-164.11.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb divider=10
I took out quiet because I like to see what's happening when the system boots.
The Note on RHEL 5.4 or CentOS and divider=10 mentions that you do not need this for RHEL 5.4 for accurate timekeeping, but you do need it to prevent the excessive CPU use.
I also modified /etc/ntp.conf as described in the above article, adding
tinker panic 0
to the top of the file and commenting out the following lines:
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
#server 127.127.1.0
#fudge 127.127.1.0 stratum 10
My VMs are down from 100 percent CPU use to practically zero. Think of the energy savings!
Solution to Error 1327: Invalid Drive
I was migrating a Parallels virtual machine to VMWare Fusion. After importing the VM and starting it, I tried to install VMWare Tools but repeatedly got the message Error 1327: Invalid Drive Z.
It turns out that as part of its OS X integration Parallels writes entries to the registry.
The solution was to type regedit at the Windows command line and use it to remove any entries at
HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Explorer/User Shell Folders
that began with Z:. After that, everything was happy.
Western Digital My Book 2TB Smartware Not So Smart
I recently got a 2TB WD MyBook for doing offsite backups. Didn't realize that it comes with one of those annoying virtual CDs that mounts itself every time you plug in the drive. Dear Western Digital: I don't want to use your bundled software. I want to use the entire space on the drive.
So far there does not seem to be an easy way to get rid of it. Enough people must have complained that WD is providing a firmware update, but the update does not work for Studio versions of the drive.
Their other solution (and I use this term loosely) is to install their so-called Smartware program so that you can configure it to hide the virtual CD. No thanks.
Cacti Segfaulting on CentOS5
I was getting Cacti set up and was having trouble with PHP. Specifically, it appeared that enabling the Cacti cron job caused a PHP segfault. I looked in /etc/cron.d/cacti to see what was being run:
cat /etc/cron.d/cacti
#*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
Then I ran it from the command line myself:
# php -v
PHP 5.1.6 (cli) (built: Jan 13 2010 17:13:05)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
# php /usr/share/cacti/poller.php
Segmentation fault
Sure enough, an ugly error was recorded in /var/log/messages:
kernel: php[5250]: segfault at bf29ce64 ip b788cbf3 sp bf29cdc4 error 6 in libc-2.5.so[b7851000+13f000]
It turns out that this is what happens when you bork the permissions on cacti's MySQL table. After issuing a command like the following to MySQL, my segfault went away.
GRANT ALL ON cacti.* TO 'cactiusername'@'localhost' IDENTIFIED BY 'secret';
APC UPS and Snow Leopard Server Not Communicating
I have used APC (American Power Conversion) power equipment for a long time. I have had both good and bad experiences with their products (a cherished memory is calling their technical support and asking about the "smell of burning plastic" emanating from one of their units).
I've recently upgraded an Intel Mac Pro to Snow Leopard Server (OS X Server 10.6.2) and noticed that the controls in Energy Saver for the UPS are different. Not in a good way.
Here's the relevant screen from OS X Server 10.5.8:

And the same screen from OS X Server 10.6.2:

After reading a thread on Apple's support site about APC UPS Charge Percentage Not Updating I changed the setting on the server to that shown in the second screenshot above; namely, since the computer can't seem to read the charge percentage, it's better to let the computer monitor how long it's been on the battery.
Another annoyance is that I keep getting the dialog Your computer is now running on UPS backup battery power. The UPS is supposed to self-test every 14 days but I'm seeing the dialog more often then this.
It makes me uneasy, and I don't like being uneasy about servers.
See also: http://www.macworld.com/article/140207/2009/05/apc_leopard.html
Performance presentation, Des Moines Web Geeks
Matt Nuzum, the webmaster of ubuntu.com, invited me to speak at the Des Moines Web Geeks meeting last night. The venue, Impromptu Studios, was a bit hard to find. There were no signs for Impromptu Studios, but after lurking in dark alleyways for a while I eventually discovered what should have been obvious from the beginning: enter the furniture store with the "Closed" sign on the front and go up the stairs past the disused lavatory with a sign on the door saying "Beware of the Leopard."
The group was great and we talked for about an hour and half about bottlenecks and optimization. I even went home with a Django book!
Since this was a diverse group I tried to talk about things that everyone has to deal with (bottlenecks for storage, network, memory and CPU) rather than anything Drupal-specific.
As promised, last night's slides: Performance, Scalability on the Server Side (PDF, 1MB).



