HP Smart Array Utility ‘hpacucli’ Will Not Start

Problem

Attempting to run hpacucli results in an immediate error:

# hpacucli
HP Array Configuration Utility CLI 7.50.18.0
Detecting Controllers…
Error: Another instance of ACU is already running (possibly a service). Please
terminate the ACU application before running the ACU CLI.

Checking for other ACU processes you do not find any:

# ps -ef | grep -i acu
root     33827 33802  0 1:57 pts/2    00:00:00 grep -i acu

Solution

This problem can occur under certain conditions in which the lock files created by a previously running process are not cleaned up when the process exists. To resolve this issue – being certain that nothing is utilizing the tool (proven by examining the ps output), remove all of the lock files in /opt/compaq/cpqacuxe/bld/locks and remove all the files in that directory:

# ls /opt/compaq/cpqacuxe/bld/locks
ACU-XE                             CPQACU_MUTEX                 CPQACU_STOP_TRIGGER
CPQACU_FRONT_PROCESS_STOP_TRIGGER  CPQACU_STOP_PROCESS_RUNNING  CPQACUXE_HTTP_REQUEST_MUTEX

# rm -f /opt/compaq/cpqacuxe/bld/locks/*

Having cleared the errant locks, try starting hpacucli:

# hpacucli
HP Array Configuration Utility CLI 7.50.18.0
Detecting Controllers...Done.
Type "help" for a list of supported commands.
Type "exit" to close the console.

=>

Accessing an ISO9660 Image in Linux and Solaris

For those that aren’t aware, an iso is a disk image. More specifically, an iso is a disk image adhering to the ISO9660 standard and in modern Linux operating systems you can mount this just like you would any other filesystem and the kernel will take care of things behind the scenes to make this happen. This process however is not as easily performed on a Solaris host.

A piece of information that is important to note about the iso9660 standard is that the file must be mounted as a loopback device. By doing so, the loopback API is available to the kernel to access the underlying data. This is required because when a filesystem is completely encapsulated within a file, there is not a block device that can be used by the kernel.

Linux

Mounting

Mounting an iso in a modern Linux OS such as Ubuntu or even Red Hat is fairly trivial and can be done by executing

mount -o loop,ro disk1.iso /mnt/disk

where loop creates a loopback device, ro mounts as read-only, disk1.iso is the disk image (iso) and /mnt/disk is the directory which is to be used as the mount point.

The Linux kernel will create a loopback device which will reference the disk image. This device will be link between the OS and the data.

Unmounting

To unmount the image, this is done simply be issuing

umount /mnt/disk

Where /mnt/disk is the appropriate mount point. Linux will take care of the details for you.

Solaris

Mounting

Mounting a disk image on Solaris is a little more involved. This is due to the Solaris kernel not automating the loopback device creation process. We will need to create the device ourselves before we can then actually mount the filesystem but luckily Solaris includes a facility for this: lofiadm

Make the block device with lofiadm:

lofiadm -a /path/to/image.iso /dev/lofi/1

This will create a special block device /dev/lofi/1 that is then used to access the image

Mount the image as a read-only hsfs filesystem:

mount -F hsfs -o ro /dev/lofi/1 /mountpoint

For those that appreciate one-liners, you can combine these two into a slightly more complex mount command

mount -F hsfs -o ro `lofiadm -a /path/to/image.iso` /mountpoint

Unmounting

To unmount the image, you will need to remember to destroy the loopback device you created with lofiadm

umount /mountpoint
lofiadm -d /dev/lofi/1

where /dev/lofi/1 is the device that was originally created for the image during the mount process.

Note: HSFS (HSF) stands for High Sierra Format which is basically a subset of the ISO9660 standard. The primary difference is that ISO9660 includes international extensions.

References:

Create a Gentoo Guest Within VirtualBox

After doing some quick searches using my favorite search engine, I failed to find any specific information regarding any necessary configuration for a Gentoo system to live happily as a VirtualBox Guest. As such, I have decided to write this little how-to: so that those wanting to create their own base image may have some guidance. This is not meant to be a generic quick-start guide for installing Gentoo, but a specialized how-to for installing Gentoo as a VirtualBox guest.

VirtualBox Installation and Configuration

As this how-to is primarily geared towards the configuration of Gentoo within VirtualBox, I will not go into detail as to how one should install and configure VirtualBox. Instead, I will point you to VirtualBox’s official documentation here.

Guest Configuration

Create a new guest machine with the following parameters:

  • ACPI: Enabled
  • IO APIC: Disabled
  • Memory: 256 MB
  • NIC: Attached to its own Host Interface

Besides these options (which were set by default) make sure that you create a hdd with the appropriate amount of storage. I would recommend *at least* 4 GB (I chose 8 GB). The final difference is the NIC. Make a dedicated Host Interface for this guest so that you can SSH into this server while installing. This will come in handy as we will not install the guest additions until much later and copy/paste functionality comes in handy.

Boot the Gentoo cd-rom

For this how-to you will need to download install-x86-minimal-2007.0-r1.iso from your favorite Gentoo mirror. Boot your guest and when you are presented with the ‘boot:’ prompt be sure to load the kernel *without* framebuffer support by entering ‘gentoo-nofb’.

Gentoo Linux Installation LiveCD http://www.gentoo.org/
Enter to boot; F1 for kernels F2 for options.
boot: gentoo-nofb

After a few moments, Gentoo will be completely booted.

Gentoo Baseline

To help convey the time necessary to complete various steps. I would like to provide you with a baseline of the virtual machine I am working on. As Gentoo compiles everything itself, any times I publish are for my baseline and your results may vary.

livecd ~ # grep bogo /proc/cpuinfo
bogomips : 4434.23
livecd ~ # hdparm -tT /dev/hda

/dev/hda:
 Timing cached reads: 2432 MB in 2.00 seconds = 1216.85 MB/sec
 Timing buffered disk reads: 590 MB in 3.00 seconds = 192.63 MB/sec
livecd ~ # grep MemTotal /proc/meminfo
MemTotal: 255920kB

I would also like to note the hdparm results. VirtualBox will load portions of the disk into the Host OS’s memory and use it for better performance.

Enable SSH

At this point, it would be a good time to enable ssh. To do this, set your root password with ‘passwd root’ and enable sshd with ‘/etc/init.d/sshd start’.

livecd ~ # passwd root
New UNIX password:
Retype new UNIX password:
passwd: password updated successfully
livecd ~ # /etc/init.d/sshd restart
* Starting sshd ... [ ok ]

At this point, you should ssh into this guest to complete this how-to.

Preparing the Disks

Use fdisk to create your partition layout. You need at least a swap partition (type 82) and one Linux Partition (type 83). The following scenario shows /boot, swap, and / on /dev/hda

livecd ~ # fdisk -l /dev/hda

Disk /dev/hda: 8794 MB, 8794406912 bytes
16 heads, 63 sectors/track, 17040 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

    Device Boot Start End Blocks Id System
/dev/hda1 * 1 195 98248+ 83 Linux
/dev/hda2 196 1188 500472 82 Linux swap / Solaris
/dev/hda3 1189 17040 7989408 83 Linux

Use ‘mke2fs’ and ‘mke2fs -j’ to create file systems on the new partitions.

livecd ~ # mke2fs /dev/hda1
livecd ~ # mke2fs -j /dev/hda3
livecd ~ # mkswap /dev/hda2 && swapon /dev/hda2
Setting up swapspace version 1, size = 512479 kB
no label, UUID=782f1a7b-7980-4397-8a6b-837f44a5262c

Mount the newly created file systems on ‘/mnt/gentoo’. Create ‘/mnt/gentoo/boot’ and mount that as well.

livecd ~ # mount /dev/hda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/hda1 /mnt/gentoo/boot

Setting Up The Stage

Make sure your date and time is set correctly using ‘date MMDDhhmmYYYY’. Use UTC time.

livecd ~ # date
Sat Dec 8 22:42:49 UTC 2007
livecd ~ # date 120822432007
Sat Dec 8 22:43:00 UTC 2007

Next, download a stage 3 package from one of the Gentoo mirrors and save it in ‘/mnt/gentoo’.

livecd ~ # cd /mnt/gentoo
livecd gentoo # wget ftp://gentoo.osuosl.org/pub/gentoo/releases/x86/current/stages/stage3-i686*.tar.bz2

Now unpack the stage 3 archive.

livecd gentoo # time tar xjpf stage3*

real 1m2.197s
user 0m21.310s
sys 0m37.490s

Now install the latest Portage snapshot. Again, choose a mirror, download, and extract.

livecd gentoo # cd /mnt/gentoo/usr
livecd usr # wget http://gentoo.osuosl.org/snapshots/portage-latest.tar.bz2
livecd usr # time tar xjf portage*

real 1m5.045s
user 0m13.790s
sys 0m33.600s

Please note that if you begin to receive warnings regarding time stamps of files, you didn’t set your clock to UTC (GMT Timezone) Time. As far as I can tell, this message is purely cosmetic, but if the time continues to be incorrect, boot times will suffer as there is a brief but accumulating pause with every occurrence.

Chrooting

Mount the ‘/proc’ file system, copy over ‘/etc/resolv.conf’ and chroot into your new Gentoo environment.

livecd usr # cd /
livecd / # mount -t proc proc /mnt/gentoo/proc
livecd / # cp -L /etc/resolv.conf /mnt/gentoo/etc/
livecd / # chroot /mnt/gentoo /bin/bash
livecd / # env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...

Set Your Time Zone

Set your time zone information by using the correct listing in ‘/usr/share/zoneinfo’.

livecd / # cp /usr/share/zoneinfo/EST5EDT /etc/localtime
livecd / # date
Sat Dec 8 23:00:00 EST 2007

Before, you set the time to UTC (GMT Timezone) time. If you selected the correct timezone here, the correct time will be displayed when running ‘date’.

Set Your Host and Domain Name

Set your host name in /etc/conf.d/hostname and /etc/hosts. In the following example, we use ‘gentoo’ as the hostname and ‘virtualized’ as the domain name.

livecd / # cd /etc
livecd etc # echo "127.0.0.1 gentoo.is.virtualized gentoo localhost" > hosts
livecd etc # sed -i -e 's/HOSTNAME.*/HOSTNAME="gentoo"/' conf.d/hostname
livecd etc # hostname gentoo
livecd etc # hostname -f
gentoo.is.virtualized

Kernel Configuration

Install the ‘gentoo-sources’ kernel sources. Be sure to verify all of the correct kernel options are set as well. But first, we will want to update our Portage tree and emerge the latest version of Portage if it states.

livecd etc # time emerge --sync
real 1m2.431s
user 0m5.130s
sys 0m30.090s
livecd etc # time emerge portage
real 3m14.129s
user 1m9.380s
sys 1m40.180s
livecd etc # time emerge gentoo-sources
real 2m59.923s
user 0m25.670s
sys 1m1.750s
livecd etc # cd /usr/src/linux
livecd linux # make menuconfig
livecd linux # time make -j2
real 6m35.241s
user 3m40.490s
sys 2m53.430s
livecd linux # make modules_install
livecd linux # cp arch/i386/boot/bzImage /boot/kernel

Items to be aware of
1. Processor type and features

  • Processor family->
    • Enable Tickless System (Dynamic Ticks)
    • Remove High Resolution Timer Support
    • Remove Symmetric multi-processing support
    • Subarchitecture Type
      • PC-compatible
    • Remove Machine Check Exception
    • Remove 64 bit Memory and IO resources
    • High Memory Support (off)

2. Power Management Options

  • Remove Suspend to RAM and standby
  • Remove Hibernation
  • Enable ACPI Support

3. Device Drivers

  • Remove Macintosh device drivers
  • Remove Virtualization

4. Device Drivers -> ATA/ATAPI/MFM/RLL support

  • enable Generic PCI bus-master DMA support
    • Intel PIIXn chipsets support
  • enable PCI IDE chipset support

5. Device Drivers

  • Serial ATA and Parallel ATA drivers
    • enable Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support

6. Device Drivers

  • Network device support
  • Remove Ethernet (1000 Mbit)
  • Remove Ethernet (10000 Mbit)

7. Device Drivers

  • Ethernet device support
    • Ethernet (10 or 100Mbit)
    • Remove 3COM cards
    • Remove “Tulip” family network device support
    • Remove Broadcom 4400 ethernet support
    • Remove nForce Ethernet support
    • Remove Intel(R) PRO/100+ support
    • Remove RealTek RTL-8139 C+ PCI Fast Ethernet Adapter Support
    • Remove RealTek RTL-8129/8130/8139 PCI Fast Ethernet Adapter Support
    • Enable AMD PCnet32 PCI support

8. Device Drivers

  • Graphics support
    • Remove Lowlevel video output switch controls
    • Enable Support for frame buffer devices
    • Enable Support for frame buffer devices
      • VESA VGA graphics support

Configure the System

Now we need to configure the fstab. Edit ‘/etc/fstab’ and make it look like the following.

livecd linux # cd /etc
livecd etc # nano -w fstab
/dev/hda1 /boot ext2 noauto,noatime 1 2
/dev/hda3 / ext3 noatime 0 1
/dev/hda2 none swap sw 0 0

Next, configure your network devices by editing ‘/etc/conf.d/net’. As the network ‘hardware’ configuration is really transparent of the guest we won’t have to worry about TUN devices or other interesting configurations. An empty configuration file resulting in DHCP should suffice for most users.

Next, set the root password and make sure the timezone is set correctly in ‘/etc/conf.d/clock’.

livecd linux # passwd
New UNIX password:
Retype new UNIX password:
passwd: password updated successfully
livecd linux # nano -w /etc/conf.d/clock
TIMEZONE="EST5EDT"

Change any settings you wish in ‘/etc/rc.conf’, ‘/etc/conf.d/rc’, and ‘/etc/conf.d/keymaps’.

Installing System Tools

Here we will install and configure various system tools such as cron and syslog.

livecd conf.d # time emerge syslog-ng vixie-cron slocate dhcpcd
real 2m21.958s
user 0m41.350s
sys 1m18.040s
livecd linux # rc-update add syslog-ng default
* syslog-ng added to runlevel default
livecd linux # rc-update add vixie-cron default
* vixie-cron added to runlevel default
livecd linux # time slocate -u
real 0m10.557s
user 0m0.130s
sys 0m5.450s

Configuring Grub

Finally, we will need to install a bootloader. I prefer grub over lilo so I will show the configuration for grub. Emerge grum and modify ‘/boot/grub/grub.conf’ to make it resemble mine.

livecd conf.d # time emerge grub

real 1m19.926s
user 0m31.080s
sys 0m35.280s
livecd linux # nano -w /boot/grub/grub.conf
default 0
timeout 5

title=Gentoo
root (hd0,0)
kernel /boot/kernel root=/dev/hda3

livecd linux # grub

grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.

grub> quit

Rebooting

We finally reach the end of our Gentoo base installation. All that is left is to unmount the filesystems, unmount the cd-rom from VirtualBox, and reboot into our new clean environment.

livecd conf.d # exit
livecd / # umount /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo
livecd / # reboot

References:

Installing JSON Support in PHP on Centos 5.4

I’ve been toying around with ExtJS for the past few days and wanted to start using JSON to insert data into my widgets. To my surprise (or lack thereof) CentOS does not include the JSON library with any of the default installed binaries. Below is how to go about installing JSON support for php. This quick how-to is specific for CentOS 5.4 thus the following steps may need to be modified based on what OS you are currently running.

Update PHP

yum update php

Install the PHP development package

yum install php-devel

Install pear for php

yum install php-pear

Use pecl (from pear installation) to buildinstall JSON

pecl install json

Create json.ini for your php installation

echo "extension=json.so" > /etc/php.d/json.ini

Reload Apache

service httpd restart

At this point, if you see the below when you look at the output of phpino(); you have successfully installed json.

phpinfo() showing enabled JSON module

Building a Jumpstart Box from Scratch

The quickest way to build and deploy Solaris servers in an enterprise environment would be to utilize JumpStart. SunOracle provides documentation on how to accomplish this task but this documentation is filled with an incredible amount of extraneous information that just isn’t needed for a basic JumpStart setup and can be extremely confusing for an inexperienced person to grasp.

Step 1: Install a base Solaris 9 server

You may do this any number of ways. If you already have a JumpStart server and a base Solaris 9 profile you can JumpStart a new box, or if you do not you can just perform a base install using the media of your choice.

Step 2: Create some preliminary directories

There are several directories that you should create.

#> mkdir -p /jumpstart/OS
#> mkdir /jumpstart/Profiles
#> mkdir /jumpstart/Flasharchives

Step 3: Create an image of the OS media

Copy the contents of the media (in this case DVD) to the server. Since this server will also be our boot server we also want to copy over the needed boot images. To do so type the following:

#> mount -F hsfs -o ro /dev/dsk/c1t0d0s0 /mnt
#> cd /mnt/Solaris_9/Tools
#> ./setup_install_server /jumpstart/OS/Solaris_9/

Step 4: Create the sysidcfg file for your OS

This is well documented in the complicated documentation linked to at the top of this page. Here’s an easier way.

Put the following into ‘/jumpstart/OS/Sysidcfg/Solaris_9′:

#
# Copyright (c) 2000-2002 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident  "@(#)sysidcfg 2.7     02/02/21     SMI"
#system_locale=en_US
timezone=US/Eastern
network_interface=primary {netmask=255.255.255.0
protocol_ipv6=no
default_route=none}
terminal=vt100
security_policy=NONE
name_service=NONE
timeserver=localhost
##

Step 4: Copy over existing rules, profiles, sysidcfgs, and flars

If this is a rebuild or a replacement build, copy any existing configurations over to the new server. This includes but is not limited to:

  • /jumpstart/sysidcfgs/*
  • /jumpstart/profiles/*
  • /jumpstart/rules
  • /jumpstart/<start and stop scripts>
  • /mnt/Solaris_9/Tools/add_install_client
  • <other files you may wish to hold on to>

We should also take some time to clean up our configurations. Edit ‘/jumpstart/rules’ and remove all of the entries except for the “any” entry and any others that you will surely be using. Also delete all of the profiles that don’t have a corresponding rules entry out of  ‘/jumpstart/profiles’. Feel free to regenerate the rules.ok file

#> cd /jumpstart
#> ./check

Yeah, that’s right, you made a mistake in the rules file didn’t you? Fix it now before you forget…

Step 5 (Optional): Modify the nomatch.beg start script

Located in ‘/jumpstart’ you should see a script name nomatch.beg. This script is run anytime a machine does not match another rule in the ‘/jumpstart/rules.ok’ file. What I like to do is to have it spit out a reasonable error message stating:

This server did not have a matching rule listed in /jumpstart/rules.ok. Did you run /jumpstart/check after modifying it?

It really beats the alternative (the installation just failing, thanks Sun for another glorious use of documentation, comments, and error messages).

Step 6: Add a client to the configuration, check running services, and test

We have now reached the point were we can add a client to the JumpStart server and test the configuration. Add a client to the server by adding an entry in:

  • /etc/ethers
  • /etc/hosts
  • /jumpstart/profiles
  • /jumpstart/rules

Now check the rules file like a good little person:

#> cd /jumpstart
#> ./check

Next be sure to add the client to allow tftpboot to work:

#> ./add_install_client -s :/jumpstart/os/200509_Solaris_9 -c :/jumpstart -p :/jumpstart  sun4u

NOTE: If when you add the client you receive odd errors, make sure that rpc is running and re-add the client

#> /etc/init.d/nfs.server stop && /etc/init.d/rpc start && /etc/init.d/nfs.server start
#> cd /jumpstart
#> ./add_install_client -s :/jumpstart/os/200509_Solaris_9 -c :/jumpstart -p :/jumpstart  sun4u

Now let’s check and see if the 2 necessary process are running to get the jump off the ground:

  1. verify that in.rarpd is running (ps -ef |grep -i in.rarpd)
  2. verify that in.tftpd is available (cat /etc/inetd.conf |grep -i tftp)

And finally, test the server by jumping the test box by booting the test box, sending a break and typing:

ok> boot net:speed=100,duplex=full -v - install

Or if you are fortunate enough to have good gigabit hardware:

ok> boot net:speed=1000,duplex=full -v - install

The client should soon start to build itself at this point with regard to how it is set up (flasharchive, new build, etc)

This concludes setting up a very basic JumpStart server. The documentation from SunOracle, while confusing, is very detailed and documents many other configuration options not discussed here. I would recommend reading it once you play with a basic setup for a while.

References:

Per-User Web Directories in Apache 2

Per-User web directories is a very simple service to enable and configure, yet I have seen it implemented in many different [and sometimes hilarious] ways.

For the uninitiated, a per-user web directory is a directory on the web server for each user which is meant to contain a user’s web files. These files are then made available by accessing a url similar to http://example.com/~rdmenotte. This in my experience is most often seen in University environments. As a user of this setup, you will have access to a directory (typically in your home directory) that contains files that make up your own personal website which you can update.

Let’s see how to properly configure this feature.

Basic Configuration

Assuming you have an up to date copy of Apache installed on your system, simply modify your httpd.conf file (located at /etc/httpd/conf/httpd.conf on RHEL) to include

UserDir public_html

The only other thing you must do (and this can be an exercise left up to the end user) is to create the public_html directory in the root of the user’s home directory with read and execute permissions. Also, the user’s home directory will need to have read and execute permissions for everyone. Your users do know how to properly permission their stuff right? Reload the configuration file and you’re off to the races! Each user that creates the public_html directory with the proper permissions will be able to go to http://example.com/~username/ and have their own personal website. Apache automatically takes care of mapping the user’s public_html directories to the URI so you don’t have to deal with anything silly like mod_rewrite rules or things like that (One of my previous places of employment decided that was how they were going to implement per-user web directories. They had a mod_rewrite rule for every user!)

Limiting this ability to a specific subset of users is simple. Along with telling Apache what directory to look for, you can specify users you want to strictly allow or deny access by doing the following:

Enable for all users except for userA, userB, and userC

UserDir enabled
UserDir disabled userA userB userC

Enable for ONLY users userA, userB, and userC

UserDir disabled
UserDir enable userA userB userC

One last little option to make note of is picking the location of the web enabled directory. It doesn’t have to be in the user’s home directory! If, for instance, you wanted to keep your web directories together, you could do the following

UserDir /var/www/*/web

This would cause the request to http://example.com/~userA to actually look in the directory /var/www/userA/web. Just be sure to grant ownership of that new directory to your user or they are sure to complain. You can also specify the UserDir like

UserDir /var/html

This would cause the request to http://example.com/~userA to look in the directory /var/html/userA. Again, be sure to give the user permissions to write in this directory.

There are quite a few other neat little tidbits you can configure that make the per-user web directory feature. The Apache group has really good documentation on its abilities here and here.

References: