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!

[ Submitted by John on Fri, 2010-02-12 11:35. | | ]

Installing mytop on RHEL5

I recently installed mytop on a new 64-bit Red Hat Enterprise Linux 5.4 server. Here are my notes.

The mytop program requires two Perl modules. So let's make sure those are installed first. The perl-DBI package is usually installed as a dependency already. Check if it's there:


# yum list installed *DBI
Loaded plugins: rhnplugin, security
Installed Packages
perl-DBI.x86_64 1.52-2.el5 installed

Install TermReadKey module, also known as Term::ReadKey. I am installing this from the EPEL repository, which I regard as very safe (in terms of compatibility, longevity and maintenance). If you're not set up with EPEL, you can do

# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

Anyway, installing Term::ReadKey from EPEL:


# yum install perl-TermReadKey
Loaded plugins: rhnplugin, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package perl-TermReadKey.x86_64 0:2.30-4.el5 set to be updated
--> Finished Dependency Resolution
...
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-TermReadKey 1/1

Installed:
perl-TermReadKey.x86_64 0:2.30-4.el5

Now it's time to get mytop.


# wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz
# tar zxvf mytop-1.6.tar.gz
# cd mytop-1.6
# perl Makefile.PL
Writing Makefile for mytop

# make test
cp mytop blib/script/mytop
/usr/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/mytop
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
1..1
ok 1

# make
Manifying blib/man1/mytop.1

# make install
Installing /usr/share/man/man1/mytop.1
Installing /usr/bin/mytop
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/mytop/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod

# which mytop
/usr/bin/mytop

[ Submitted by John on Tue, 2009-09-08 08:31. | | ]

RHEL5 won't install on Dell OptiPlex 745 with more than 4G RAM

I wanted to install RHEL5 x86_64 on a Dell OptiPlex 745 (that's an Intel Q965 (ICH8) Express chipset). I had a spare one sitting around and it had 6G of RAM.

However, when I booted from the installer CD and chose the RHEL 5 Server x86_64 option, it got up to the initrd line and then lots of text started scrolling by. The text was hard to read but I could make out the following phrases:

  • mapcount

  • trying to fix it up, but a reboot is needed

After letting that scroll by for a while, I ended up with a message stating that there was a kernel panic.

I was frustrated at not even being able to run the installer, but I solved this by passing the following parameters to the kernel:

mem=2G text

I then hopefully updated the box to kernel-2.6.18-128.4.1.el5.x86_64.rpm but alas, the same problem returned at boot time.

Finally, I pulled two 1G sticks from the box, reducing the memory to 4G. Now it boots fine.

[ Submitted by John on Wed, 2009-08-19 15:54. | | ]

yum update missing dependencies on RHEL5

I was getting the following dependency errors on a Red Hat Enterprise Linux 5 box. This was a stock box that has a RHEL subscription and had not used any yum repositories other than Red Hat's own official repositories.


# yum update
Loaded plugins: rhnplugin, security
Skipping security plugin, no data
Setting up Update Process
Resolving Dependencies
Skipping security plugin, no data
--> Running transaction check
---> Package libsoup.i386 0:2.2.98-2.el5_3.1 set to be updated
---> Package ghostscript.i386 0:8.15.2-9.4.el5_3.4 set to be updated
---> Package evolution-data-server.i386 0:1.12.3-10.el5_3.3 set to be updated
---> Package libpng.i386 2:1.2.10-7.1.el5_3.2 set to be updated
--> Processing Dependency: libebook-1.2.so.9 for package: gnome-panel
--> Processing Dependency: libebook-1.2.so.9 for package: control-center
--> Processing Dependency: libecal-1.2.so.7 for package: gnome-panel
--> Processing Dependency: libedataserver-1.2.so.7 for package: gnome-panel
--> Processing Dependency: libedataserver-1.2.so.7 for package: control-center
--> Processing Dependency: libedataserverui-1.2.so.8 for package: gnome-panel
--> Processing Dependency: evolution-data-server >= 1.1.4 for package: gnome-panel
---> Package device-mapper-multipath.i386 0:0.4.7-23.el5_3.1 set to be updated
---> Package lcms.i386 0:1.18-0.1.beta1.el5_3.2 set to be updated
---> Package kpartx.i386 0:0.4.7-23.el5_3.1 set to be updated
--> Processing Dependency: libgs.so.8 for package: ImageMagick
--> Processing Dependency: ghostscript for package: libgnomeprint22
--> Processing Dependency: ghostscript for package: ghostscript-fonts
---> Package firefox.i386 0:3.0.7-1.el5 set to be updated
---> Package xulrunner.i386 0:1.9.0.7-1.el5 set to be updated
---> Package curl.i386 0:7.15.5-2.1.el5_3.4 set to be updated
--> Finished Dependency Resolution
libgnomeprint22-2.12.1-10.el5.i386 from installed has depsolving problems
--> Missing Dependency: ghostscript is needed by package libgnomeprint22-2.12.1-10.el5.i386 (installed)
gnome-panel-2.16.1-7.el5.i386 from installed has depsolving problems
--> Missing Dependency: libecal-1.2.so.7 is needed by package gnome-panel-2.16.1-7.el5.i386 (installed)
1:control-center-2.16.0-16.el5.i386 from installed has depsolving problems
--> Missing Dependency: libedataserver-1.2.so.7 is needed by package 1:control-center-2.16.0-16.el5.i386 (installed)
gnome-panel-2.16.1-7.el5.i386 from installed has depsolving problems
--> Missing Dependency: libedataserver-1.2.so.7 is needed by package gnome-panel-2.16.1-7.el5.i386 (installed)
gnome-panel-2.16.1-7.el5.i386 from installed has depsolving problems
--> Missing Dependency: libebook-1.2.so.9 is needed by package gnome-panel-2.16.1-7.el5.i386 (installed)
gnome-panel-2.16.1-7.el5.i386 from installed has depsolving problems
--> Missing Dependency: libedataserverui-1.2.so.8 is needed by package gnome-panel-2.16.1-7.el5.i386 (installed)
ghostscript-fonts-5.50-13.1.1.noarch from installed has depsolving problems
--> Missing Dependency: ghostscript is needed by package ghostscript-fonts-5.50-13.1.1.noarch (installed)
gnome-panel-2.16.1-7.el5.i386 from installed has depsolving problems
--> Missing Dependency: evolution-data-server >= 1.1.4 is needed by package gnome-panel-2.16.1-7.el5.i386 (installed)
ImageMagick-6.2.8.0-4.el5_1.1.i386 from installed has depsolving problems
--> Missing Dependency: libgs.so.8 is needed by package ImageMagick-6.2.8.0-4.el5_1.1.i386 (installed)
1:control-center-2.16.0-16.el5.i386 from installed has depsolving problems
--> Missing Dependency: libebook-1.2.so.9 is needed by package 1:control-center-2.16.0-16.el5.i386 (installed)
Error: Missing Dependency: libecal-1.2.so.7 is needed by package gnome-panel-2.16.1-7.el5.i386 (installed)
Error: Missing Dependency: ghostscript is needed by package ghostscript-fonts-5.50-13.1.1.noarch (installed)
Error: Missing Dependency: ghostscript is needed by package libgnomeprint22-2.12.1-10.el5.i386 (installed)
Error: Missing Dependency: libebook-1.2.so.9 is needed by package 1:control-center-2.16.0-16.el5.i386 (installed)
Error: Missing Dependency: libgs.so.8 is needed by package ImageMagick-6.2.8.0-4.el5_1.1.i386 (installed)
Error: Missing Dependency: libebook-1.2.so.9 is needed by package gnome-panel-2.16.1-7.el5.i386 (installed)
Error: Missing Dependency: libedataserver-1.2.so.7 is needed by package 1:control-center-2.16.0-16.el5.i386 (installed)
Error: Missing Dependency: libedataserverui-1.2.so.8 is needed by package gnome-panel-2.16.1-7.el5.i386 (installed)
Error: Missing Dependency: evolution-data-server >= 1.1.4 is needed by package gnome-panel-2.16.1-7.el5.i386 (installed)
Error: Missing Dependency: libedataserver-1.2.so.7 is needed by package gnome-panel-2.16.1-7.el5.i386 (installed)

The solution was to clean out yum's local caches with:

yum clean all

and then

yum update

I suspect that yum clean headers alone might have done the trick, but I was too quick on the trigger with yum clean all.

Update: Anonymous says that yum clean dbcache works.

[ Submitted by John on Mon, 2009-03-23 08:36. | | ]

Installing APC on RHEL5

Here's how to install APC on RHEL5.
# yum install php-pear php-devel httpd-devel
# pecl install apc
# echo "extension=apc.so" > /etc/php.d/apc.ini
# service httpd restart

Check for the apc section in your phpinfo() page. If it's not there:

# tail /var/log/httpd/error_log
[Tue Aug 12 15:43:59 2008] [notice] Digest: done
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/apc.so' - /usr/lib/php/modules/apc.so: cannot open shared object file: Permission denied in Unknown on line 0

SELinux is preventing the extension from loading, I'll bet. Let's check:

# tail /var/log/messages
Aug 12 15:42:40 mybox yum: Installed: httpd-devel - 2.2.3-11.el5_1.3.i386
Aug 12 15:44:01 mybox setroubleshoot: SELinux is preventing the httpd from using potentially mislabeled files (./apc.so). For complete SELinux messages. run sealert -l 9e4bbfa8-327b-4bb2-94df-f154045a1ef1

Let's view the security contexts for our PHP extensions:

# ls -Z /usr/lib/php/modules
-rwxr-xr-x root root root:object_r:tmp_t apc.so
-rwxr-xr-x root root system_u:object_r:textrel_shlib_t dbase.so
-rwxr-xr-x root root system_u:object_r:textrel_shlib_t gd.so
...

Yup. Notice how the security context is missing (it's tmp_t for apc.so). Let's fix that.

# restorecon /usr/lib/php/modules/apc.so
]# ls -Z /usr/lib/php/modules
-rwxr-xr-x root root system_u:object_r:textrel_shlib_t apc.so
-rwxr-xr-x root root system_u:object_r:textrel_shlib_t dbase.so

[ Submitted by John on Tue, 2008-08-12 16:13. | | ]