2011
12.16

After upgrading my new server from Lenny to Squeeze, I noticed that the iWeb default install on this machine had the swap partition on a mirror.  Not that I expect this machine to be doing much swapping, but I figured I should fix it anyways.  To destroy the array and make those partitions “plain” swap partitions, follow these steps:

### find out which array is the swap partition and see who the members are
cat /etc/fstab
cat /proc/mdstat
### fstab told us md1 is the swap partition and xvda5 and xvdb5 are the member partitions in that array
### stop the array and delete the superblocks.  without zeroing the superblocks the array will still be auto-assembled at boot and we'll get no swap
mdadm --stop /dev/md1
mdadm --zero-superblock /dev/xvda5
mdadm --zero-superblock /dev/xvdb5
### use fdisk to change the partition types for xvda5 and xvdb5 to "82  Linux swap / Solaris"
fdisk /dev/xvda #(t, 5, 82, w)
fdisk /dev/xvdb #(t, 5, 82, w)
mkswap /dev/xvda5
mkswap /dev/xvdb5
swapon /dev/xvdb5
swapon /dev/xvda5
### take the reference to /dev/md1 out of mdadm.conf (1 less error message at boot)
vi /etc/mdadm/mdadm.conf
### modify fstab - change the reference to /dev/md1 to /dev/xvda5, then add another line for /dev/xvdb5
vi /etc/fstab
### reboot if you want to make sure it's all happy at boot time
reboot

I mainly wanted to do this so that if the swap space is ever actually being used, the system won’t have to mirror every write to the other drive.  I’ve also read that linux is smart enough to distribute writes to swap space between partitions if more than one are available, which makes sense to me but I’d have to confirm that rumor.  This change will potentially cut down on a bunch of CPU usage and IO at some point in the future, and a side benefit to doing this is that we have increased the amount of swap space from 2GB on this system to 4GB.

Still don’t want to ever use it though…  ;)

2011
12.15

iWeb currently only offers Debian Lenny as a pre-install option on these servers, but since Lenny is dead as of February 2012 I wanted to start with Squeeze.  I tried the upgrade process from the debian.org site linked below first, but my server didn’t reboot properly after the GRUB2 install and I couldn’t even connect to the VNC console of my VM.  Since the hardware is about a bazillion miles away I don’t know if there’s anything I could have done from the console to fix grub and rescue the install; my only option was the auto re-image in the iWeb control panel.  I re-imaged the server with Lenny and while that was happening I did a bunch of reading about other people having fun with the new grub.

This is just a quick step-by-step.  Basically the standard instructions break grub-pc (GRUB2) on this Xen-based system.  Follow along until the end, then remove grub-pc and re-install grub-legacy.  Your system will then be ready to go!

All of this information is here: http://www.debian.org/releases/stable/amd64/release-notes/ch-upgrading.en.html but this page is far less reading.

Also, if your system is not a “stock” Lenny install, i.e. with 3rd party deb sources and a bunch of custom stuff, your mileage may vary.  I did this to a fresh, new server before anything else.

apt-get purge splashy
apt-get update
apt-get upgrade
vi /etc/apt/sources.list
### Change all references of "lenny" to "squeeze"
apt-get update
apt-get upgrade
uname -r
### Need to find our architecture which turns out to be "xen-amd64"
apt-get install linux-image-2.6-xen-amd64
apt-get install udev
reboot
apt-get dist-upgrade
### When asked if you want to chainload GRUB2, say "NO"*
apt-get install grub-legacy
update-grub
apt-get autoremove
reboot
### enjoy Debian Squeeze!

*Answering “NO” here tells the installation script to just go ahead and fully install GRUB2 and not mess with the legacy grub .conf file and fart around with chainloading and stuff.  I just felt better uninstalling a “complete” GRUB2 install rather than a half-assed hodge-podge of grubbery.

2011
07.29

OK, so I still have about 200MB of free space on the on-board flash in my Sheevaplug, but there would be much less shuffling things around and cleaning of things like the apt cache if there was a bigger flash chip in there. And it would be cool to have room for X and Gnome and Apache and MySQL and a bunch of junk, just like a real computer.

You’d think I could find one (a Hynix H27UAG8T2B that is) on eBay or something… or find someone to send me a sample even. Maybe Hynix just developed the 16Gb version and didn’t actually manufacture any… who knows.

Anyways, I thought I’d post some scans of the Sheevaplug motherboard anyways, since I couldn’t seem to find any good ones anywhere and had to crack mine open to see what kind of chip I was going to need.

2011
07.14

If you install phpMyAdmin on your web host and all you see when you access www.yoursite.com/phpmyadmin (or whatever) is “Wrong permissions on configuration file, should not be world writable!” you are supposed to just change the permissions of /phpmyadmin/config.inc.php to not be world writable (i.e. chmod 755 config.inc.php, or by using your FTP client).

Some hosts (Primus for one) do not let you change the permissions on your files, so there is no way to set this up properly.  But if you are in a hurry and need to back up a database so you can get the site migrated to a decent web host, you can still get phpMyAdmin to run.

Edit /phpmyadmin/libraries/Config.class.php (yes, there is a capital “C” on this file name for some reason), and comment out the line that checks the permissions.  (Line 390 in the source code for phpMyAdmin version 3.4.3.1-english.)

Change
$this->checkPermissions();
to
//$this->checkPermissions();

and re-upload the file.  Now you should be able to log in, assuming you have setup the proper information in your /phpmyadmin/config.inc.php file in the first place!

In order for it to work, you must also listen to this while you edit your files. Feel free to sing along!

2011
06.01

For some reason, it seems like everything I do is not like what everyone else does… or at least not what the people writing the software I use do.  I started writing this as a how-to for others in this situation, but in the end it turned out to be more of an amusing story.  Maybe someone will find it useful anyways…

The background:

I was building a new linux server for my home office and since I have been having good luck with Debian in the last couple of years, I decide to use it as the OS on this box too. Intending to keep it as simple as possible, I created a basic partitioning scheme on all of the drives (the same scheme I have been using for years now) and run into fatal errors when I get to the installation of grub.

Here’s how I partition the drives:
Partition 1: Primary, 8GB, Linux RAID – going to use RAID1 for the /boot file system
Partition 2: Primary, 20GB, Linux RAID – going to use RAID5 for the / file system
Partition 3: Primary, 1960GB, Linux RAID – going to use RAID5 for the /data file system
Partition 4: Primary, 1GB, Linux Swap
Plus a little bit of slack at the end of the drive.

All of the drives are identical 2TB Western Digital Green SATA Drives.  There are now 7 in the system.

The error:


If you press ALT-F4, you will switch over to the install log console and you will see some mumbo-jumbo about grub not finding anything it can use to live on. I didn’t copy down the error message, but it’s cryptic and scary like any good linux error message should be.

Read More >>

2011
03.16

This is a pretty simple Powershell script that generates a random weekly status report and emails it. I wrote this script because it is important that I produce a weekly status report at my place of employment. The report is graded based on if it was submitted at all and secondly if it was submitted on time. As far as I know nobody actually reads these silly things as the process of checking them is automated. So if the “checker” is automated why shouldn’t the “reporter” be automated? The script is executed via a Scheduled Task.

Here is the script.

#
# Cobbled together by Don
#
# Lazy weekly reports
#

# Set the possible weekly activities
$wrkItems = @("Activity 1",
"Activity 2",
"Activity 3",
"Activity 4",
"Activity 5",
"Activity 6",
"Activity 7",
"Activity 8",
"Activity 9",
"Activity 10",
"Activity 11",
"Activity 12"
)

# Create the email body using three random elements
$outData = "My activities for the week may include but are not limited to:`n`n"
foreach ($ele in get-random -input 0,1,2,3,4,5,6,7,8,9,10,11 -count 3) {
$outData += " - "
$outData += $wrkItems[$ele]
$outData += "`n"
}

# Email the weekly report to the appropriate email address
$SMTPserver = "mail.yours.com"
$from = "don@nowhere.com"
$to = "WeeklyReports@nowhere.com"
$subject = "Don's Weekly Status Report"
$emailbody = $outData
$mailer = new-object Net.Mail.SMTPclient($SMTPserver)
$msg = new-object Net.Mail.MailMessage($from, $to, $subject, $emailbody)
$msg.IsBodyHTML = $false
$mailer.send($msg)