WTF Does a Sys Admin Even Do?

I'm here to answer that for you…

I ran into a minor issue when trying to compile rtorrent from source to include support for xmlrpc (to use with wtorrent). After compiling xmlrpc and libtorrent fine, rtorrent refused to find the libtorrent libraries. Running:

[code]export PKG_CONFIG_PATH=/usr/lib/pkgconfig[/code]

on the command line before ‘./configure –with-xmlrpc-c’ fixed the issue for me. I was now able to finish compiling rtorrent and set up wtorrent.

Ran into an issue today when trying to do the “noob upgrade” on a WordPress 2.8.6 MU installation. The site refused to upgrade (it worked before), just spitting out “Installation Failed” right after I hit the upgrade button.

No idea why it decided to stop working. I came across numerous postings on the Wordpress forums, but nothing really solid that worked. Finally saw something that had to do with having the actual wordpress files in the root directory of the web server. So I decided to just create a new folder, make it owned by the wordpress user (who is also the ftp server and is chrooted to that directory), and moving the entire wordpress install into the folder. Then I changed the web server root in the config file to reflect the new folder that I made that now contains wordpress, and tried the upgrade again. Well for some odd reason (maybe to do with permissions on the /var/www/html directory?) it worked now. So problem solved. If you have issues upgrading automatically, then move the entire wordpress install one directory down from the main root, but change that directory to the new root. Yeah pretty confusing I know.

I spent a lot of time trying to get the DRAC KVM console to actually work on Linux (Fedora 12 64-bit). I first tried with Fedora’s default Java install, IcedTea, but that didn’t work. IcedTea is Red Hat’s answer to being able to package some sort of Java implementation with the free Linux distributions that is not encumbered by any software patents. Its basically an OpenJDK/GNU Classpath hybrid. Red Hat needed this to use with their JBoss application server and not have to worry about infringing on any software patents.

Anyway, I couldn’t get IcedTea to work with the DRAC console. I tried to install Sun’s Java JRE, but that refused to work too. So, I gave up for a while, and just started to use the console in a Windows VM. Then a coworker told me that it does work with Sun’s Java on Linux, but he mentioned that he installed the full JDK. Well I installed it, and the DRAC console is working great in Linux now. Scratch one more thing off the list that I need Windows for. Next I just need a way to run the VMWare VSphere client in Linux…

Here are the steps that I took to get Sun’s JDK working in conjunction with IcedTea. I left it so I have the choice to switch between the two:

First, download the full JDK from here: http://java.sun.com/javase/downloads/index.jsp

Select the RPM package download.
As root or using sudo, execute the .bin file with sh (The version I downloaded was 6 update 18 for 64-bit):

[root@localhost Downloads]# sh jdk-6u18-linux-x64-rpm.bin

Agree to the License by pressing the space bar several times. The RPM will now be installed.
Install the real Java as a choice with the alternatives command:

[root@localhost Downloads]# alternatives --install /usr/bin/java java /usr/java/default/bin/java 20000

This allows you to switch back and forth between the IcedTea Java and the JDK Java.
For the Firefox plugin, install it with:

[root@localhost Downloads]# alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so \
libjavaplugin.so.x86_64 /usr/java/default/lib/amd64/libnpjp2.so 20000

Now you can select either one with:

[root@localhost Downloads]# alternatives --config java

or

[root@localhost Downloads]# alternatives --config libjavaplugin.so.x86_64

The DRAC console actually uses the Java WebStart (javaws). After you login to the DRAC, select the console tab, and then click “Lauch Viewer.” When the download box pops up, navigate to the java directory (/usr/java/default/bin) and select the javaws binary. The DRAC KVM should launch without issue :)

I got tasked with creating some way to easily extract info from a CSV file that Thawte gives you that contains the status of all your certificates with them. Since I’m in the process of slowly learning BASH and PHP, I decided that I’ll try it in BASH first. Just be aware that I am definitely an amature when it comes to scripting, so I’m sure there is a better and more efficient way to do this. I’m mostly rehashing all this to help me learn the flow of scripts.

I needed the output to be presented in a format for our company wiki, Confluence. So if you just need some basic output, then you can remove the weird pipes in the final echos. First, the script sets the internal field separator (IFS) to a comma for a CSV file. The CSV that thawte gives you has 6 fields–a number, the server name (in all caps), a blank column, what the cert is for and the length its valid, when it expires, and what its status is (expired, expires soon, valid). Then it does a while loop and sets a name to each column. In the loop, it sets the date to Unix time (for easy sorting later), converts the uppercase host names to lowercase (for the dig command to find the IP), skips the ones that are expired, runs a dig command on the new lowercase names, and then echos the date, host, ip, and status of the certs. Then the output is sorted by the Unix time stamp.

Then since every entry is on its own line, I set the new IFS to a return value. Now a for loop is run on the lines separated by the IFS and cut into sections. The fist is cut into its own, and converted back to a human-friendly date. then everything else is cut up and echoed and separated by pipes in order to be set up into a table for Confluence.

Here is what I ended up with:

#!/bin/bash
OFS=$IFS
IFS=','
#1,X.EXAMPLE.COM,,SSL Web Server certificate-1Year,07-Nov-09,Expired
OUTPUT=$(
while read NUMBER HOST BLANK TYPE DATE STATUS;
do
DATE=`echo $DATE | date -d $DATE +%s`
HOST=`echo $HOST | tr '[:upper:]' '[:lower:]'`
[ "$STATUS" = "Expired" ] && continue
IP=`dig +short $HOST | head -1`
echo "$DATE $HOST $IP $STATUS"
done )
SORTED=$(echo $OUTPUT | sort)
IFS='
'
##Output in Confluence format
echo "{table-plus:width=400}"
echo "||Expiration||Name||Ip||Active||Note||Code||"
###Break sections down in order to convert date back to human-readable format
for line in $SORTED
do
SECOND=`echo -n $line | cut -d' ' -f1`
DATE=`date -ud @$SECOND +%D`
HOST=`echo $line | cut -d' ' -f2`
IP=`echo $line | cut -d' ' -f3`
STATUS=`echo $line | cut -d' ' -f4,5,6`
echo "|$DATE|$HOST|$IP|$STATUS| | |"
done
echo "{table-plus}"

SSH Break Command!!

No comments

Damn I’ve been trying to figure this out for so long. Here is an example. I was working on a VM (KVM) through ssh. I was ssh’d though the host machine (not good, I know). I changed the VM xml file, so I wanted to shutdown the VM, redefine the xml file, and then start it back up. But when I shutdown the VM, I didn’t exit the session right away, and it didn’t kick me out, it just froze. I was unable to get back to the host VM session. Here is the command to kill the frozen SSH session:

[ENTER] ~ .

That is the Enter key, the tilde (Shift+`) and a peroid (.), all right after each other. Why it took so long to figure it out, I don’t know…

Note: this was done on a 32-bit install. I’ll update later if this works on 64-bit.

After dealing with dependency hell for compiling xmlrpc, libtorrent, and rtorrent, I decided to let everyone know what packages are actually required to do this. All these can be installed with yum:

libcurl-devel-7.19.4-9.fc11
libidn-devel-1.9-4
ncurses-devel-5.7-2.20090207.fc11
gcc-c++-4.4.0-4
libstdc++-devel-4.4.0-4
openssl-devel-0.9.8k-5.fc11
krb5-devel-1.6.3-20.fc11
zlib-devel-1.2.3-22.fc11
libsepol-devel-2.0.36-1.fc11
libselinux-devel-2.0.80-1.fc11
keyutils-libs-devel-1.2-5.fc11
e2fsprogs-devel-1.41.4-10.fc11
device-mapper-libs-1.02.33-2.fc11
device-mapper-devel-1.02.33-2.fc11
device-mapper-1.02.33-2.fc11
openssl-0.9.8k-5.fc11
libtool-2.2.6-11.fc11
automake-1.11-2.fc11
autoconf-2.63-2.fc11
subversion-1.6.1-5.fc11
perl-URI-1.37-2.fc11
libsigc++20-2.2.2-3.fc11
libsigc++20-devel-2.2.2-3.fc11
libedit-2.11-3.20080712cvs.fc11
ncurses-5.7-2.20090207.fc11

To make it easier, install all the packages like this:

yum install libcurl-devel libidn-devel ncurses-devel ncurses gcc-c++ openssl openssl-devel krb5-devel zlib-devel libsepol-devel keyutils-libs-devel e2fsprogs-devel device-mapper-libs device-mapper-devel device-mapper libtool automake autoconf subversion perl-URI libsigc++20 libsigc++20-devel libedit

I think that’s all of them ;)

Oh, and make sure you compile xmlrpc-c with the options “--prefix=/usr --disable-cplusplus” (without the quotes). Then follow the normal configure/make/make install.

I found a lot of info in this post on the Fedora Forums: http://forums.fedoraforum.org/showthread.php?t=214399

Recently I decided to attempt to compile rtorrent because I needed XML-RPC support, and the rtorrent/libtorrent packages in the Fedora repositories aren’t set up like that. I needed the XML-RPC in order to use wtorrent, an rtorrent front-end. I didn’t realize that I would need so many miscilaneous packages in order to compile libtorrent and rtorrent, so at first I didn’t record which packages I installed with yum. I then thought about it and decided that it would be beneficial to have a list of all the packages required if I needed to do this again. I will do a basic write-up of using wtorrent/rtorrent/libtorrent/xml-rpc on fedora 11 in another post. I found a way to query all the RPMs according to their install date.

There are 4 different “install” tags that you can use while looking up the packages in the RPM database (there is one right?):
INSTALLCOLOR, INSTALLTID, and INSTALLTIME

These are found with
'rpm --querytags | grep -i install' .

To find a list of the last 20 RPMs installed, just issue this command:

rpm -qa --queryformat '%{installtime} (%{installtime:date}) %{name}\n' | sort -n | tail -20

Worked perfectly for me, and now I have a list of all the packages I needed in order to compile rtorrent/wtorrent on top of the base Fedora 11 install.

Edit: There is an easier command to type:
rpm -qa --last | less
which does the same thing. doh.

There seems to be an issue with the Fedora 11 Installer.

I’m using an ASRock A780GMH/128M motherboard.

I usually only install Linux through the network using PXE booting because its much faster than doing an install off of a CD/DVD.

For some reason, right when the initial boot images are copied over the network and it tries to grab an IP address, the installer crashes. It looks to be an issue with the NetworkManager version on the initial IP configuration.

I was able to get around this by installing an extra NIC in the computer without a network cable hooked up to it. When the installer asks which NIC to use, select the one that’s not connected to the switch. It will try twice to grab an IP, then it will move on. Then I selected NFS as the install type and it asked me again which interface to use. This time I selected the one hooked up to the network, and it grabbed an IP fine without crashing the install. The rest of the install went smoothly (and quickly thanks to the network install :) ) I have done this same procedure on two different computers (both separate installations of F11).

I will file a bug report later…

No comments

Harry Kalas commentating on Lidge\'s Final K in Game 5

A sad day for sports fans everywhere. Harry Kalas died today. I have been listening to him since the first time I watched a Phillies game. I’m glad he got to see the Phil’s win another World Series. Listening to him call the final strikeout of Game 5 in 08 World Series was amazing. RIP Harry, you will be missed…