Archive for Linux

Monitoring an Adaptec 2400a RAID ARRAY with CentOS5 (RHEL)

I have two older machines with Adaptec 2400A RAID cards in them which recently both got upgraded to CentOS5.  The first task was to figure out how to monitor the arrays.  CentOS 5.2 went in without a problem but getting information about the status of the disks from the array was not easy and google was little help (at the time).

Here is how you monitor the array using raidutil if you have the older Adaptec 2400a card:

Install raidutil:

wget "http://i2o.shadowconnect.com/raidutils/raidutils-0.0.6-1.i386.rpm"
rpm -Uvh raidutils-0.0.6-1.i386.rpm

Next, add the dev control structures so raidutil knows what to do with the card when it queries it

mknod /dev/i2o/ctl c 10 166
mknod /dev/dpti17 c 10 166
modprobe i2o_config

Now, you can query your controller:

 raidutil -L all
 raidutil -L physical

Removing the Password on an Apache SSL Certificate

Every once in a while I run across an SSL Cert with an included password. Although the security is great automating an environment or an Apache restart with required interaction is problematic.

Here is an example of the interaction with a password included SSL Cert:

[root@w2 conf.d]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: Apache/2.2.8 mod_ssl/2.2.8 (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide the pass phrases.
 
Server chrisschuld.com:443 (RSA)
Enter pass phrase:
 
OK: Pass Phrase Dialog successful.

And here is how you remove the password:

[root@w2 conf]# openssl rsa -in chrisschuld.com.key -out chrisschuld.com.key.nopass

How to fix the Curl Error: error setting certificate verify locations

Today I had a new server running CentOS5 have trouble with a known good authorize.net library using curl.  It was producing the following error:

error setting certificate verify locations: CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none

After some research I found it was based on the inability for the apache user to access the ca-bundle.crt file. You will find solutions on the web suggesting adding curl_setopt($link, CURLOPT_SSL_VERIFYPEER, FALSE); to your script to disable the peer verification — I suggest you not do this and simply fix the permissions for your CA file.

Execute this:

/bin/chmod 755 /etc/pki/tls/certs

Solved!

Finding symbolic links in linux

I always have to use the man page of find to remember this — hopefully writing it down will help.  Here is how you find all of the symbolic links in a linux path:

find / -type l

pdftk for CentOS5 (AccessPDF for CentOS 5)

Today I ran across a project need for pdftk (AccessPDF) for CentOS5.  Adding pdftk to CentOS5 was more of struggle than I would have guessed because it was not available in most of the repos I normally use.  Google did not yield any pre-build RPM files for pdftk for CentOS5 so I built them for both 32bit and 64bit.

You can access it here pdftk-112-1i386.rpm (for CentOS5 32bit) and here pdftk-112-1×86_64.rpm (for CentOS5 64bit).


Search and Replace in Files

Here is how to do a search and replace using Perl regex over a set of files:


perl -pi -e 's/source/destination/g' *.ext



Playing MP3 Files in Fedora 8 using KDE

To play MP3 files in Fedora 8 with KDE you need to add software to your default installation. This software does not come “stock” with KDE because the software is not free and RedHat is required to filter it — therefore if you download this update make sure you check the licensing agreements:

  1. First, add Livna sources using rpm
    rpm -ivh http://rpm.livna.org/livna-release-8.rpm
  2. Next, Install kdemultimedia-extras-nonfree** using yum
    yum install kdemultimedia-extras-nonfree
  3. That is it, next launch Amarok as an example and hello MP3 music!
    Amarok Launching
    Q: Hey Chris, why does the kdemultimedia-extras package end in “-nonfree”
    A: Good question, tough answer, the kdemultimedia-extras-nonfree package contains plug-ins which cannot be shipped by Red Hat / Fedora because the license is not LGPL. Please note the the license of the entire library is not LGPL! So of course you shouldn’t install it unless you pay the owners for licensing rights.

Playing MP3 Files in Fedora 8 using Gnome

To play MP3 files in Fedora 8 you need to add software to your default installation:

  1. First, add Livna sources using rpm
    rpm -ivh http://rpm.livna.org/livna-release-8.rpm
  2. Next, Install Rhythmbox (assuming you are using Gnome) using yum
    yum install rhythmbox
  3. Next, Install gstreamer-plugins-ugly** using yum
    yum install gstreamer-plugins-ugly
  4. That is it, next launch Rythmbox and hello music!
    Rythmbox Launch

    Q: Hey Chris, why does the gstreamer-plugins end in “-ugly”
    A: Good question, tough answer, the GStreamer is a streaming media library which contains plug-ins which cannot be shipped in gstreamer-plugins-good because the license is not LGPL. Please note the the license of the entire library is not LGPL! So of course you shouldn’t install it unless you pay the owners for licensing rights.

The Ultimate ‘vi’ Shortcut List

I am in the process of building the ultimate ‘vi’ shortcut list:

  • Remove Every Other Line:
    :g/.*/norm jdd

rpmdb: Lock table is out of available locker entries

If while using ‘yum’ or ‘rpm’ you receive the following error:

rpmdb: Lock table is out of available locker entries

Your RPM dB files are screwed up… here is how you unscrew them!

This error tell you the Berkley database files which RPM uses are damaged and in order to clear the error you must rebuild the Berkley dB files from scratch.

Here is how you fix this error:

  1. Make a backup of your current files
  2. Remove the damaged files
  3. Rebuild your RPM Berkley dB files
  4. Use yum again

Here is the command walk through:

  1. As root, execute this:
    cd /root; tar cvzf rpm-backup.tar.gz /var/lib/rpm
  2. Remove the Berkeley dB files which yum and rpm use:
    rm /var/lib/rpm/__db.00*
  3. Instruct rpm to rebuild the databases files:
    rpm --rebuilddb
  4. Test your yum command again:
    yum install somepackage