Archive for the ‘Linux’ Category.

How to check RAID status on an Intel board

I don’t want to dwell on how many hours I just wasted trying to get the status of an embedded RAID controller on an Intel S3420GP board running openSUSE 11.3. The solution is to avoid the dizzying array of software that Intel offers on their website, and instead use dmraid.

My understanding of this is a little shaky, but first you need to know where the controller is mapped. After some poking around the system, I came across this:

# ls -1 /dev/mapper

I know my array has three partitions so it seemed intuitive that the device was named ddf1_MegaSR___R1__0. I was then able to get the status with:

# dmraid -s ddf1_MegaSR___R1__0
*** Group superset .ddf1_disks
--> Active Subset
name   : ddf1_MegaSR___R1__0
size   : 623046656
stride : 128
type   : mirror
status : ok
subsets: 0
devs   : 2
spares : 0

Unbelievably simple after I had waded through failed attempts at using Intel’s RAID Web Console 2, Intel’s Extensible Firmware Interface (EFI), Intel’s Damn? Platform Control Command Line Interface (DPCCLI), Intel’s Active System Console (IASC), and who knows what else.

Linux had the answer the entire time in a scriptable format. I’d feel bad for all that time I spent, except I’m too excited about finally being able to add this controller to the cronjob that tells me how my RAID arrays are doing every morning.

Solving openSUSE 11.3 mail server problems

Rather than follow an upgrade path, I painstakingly migrated the mail server configuration from an openSUSE 11.0 server to a fresh install on an openSUSE 11.3 server. Here are the problems I ran into and how I solved them:

Problem: “Permission denied” when postfix/lmtp attempted to connect to /var/lib/imap/socket/lmtp

Solution: run vigr to add user postfix to the mail group.

Problem: imap[14973]: IOERROR: opening /var/lib/imap/user_deny.db: No such file or directory

Solution: it’s okay to ignore this.

Problem: imap[10976]: SQUAT failed to open index file
imap[10976]: SQUAT failed

Solution: you can either ignore this or build SQUAT indexes.

Problem: postfix/smtp[21515]: connect to localhost[::1]:10024: Connection refused
amavis[21058]: (21058-12) (!!)WARN: all primary virus scanners failed, considering backups

Solution: the Problems I found and fixed section of this Virus scanning post seemed to have the answer. All I needed to do was uncomment the ClamAV-clamd lines in /etc/amavisd.conf

fdisk problems with large partitions

I recently upgraded my 3ware 9550SX-8LP RAID5 array from 250 GB drives to 1 TB drives. After the lengthy RAID initialization process, I tried to create a partition using fdisk. Unfortunately, fdisk seemed to only create a partition size of about 400 GB instead of the 6+ TB that I expected. For reference:

  • fdisk version: v2.12q
  • OS: SuSE Linux 9.3 (x86-64)
  • kernel:

After searching around for awhile, I came across Linux Creating a Partition Size Larger than 2TB by Vivek Gite. The article recommended using parted; my system had GNU Parted 1.6.21 and it worked just fine. Do remember that you need to mklabel gpt. And now df -h lists the partition at a hearty “6.4 T”.

For some reason I have the urge to do a little jig and sing “Mo’ money, mo’ money, mo’!”

Problems with PHP’s get_browser() on openSUSE 11.2

I just spent way too much time trying to debug PHP’s get_browser() on an openSUSE 11.2 server. All I wanted to do was display a funny little note about what web browser a user was surfing with, as in, “You are using Opera… AWESOME! :-D”, or “You are using Firefox… good :-)”, or even, “You are using IE… that’s sad :-(“.

I had this working just fine on openSUSE 10.3 and openSUSE 11.0, but the 11.2 server was giving me “Default Browser” for any browser I used. I debugged and looked over the configuration/logs again and again, but for some reason it appeared that while get_browser() was seeing the correct php_browscap.ini file, something was going awry.

I finally stopped the debugging process when a Google search landed me on Jonathan Stoppani’s Browscap PHP Project. I made a few minor modifications to my code in order to use his class, and now my browser detection is working great – even on the stubborn openSUSE 11.2 server. Thanks Jonathan!

OS X for the Linux user

About 1.5 years ago, I made the switch from SuSE Linux to a MacBook Pro running OS X 10.5. Here are some brief notes I made regarding the transition:

  • OS X’s Spaces gives you virtual desktop functionality. I don’t think it offers the same depth of customization, but it works just fine for my needs. One feature I like is to left-click and grab a window, then use ctrl-[1-8] to move the window to one of my eight “spaces”. On my Linux system, I had to navigate a menu to accomplish the same thing.
  • The program that I replaced Gaim/Pidgin with is Adium. However, I now see that Pidgin appears to have an OS X client…
  • I miss being able to copy text by highlighting, and paste via the middle mouse button. With OS X you need to do command-c for copy and command-v for paste.
  • Speaking of the command key, it annoys me. I’ve been trained my entire life to use ctrl, but OS X makes you move one or two keys over to use a different key. Which brings me to the next topic…
  • The home and end keys have the obnoxious behavior of jumping you to the top and bottom of a window, as opposed to the start or end of a single line. You can change the behavior in Cocoa apps (more succinct info), but all 3rd party applications (Eclipse, Firefox, etc) seem to require individual adjustment via other means.
  • Not having focus-follows-mouse is incredibly painful; Steve Yeggae agrees.
  • Quick notes on the hardware:
    • Two fingers to scroll, pinch to zoom out, un-pinch to zoom in – I like the multi-touch pad, even though trackballs are typically “how I roll”.
    • The auto-dim/brighten of the display and the backlit keyboard is really cool.
    • The display is gorgeous.
    • The case gets uncomfortably hot for a device that theoretically sits in your lap.
    • The only way to access the alt key is via the fn key.
  • If you have more than one user, do yourself a favor and Preferences -> Accounts -> Login Options -> Show fast user switching menu
  • iTunes is disappointing in that it has no native FLAC or OGG support. Additionally, iTunes servers are apparently “listen-only”; you can’t copy files!

While OS X certainly has a proprietary, somewhat locked-down feel to it, the slick and user-friendly interface more than makes up for it. This is the same reason why I usually run Opera instead of Firefox – I prefer a high-quality computing experience.

Using EDID data in xorg.conf

I have two Hanns-G JW199D (19″ 1440×900) LCDs connected to an nVidia GeForce 8400 GS video card. They worked great until I upgraded from openSUSE 10.3 to 11.0; Xorg seemed to have problems configuring the LCD connected to the video card’s VGA port. The image was cropped and at an odd, fuzzy resolution, but the LCD on the DVI port was fine.

I examined /var/log/Xorg.0.log and found this:

(WW) NVIDIA(GPU-0): Unable to read EDID for display device CRT-0

I was fairly certain that this had always been the case, and that the monitor in question was being configured from the “Monitor” and “Modes” sections. But after fooling around with modeline generators and tweaking xorg.conf, I was unable to create a configuration that would give back my 1440×900 display.

Finally I thought, can’t I just apply the EDID data from the working monitor to the problem monitor?

I fired up nvidia-settings and used that to dump a binary copy of the EDID. Then I grabbed read-edid and ran the parse-edid which conveniently generated a “Monitor” section for me. I integrated this output into xorg.conf and I was back in action!

Software RAID performance on various IDE configurations

I have two 500GB IDE drives that I will use to create a software RAID1 (mirrored) array. How should I connect them to maximize performance?

I’ve used software RAID on my personal file servers for years and ask myself that question every time I make changes. Google has never given me a satisfactory answer, probably because there are so many variables involved that the answer is too system-dependent. Even defining “performance” itself can be a little tricky.

This time I am going to do the work and figure out the best configuration for myself. To start with, here are my system vitals:

  • AMD Athlon XP 1700+, 256MB RAM
  • IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
  • Mass storage controller: Promise Technology, Inc. PDC20268 (Ultra100 TX2) (rev 02)
  • openSUSE 11.1, kernel-pae-
  • RAID1 file system: reiserfs-3.6.19-116.62
  • Two WD5000AAKB HDs (EIDE, 500 GB, 100 MB/s, 16 MB Cache, 7200 RPM)

So here are all the places I could potentially connect the two drives:

IDE slot Abbrev.
Primary master Pri M
Primary slave Pri S
Secondary master Sec M
Secondary slave Sec S
Ultra100 TX2 IDE1 master IDE1 M
Ultra100 TX2 IDE1 slave IDE1 S
Ultra100 TX2 IDE2 master IDE2 M
Ultra100 TX2 IDE2 slave IDE2 S

I used bonnie++ -x 8 -u root and averaged the results to measure performance. I only examined configurations that were interesting to me, excluding “Pri M” because that is the location of the root drive. Here is what I found:

1st HD 2nd HD Write1 (KB/s) Read2 (KB/s) Seeks/s3
IDE1 M IDE1 S 21191 75227 235
IDE1 M IDE2 M 24061 75505 386
IDE1 M Sec M 35582 75802 296
Sec M Sec S 53798 74863 233
Sec M Pri S 75426 75150 396

1 Block Sequential Output (put_block)
2 Block Sequential Input (get_block)
3 Random Seeks (seeks)

The most obvious thing that I glean from this is that writing to the software RAID becomes faster when 1) the drives are on separate channels, and 2) the drives are on the IDE bus instead of the PCI bus. Similarly, random seeks per second improve significantly when the drives are on separate channels. This all makes sense to me – hardware configurations that increase the opportunity for parallel operations are more efficient.

However, there’s one thing I don’t really understand: if the Ultra100 TX2 is capable of the same read performance as the main IDE channels, why is it not capable of the same write performance?

In the end, I think I’ll go with the {Sec M, Sec S} configuration. Here’s why:

  • Although {Sec M, Pri S} offers the best performance, I don’t want to clog up both IDE channels with RAID traffic.
  • Despite this obsessive performance analysis, the server is question is basically just a personal jukebox – I really don’t need screaming speeds.

There. I feel better now.

openSUSE 11.1 > Ubuntu 8.04 server

Ubuntu seems like it’s the latest and greatest in the world of Linux distros, but it just didn’t measure up to openSUSE during my install fest last night. I run openSUSE at work so I figured I would get some variety at home by using Ubuntu on my personal file server. I tried installing Ubuntu 8.04 server twice and finally gave up. My gripes:

  • Don’t ask me questions throughout the installation – ask them all up front and then just do it.
  • No, I don’t want to set a special password for MySQL. I don’t want to do it now, nor the subsequent three times you prompt me at various points during the installation.
  • Freezing the system halfway through installation of GRUB is a dealbreaker, namely because I can’t complete the install.

So with some relief I dropped in my openSUSE disc and the install blew through like a breeze. Surely my comfort level with openSUSE helps, but the SuSE brand has been around a long time; it includes all those little fixes and exception handling that are a part of mature software.

PHP zlib.output_compression fails to set Content-Encoding

This is what the PHP docs say about the zlib.output_compression INI directive:

Whether to transparently compress pages. If this option is set to “On” in php.ini or the Apache configuration, pages are compressed if the browser sends an “Accept-Encoding: gzip” or “deflate” header. “Content-Encoding: gzip” (respectively “deflate”) and “Vary: Accept-Encoding” headers are added to the output. In runtime, it can be set only before sending any output.

Seems pretty straightforward, except that enabling this directive on an openSUSE 10.3 server (and an openSUSE 10.2 server) resulted in a bunch of gibberish as output. Meanwhile, the compression worked just fine on my MacPorts-enhanced MacBook.

After flailing around on Google and php.ini, I eventually eliminated SSL and the firewall as reasons for the problem. During this process I wasted a good amount of time on this bug. Basically, the docs say that you can set zlib.output_compression in your script at runtime, but in reality it doesn’t work.

I finally got down to business with Live HTTP Headers and figured out that enabling zlib compression on my openSUSE servers certainly compressed the content, but did not send the requisite “Content-Encoding: gzip” response header. Sending the header manually within my script (e.g. header("Content-Encoding: gzip");) would correctly turn the gibberish into uncompressed form.

Having already spent hours mucking around with this, I went with a quick and dirty solution:

echo $page->toHtml();

I hunted around Google for this problem, but only found PHP4 references from years ago. Maybe it’s time to ditch openSUSE on my servers… Ubuntu LTS might hit the spot.

I found XMMS again!

These past few years I’ve been frustrated with the media players that modern Linux distros have been pushing. I have my music organized nicely in a familiar directory structure and I usually just want to play an album. I don’t want to import my music, download cover art, do CDDB lookups, or otherwise integrate my audio into some big iTunes clone.

All I want to do is: 1) browse to directory and 2) play music in directory. Yes, the abstractions/features that iTunes clones offer are cool and useful, but I want simplicity on my Linux workstation. I’ve wrestled around with Amarok and Banshee, but generally end up getting annoyed. I don’t know what happened to XMMS, but when reading Linux Journal I saw a screenshot that contained an Audacious window – the look/feel appeared identical to XMMS.

Grabbing Audacious from my package manager, it’s obviously a fork or evolution or whatever from XMMS. Finally, I’m back to my simple music player.

Browse to directory. Play directory.