Archive

Author Archive

Vmware Server 2 Web Access Connection Loss (vmware-hostd crash) Workarounds

November 16th, 2009 17 comments

Summery of Issue

With upgrading to RHEL 5.4, CentOS 5.4 and Ubuntu 9.10, the latest 2.x.x versions of VMware Server are having serious Web Access GUI connection failures, specifically vmware-hostd crashing repeatedly. This has been found with VMware Server 2.0.0, Vmware Server 2.0.1 and VMware Server 2.0.2. VMware Server 2.x.x was stable in the previous revisions of the mentioned OS’s. Below are two solutions that “appear” to make for a stable vmware-hostd process. You are advised strongly to satisfy your own assuredness of the stability of vmware-hostd using these solutions before deployment to a mission critical environment.

Both solutions do not require you to stop all vmware related processes on the host server. The following steps assume vmware-hostd has crashed and left VMware clients still running.

Verify vmware-host Process has Failed

Note: If you get the below from the ps command you have another issue and this document is not for you.

# ps -ef |grep vmware-hostd

root 10858 1 0 16:47 ? 00:00:02 /usr/lib/vmware/bin/vmware-hostd -a -d -u /etc/vmware/hostd/config.xml

root 11055 11026 0 17:02 pts/3 00:00:00 grep vmware-hostd

Regaining VMware Server 2 Web Access GUI Control

If you want to start the vmware-hostd process to manage your VMware Server 2 guest operating systems again you may do so with the following commands.

# export LD_LIBRARY_PATH=/usr/lib/vmware/vmacore:/usr/lib/vmware/hostd:/usr/lib/vmware/lib/libxml2.so.2:/usr/lib/vmware/lib/libexpat.so.0:/usr/lib/vmware/lib/libstdc++.so.6:/usr/lib/vmware/lib/libgcc_s.so.1:/usr/lib/vmware/lib/libcrypto.so.0.9.8:/usr/lib/vmware/lib/libssl.so.0.9.8

# /usr/lib/vmware/bin/vmware-hostd -a -d -u /etc/vmware/hostd/config.xml &

[1] 11139

# <hit return/enter>

[1]+ Done /usr/lib/vmware/bin/vmware-hostd -a -d -u /etc/vmware/hostd/config.xml

# ps -ef | grep hostd

root 11140 1 22 17:13 ? 00:00:01 /usr/lib/vmware/bin/vmware-hostd -a -d -u /etc/vmware/hostd/config.xml

root 11155 11026 0 17:13 pts/3 00:00:00 grep hostd&

nohup is not needed in this instance as vmware-hostd runs as a daemon but the ampersand “&” is. Otherwise you’ll get logged output to the screen and when you exit your session vmware-hostd will stop too.

Solving the VMware Server 2 Web Access GUI Connection Failure

I recommend looking at both solutions. I’m currently employing solution #2 but I’ll leave that decision up to you. Both allow you to use the start/stop /etc/init.d/vmware script as you normally would and are permanent unlike the quick fix above to get the vmware-hostd process up and running again. Again with both solutions you need to determine if they, in fact, produce a stable VMware Server 2 environment before deployment to a mission critical environment.

SOLUTION #1 (libc-2.5.so reversion – RHEL 5.4 & CentOS 5.4)

Download and copy libc-2.5.so into place:

# lynx http://mirror.centos.org/centos/5.3/os/x86_64/CentOS/glibc-2.5-34.x86_64.rpm

# rpm -Uvh –root=/tmp/ –nodeps ./glibc-2.5-34.x86_64.rpm

# mkdir /usr/lib/vmware/lib/libc.so.6

# cp /tmp/lib64/libc-2.5.so /usr/lib/vmware/lib/libc.so.6/libc.so.6

Edit /usr/sbin/vmware-hostd adding the following export command just before the last line in the script as follows:

# tail -3 /usr/sbin/vmware-hostd

export LD_LIBRARY_PATH=/usr/lib/vmware/lib/libc.so.6:$LD_LIBRARY_PATH

eval exec “$DEBUG_CMD” “$binary” “$@”

SOLUTION #2 (Circumventing vmware-hostd library wrapping script – RHEL 5.4, CentOS 5.4 & Ubuntu 9.10 )

Here is another method not requiring reverting to an older version of libc-2.5.so. The downside in this solution is it circumvents the dynamic library path building of the /usr/sbin/vmware-hostd script and executes the /usr/lib/vmware/bin/vmware-hostd binary directly. I do not know if this will present problems in the future or not.

Below is the snippet from the modified /etc/init.d/vmware. You can see I added a LD_LIBRARY_PATH statement, commented out the old exec call and added a new one.

# Start host agent

vmware_start_hostd() {

export LD_LIBRARY_PATH=/usr/lib/vmware/vmacore:/usr/lib/vmware/hostd:/usr/lib/vmware/lib/libxml2.so.2:/usr/lib/vmware/lib/libexpat.so.0:/usr/lib/vmware/lib/libstdc++.so.6:/usr/lib/vmware/lib/libgcc_s.so.1:/usr/lib/vmware/lib/libcrypto.so.0.9.8:/usr/lib/vmware/lib/libssl.so.0.9.8

vmware_bg_exec “`vmware_product_name` Host Agent” \

“$vmdb_answer_LIBDIR/bin/vmware-hostd” -a -d -u “$vmware_etc_dir/hostd/config.xml”

#”$vmdb_answer_SBINDIR/vmware-hostd” -a -d -u “$vmware_etc_dir/hostd/config.xml”

}

Restart VMware Server 2

If you don’t have critical guest OS’s running you can stop the guests via the VMware Server 2 Web Access GUI and restart VMware:

# /etc/init.d/vmware restart

Stopping VMware autostart virtual machines:
Virtual machines [ OK ]
Stopping VMware management services:
VMware Virtual Infrastructure Web Access
VMware Server Host Agent [ OK ]
Stopping VMware services:
VMware Authentication Daemon [ OK ]
VM communication interface socket family: [ OK ]
Virtual machine communication interface [ OK ]
Virtual machine monitor [ OK ]
Bridged networking on /dev/vmnet0 [ OK ]
Host network detection [ OK ]
DHCP server on /dev/vmnet1 [ OK ]
Host-only networking on /dev/vmnet1 [ OK ]
DHCP server on /dev/vmnet8 [ OK ]
NAT service on /dev/vmnet8 [ OK ]
Host-only networking on /dev/vmnet8 [ OK ]
Virtual ethernet [ OK ]
Starting VMware services:
Virtual machine monitor [ OK ]
Virtual machine communication interface [ OK ]
VM communication interface socket family: [ OK ]
Virtual ethernet [ OK ]
Bridged networking on /dev/vmnet0 [ OK ]
Host-only networking on /dev/vmnet1 (background) [ OK ]
DHCP server on /dev/vmnet1 [ OK ]
Host-only networking on /dev/vmnet8 (background) [ OK ]
DHCP server on /dev/vmnet8 [ OK ]
NAT service on /dev/vmnet8 [ OK ]
VMware Server Authentication Daemon (background) [ OK ]
Shared Memory Available [ OK ]
Starting VMware management services:
VMware Server Host Agent (background) [ OK ]
VMware Virtual Infrastructure Web Access
Starting VMware autostart virtual machines:
Virtual machines [ OK ]

As more information on this issue becomes available this post will be updated. Please post your findings too.

This information was generated by my experimentation and the helpful posts of the VMware Community, reference: http://communities.vmware.com/thread/229957?tstart=0

Categories: Linux, Vmware Tags:

Linux Command History – Add Time and Date Stamps

November 13th, 2009 1 comment

Ever want to know the time and date you executed a specific command on your Linux server? If you’re like me and constantly using your Linux command history in your bash shell this little addition to your .bash_profile comes in very handy.

Append these directives to you .bash_profile in your user directory:

HISTSIZE=10000
HISTFILESIZE=”
HISTCONTROL=ignoreboth
HISTTIMEFORMAT=’%a, %d %b %Y %l:%M:%S%p %z ‘

In this case a very large history will be kept, 10,000 commands to be exact. The output from a history command will look like this:

84 Fri, 13 Nov 2009 9:50:10AM -0500 history
85 Fri, 13 Nov 2009 9:57:16AM -0500 locate .bash_profile
86 Fri, 13 Nov 2009 9:57:38AM -0500 cat .bash_profile
87 Fri, 13 Nov 2009 9:58:50AM -0500 history

To have the changes to your .bash_profile take effect do one of the following:

  • # . .bash_profile
  • # source .bash_profile
  • or thirdly log out and back in
Categories: Linux Tags:

VMware Server 2 Advanced NAT

October 17th, 2009 2 comments

Summery

If you decide to use NAT’d networking for your VMware Server 2.x.x. guest OS you will want to create some port mapping to access the guest with the likes of SSH.  This documents the procedure for creating the needed mapping and uses SSH as an example.  In this document it’s assumed you have VMNet8 configured as your NAT network interface.  If you configured NAT during the installation and configuration of VMware Server 2.x.x and chose the default it will be VMNet8.

Adding a NAT Network Interface

If you did not add a NAT network interface during your VMware Server 2.x.x installation and configuration you may do it now by invoking the following command.

# /usr/bin/vmware-config.pl

Edit nat.conf

Open the file /etc/vmware/vmnet8/nat/nat.conf for editing.  In our example we will add three guest OS’s for SSH access via port mapping.  Most likely there is an example already for SSH under the [incomingtcp] section.  Under this section is where all incoming TCP traffic will be mapped.

Here are the three mappings for SSH access to our three guest OS’s.

# SSH
8889 = 192.168.96.10:22
8890 = 192.168.96.11:22
8891 = 192.168.96.12:22

Restart VMNet 8

Next you have to restart VMNet 8 for the changes to take affect.

# /usr/lib/vmware/net-services.sh restart 8

Try Your New Port Mappings

To gain access, if for example your VMware Server 2.x.x’s IP is 192.168.1.200, you would perform the following for our first guest OS:

# ssh -p 8889 user@192.168.1.200

Be sure your VMware Server’s ports are open in the firewall for, as in our example, 8889, 8890 and 8891 and of course port 22 for all the guests.

It’s important to note that if you run the configuration script for any reason your port mapping may get overwritten by the default nat.conf file.  Your port mappings are backed up to a file similar to this: nat.conf.old.0.

This should take care of SSH access to NAT’s VMware Server 2.x.x guest OS’s.  If you have any comments, we would like to hear from you.

Categories: Vmware Tags:

Changing the INove Theme WordPress Style Sheets

October 13th, 2009 1 comment

After wrestling a bit with the WordPress editor I decided the best way to make style sheet changes to the INove WordPress theme was to modify the themes style sheet and reference my custom style in a div element.

Make changes to the INove theme’s style sheet by going to:  Dashboard>Appearance>Editor and under Styles in the right column double click on “Stylesheet (style.css)”.  I had to add the following custom style to the bottom of style.css for it to get recognized.

.command_line {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
background-color: #000000;
padding-left: 8px;
padding-right: 8px;
padding-top: 10px;
padding-bottom: 2px;
}

Update the changes in the INove style sheet and go back to the WordPress editor to add the div elements.

Then

<div class="command_line">my command line text</div>

does the trick.  Also switching back and forth between Visual and HTML view in the WordPress editor doesn’t appear to disturb the div element.

Categories: Web Administration, WordPress Tags:

OpenFiler Vmware Guest Raid 1 Array Creation

September 4th, 2009 No comments

Summary

This is part 1 in a proof of concept serious involving the creation of a RAID 1 iSCSI Target using OpenFiler 2.13 and Vmware Server 2.  We will purposely fail one of the virtual disks in the array rebuild the array and verify the data.  In part one of the series we will create the Raid 1 array.  In subsequent parts we will create an ISCSI Target, connect Windows Vista using iSCSI Initiator and simulate RAID 1 drive failure and recovery.  The OpenFiler vmware appliance is free to download and use.  The installation of both Vmware Server 2 and OpenFiler 2.13 vmware appliance will not be covered here.

Create VMware virtual disks

From the VMware Server 2 web administration create two 50 MB disks for the OpenFiler VMware guest accepting the VMware defaults.

Create Raid Partitions

As seen in Figure 1, navigate to openfiler > Volumes > Block Devices and select the first of our newly created disks /dev/sdb.

FIGURE 1: opefiler > Volumes > Block Devices

Create a RAID array partition by selecting Partition Type: “RAID array member” for the entire cylinder range (default) and clicking “Create”.  See Figure 2.  The resulting RAID partition should like as seen in Figure 3.  Repeat the previous steps to create a RAID partition for /dev/sdc

FIGURE 2: opefiler > Volumes > Block Devices > /dev/sdb

FIGURE 3: openfiler > Volumes > Block Devices > /dev/sdb

Create New Raid 1 Array

Once the two raid devices have been created navigate to openfiler > Volumes > Software Raid as seen in Figure 4 below. Select RAID-1 from the drop down menu, leave the chunk size at default, select the two raid devices as seen in Figure 4 and click “Add array”.  The resulting raid array information will be displayed as seen in Figure 5.

Figure 4: openfiler > Volumes > Software Raid

Figure 5: openfiler > Volumes > Software Raid

Create New Volume Group

Navigate to openfiler > Volumes > Volume Groups and create the new volume group “volgroupraid001”.  If this is not your preferred volume group naming convention, change it to your liking.  After entering your “Volume group name”, select our newly created Raid 1 volume /dev/md0 and click “Add volume group” as seen in Figure 6.  The resulting Volume Group is displayed as seen in Figure 7.

Figure 6: openfile > Volumes > Volume Groups

Figure 7: openfiler > Volumes > Volume Groups

Create New Volume

Navigate to openfiler > Volume>Add Volume select our “volgroupraid001” volume group, enter the name our new volume “volraid001”, fill in a description, enter the Required Space” (32MB) and be sure to select the proper “Filesystem Type” of iSCSI.  Click “Create” when ready.  See Figure 8 below.  The resulting Volume Group will be as seen in Figure 9.

Figure 8: openfiler > Volume > Add Volume

Figure 9: openfiler > Volumes > Manager Volumes

In our next section we will create the OpenFiler iSCSI Target using our newly created RAID 1 volume.

WordPress – How to Add Navigation Tabs for Categories

August 16th, 2009 1 comment

Although navigation to WordPress categories is easily done through links under the “Categories” section of most blogs, people are so used to using the normal tab or button navigation that it is nice to be able to get to the WordPress categories this way too. Although there appears to be a number of ways to do this out there on the web, and not all successful I might add, by far the easiest way to add category tabs or category button navigation is to use the plugin called pages to link to. Many thanks to Mark Jaquith the author of this plugin.

If your running a later version of WordPress, in my case at the time of this post it was V2.8.4, the easiest way to ad a plugin is to go to Admin/Plugins/Search, type in the plugin name, “Page Links To”, select “Install” under the Actions column of the search results for the plugin you desire and then “Install Now”. Be sure to “Activate Plugin” on the resulting “Installing Plugin” page.

Once the “Page Links To” plugin is installed AND activated go to your “Categories” section of your blog, click on the category of interest then copy the resulting URL from your browser and save for the next step. Create the new WordPress category page by going to Admin/Pages/Add New/ and enter your title name for your WordPress category. Then down at the bottom under the “Page Links To” section enter your category URL you saved into the box named “Point to this URL:”. Give your page an order number to place it where you want in the navigation and check out your new categories page.

Categories: Web Administration, WordPress Tags:

WordPress – Create you own Page Template

August 13th, 2009 No comments

Here is a method if you want to be able to create your own page templates and have them available to choose from when you create a new page.

Assumptions: You have shell access and are in a Linux environment.

Typically one is happy with the default page template but would like to make a modification. Lets start with the default page template, copy it to a new file name and then edit it to be a new page template.

First make a copy of the default page template renaming it. In my case I’m using the Inove theme and they have separated their templates into a subdirectory called “templates”. So we have to touch two files to keep in line with this themes format.

# cd <your wordpress directory>/wp-content/themes/inove

# cp page.php page.custom.php

# vi page.custom.php

Edit the file to look like this:

<?php
/*
Template Name: Page by Category
*/
?>
<?php get_header(); ?>
<?php include(‘templates/page.custom.php’); ?>
<?php get_footer(); ?>

# cd <your wordpress directory>/wp-content/themes/inove/templates

# cp page.php page.category.php

Now make your modifications to page.custom.php under the templates directory and the next time you add a page it will be available to you as a page template.

Categories: Web Administration, WordPress Tags:

Emacs Quick PHP Configuration

August 10th, 2009 No comments

Some distributions install Emacs “fully loaded” with all the bells and whistles, some just install Emacs with the expectation that you’ll configure it to your liking.  This post will just give you the skinny on getting Emacs working with php nice and quick.

  1. Install Emacs.
  2. Go to http://php-mode.sourceforge.net/ and download and extract the latest php-mode.el in the .emacs.d directory of your home directory or in a directory of your choosing.
  3. Create or append the following in you ~/.emacs file being sure to give the proper location of you php-mode.el file.

    (setq inhibit-splash-screen t)
    (add-to-list ‘load-path “~/.emacs.d”)
    (require ‘php-mode)
    (add-to-list ‘auto-mode-alist ‘(“\\.ctp$” . php-mode))

  4. Save your .emacs file and test emacs on a php file.  You should get all the nice color coding and other niceties.  Incidentally, omit the first line about splash screen if you enjoy seeing it every time you start emacs.

If you find this post useful please leave us a comment.  Thank you!

Categories: Linux Tags: ,

WordPress Security – Locking Down Permissions on WordPress Files

April 20th, 2009 No comments

Many WordPress administrators use the popular WordPress security plugin “WP Security Scan”. In doing so you get a new administrative link at the bottom of your WordPress Dashboard labeled “Security”. If you drill down into this menu, Dashboard>Security>Scanner, the WP Security Scan plugin will check your WordPress file and directory permissions and give their recommendations. If you have a number of WordPress web sites this can become a chore to change manually.

Here is a little script to do that for you. It is self explanatory and can be ran even if your not using the WP Security Scan plugin.

Here is the script:

#!/bin/bash

# Secures the WordPress directory.
# Must be ran from the WordPress root directory.
# examples – wordpresschmod.sh html or wordpresschmod.sh blog

if [ $# -ne 1 ]; then
echo
echo “Usage $0
echo “Example $0 html or $0 blog”
echo
exit 1;
fi

DIR=$1
echo
echo “chmod -R 755 $DIR”
echo
chmod -R 755 $DIR
echo
echo “chmod 644 $DIR/.htaccess”
echo
chmod 644 $DIR/.htaccess
echo
echo “chmod 644 $DIR/wp-admin/index.php”
echo
chmod 644 $DIR/wp-admin/index.php
echo
echo “File Permission Security Changes Complete”
echo

exit 0;