Recovering from a dd_rhelp add_chunk error

If you've got a crashed disk, dd_rhelp is a very
useful tool for quickly recovering a large amount of data from just
about any failed disk. I used it earlier this week to help recover a
160GB linux LVM group member drive. Unfortunately, after a while of
running, it hit this error:

    dd_rhelp: error: add_chunk : invalid argument '0-(info)' (is not correctly formatted as number:number)

Here's
how you get past that. The problem is that dd_rhelp was not able to
determine the size of your hard disk automatically, so it is scanning
beyond the actual size, which of course fails. We need to tell it our
disk size manually.

First, make a backup of your logfile, for example:
    cp -rp sdb.log sdb.log.bad-eof
That way you can start over if you mess up.

Go to the first line in the original log file that states:
    dd_rescue: (warning): /dev/sda (282662620.0k): No space left on device!
Or something similar. Scroll up to the next line before that that reads:
    === COMPUTED VERSION OF LOG :
Delete all lines including and following this line, then save your file.

Obtain your filesystem size with fdisk:
    # fdisk -l /dev/sda
   
    Disk /dev/sda: 160.0 GB, 160000000000 bytes
    and so on...

In this case, your filesystem size would be 160000000000 bytes, or 160000000  kbytes.

Next,
change all the lines in the file stating "eof:nothing" to
"eof:160000000". Use your fs size in replacement of 160000000 kbytes.
You can quickly do this using sed:
    sed 's/eof:nothing/eof:160000000/g' -i sdb.log

Now re-run your dd_rhelp command. It should now continue to recover as normal!

Thanks to Valentin from dd_rhelp and "Master One" for leading me in the right direction.

UPDATE:
It seems that after a short time, I ran into the same error again. My
solution was to open the dd_rhelp script, look for the line that says:
    eof="nothing"
and change it to
    eof="160000000"
(of course, substituting your disk size in kb)

Re-do the cleanup above and re-run.

UPDATE 2: So I've found that dd_rhelp is slow, or at least, it's slow on my damaged disk. I suggest trying ddrescue instead (not to be confused with dd_rescue from above). It seems to be much more efficient at sidestepping bad data and gives a more concicse summary of recovery progress. This includes how much data has been recovered so far, lost so far, number of total errors, and transfer rates. For more info on the design differences between ddrescue and dd_rhelp, see the SpinRite wikipedia entry.

Enabling AVCHD MTS/M2T/M2TS Video File Thumbnails in Explorer

Assuming you have a codec installed that allows you to view AVCHD files in Windows Media Player (such as CoreAVC), here's how you can get those videos' thumbnails into the Explorer thumbnail view. I wholly admit I stole this info from some forum somewhere, but most of my searches turned up some lamer's warning about using regedit, and a refusal to post the fix because of it. So I'm going to post it again in a concise article.

Don't freak out. Regedit isn't that damaging. In fact in the 12+ years I've been working with Windows, I don't think I've ever seen a computer explode due to a change in regedit, especially when you follow directions.

Anyhow, open Notepad and copy in the following:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.mts\ShellEx\{BB2E617C-0920-11D1-9A0B-00C04FC2D6C1}]
@="{c5a40261-cd64-4ccf-84cb-c394da41d590}"

[HKEY_CLASSES_ROOT\.m2t\ShellEx\{BB2E617C-0920-11D1-9A0B-00C04FC2D6C1}]
@="{c5a40261-cd64-4ccf-84cb-c394da41d590}"

[HKEY_CLASSES_ROOT\.m2ts\ShellEx\{BB2E617C-0920-11D1-9A0B-00C04FC2D6C1}]
@="{c5a40261-cd64-4ccf-84cb-c394da41d590}"

Save this as "AVCHD Thumbnails.reg" and run it. Accept the merge. You may or may not need to reboot to apply the change. Hit F5 in your Explorer window to check.

Enabling Input Audio Monitoring on Dell Latitude D820

I recently re-installed XP on my Dell Latitude
D820 for the third time in 2 years and ran into a familiar problem: My
line-in audio was not being played through the speakers. By default,
the Dell driver, R171789 (SIGMATEL STAC 92XX C-Major HD Audio) does not
come with the input monitor enabled. You can modify the driver INI
file(s) manually to enable this and other related options.

Backup these files (make a copy in the same directory named 92XXM2-2.INI.orig):
    C:\DELL\drivers\R171789\WDM\92XXM2-2.INI
    C:\Program Files\SigmaTel\C-Major Audio\WDM\92XXM2-2.INI
    C:\Program Files\SigmaTel\C-Major Audio\DellXPM_5515v131\WDM\92XXM2-2.INI

Edit each one and change the following settings to reflect what is shown:
    EnableInputMonitor    = hex: 1
    DigitalInputMonitor     = hex: 1
Additionally you can/should turn on these options that allow for greater control of the sound card options:
    To see all of the config tabs (that I know of):
       Config_Tab = dword: 0x000000ff
    To see all of the Advanced config options:
       Config_Adv = dword: 0x000fffff
    To allow sample rate adjustment:
       Config_Rates = dword: 0x000000ff
    To disable automatic input switching (helps avoid feedback)
       RecordPriority = dword: 0xffffffff
   

Here is a copy of my edited 92XXM2-2.INI
file (enables the Levels tab and Automatic Input selection
en/disabling). Alternately, if you are so-inclined, you could open
regedit and
alter these settings manually. However when you do so, the changes get
wiped out by a re-install of the driver, so altering the INI file is
really your best bet.

You
can now uninstall the device you have in device manager and re-install.
Reboot to ensure you apply the change to the Sigmatel chipset.

After
rebooting, plug in your device. A pop-up should prompt you for the
input type. You may choose to tell it to no longer prompt you for this
change. Then, go into the Volume Control, uncheck mute on Input
Monitor,
got to Options, Properties, select Line-in and you should hear your
input. Also, you may choose to drop the volume on the Internal Mic down
to 0%. This will help you avoid horrible feedback should you switch to
the internal mic.

If
you don't have a D820, it possible that your INI file may be different.
To identify what the proper INI file is,  open regedit and search for
this string:
    SigmaTel High Definition Audio CODEC
Look for
the key named "DriverDesc". In this folder/tree you should also see
"IniPath". Open this key and look at the name of the INI file in the
path. This should be the correct INI for your model.

UPDATE 2/11:
If you feel inclined to do so you can change, with a decent amount of
granularity, which options you can see in the Advanced tab. This is
done by flipping individual bits on or off in the Config_Adv registry
setting. Here are the applicable decimal values for each option:

1 Power Management Amplifier Power Mangement
2 Sampling Rate Sampling Rate adjustment
4 SPDIF AC3/PCM en/disable and Rate Adjustment
8 SPDIF Digital Out en/disable and Rate Adjustment

16

SPDIF

Digital Out en/disable 

32

Dolby

Dolby Digital Live en/disable 

64

Noise Suppression

Noise Suppression en/disable 

128

ASIO

Latency/Rate adjustment, ASIO monitor en/disable 

256

Pop-ups

Jack reconfiguration pop-up en/disable

512

HDMI

HDMI output en/disable 

1024

Bass Management

Bass Routing and boost dB adjustment 

2048

Microphone Selection

Automatic Microphone Selection en/disable 

4096

Internal Speakers

Internal Speaker Muting options 

8192

Headphone Configuration

Redirected headphone en/disable 

16384

(Unknown)

 

32768

Multi-Streaming

Multi-stream retasking en/disable 

65536

Speaker Mute Controls

Additional internal speaker muting options 

To enable or disable any of these options, just add or subtract it's
decimal value (shown) from the decimal value you see in regedit (when
the decimal radio is selected). For example, to display configuration
options for Pop-ups, Microphone Selection, and Noise Suppression, just
add 256+2048+64. This gives you 2368, which you can paste into regedit
when you select the decimal radio. This will convert to 940 in hex.

I Have No Party

It's sad really. Fred Thompson, the only true Conservative in the race for the Republican nomination, dropped out of the race earlier this week. After hearing the news, my thoughts shifted to "Who would I vote for now?". My first priority when wielding my vote is protecting the unborn. Guess what: none of the other candidates are truely pro-life. I'm sick with disgust over the condition of the Republican party. They've abandoned their base to woo Liberals who will never vote for Democrat Lite when they have two fine, full-on Democrats of thier own: Obama and Hillary.

So I've come to a conclusion: I have no party. I belong to the nonexistent, yet to be established, Conservative party. I'm done with the Republican party as a whole. If they have any good non-Presidential candidates running, I'll vote for them, but I'm not voting Republican. Not until they get their act together.

I may not vote for President in the 2008 election. I'm that disgusted. In fact, I'm considering voting for Obama just to let him get in office and complete another Carter-esqe presidency. After he's screwed the country up, hopefuly the American people will wake up, the Republican party will wake up, and we'll finally get another Reagan back in office to fix this whole Federalism problem.

And yes: That means you can just forget about calling me asking for donations too.

Creating a Hylafax Dropbox (No Email)

The default setup for Hylafax is to drop faxes into an email and send them off to the "FaxMaster". This weekend I needed to stop hylafax from doing that, and instead just drop it into a folder. Best I can tell after a few hours of searching Google and perusing code, hylafax on it's own does not do this. There appears to be no options for it in faxrcvd.

So instead of searching any longer, I decided to write my own, very simple, yet perfectly funtional faxrcvd script. All it does is take the received TIFF image and converts it to PDF (the preference of my users), and drops it into a specified folder. Here's the code, feel free to use it:

# Make a backup of the original fax received script (faxrcvd emails faxes).
cp -p /var/spool/hylafax/bin/faxrcvd /var/spool/hylafax/bin/faxrcvd.orig

EDIT: I received a message the other day saying that my script didn't work. It's possible some of the code got messed up by Nuke, so I'm just suggesting downloading instead...

# Download the MuchTall faxrcvd code in replacement of the existing code
wget -O - /"content/faxrcvd > /var/spool/hylafax/bin/faxrcvd

# Edit it with your favorite editor to change the path and permissions
vi /var/spool/hylafax/bin/faxrcvd
    OR
nano -N /var/spool/hylafax/bin/faxrcvd

Change the path and permissions (chmod) to what you want. In my case, I needed to allow all my users R/W access to these faxes.

There you go! Assuming you already have configured hylafax, you should be all set!

Greasemonkey: 2001 Chevy Impala - Hard Start

Seems like I run into enough car problems that I should start logging my experiences with them. Thus, I'll be creating a new section titled "Greasemonkey" with all of my mechanical-repair escapades.

To kick it off, let me tell the story of my wife's 2001 Chevy Impala recent repair. About 2 months ago it started losing power. Initially it would only show up when using a good deal of throttle, such as when passing or accelerating from a stop. It would never die, but it would sound like it was gasping for air, and huffing in effort. Initially, I thought that the the plugs hadn't been changed since the car was purchased, and the car now had just under 100K miles on it. So I went out and got new plugs and wires. No change. Then I figured that it wasn't getting enough fuel, so I replaced the fuel filter. At this point I gave up and brought it into the local auto shop. Diagnosis: Plugged catalytic converter. Fortunately it was covered by something like a 100K mile recall. After replacing that, the car was back in shape.

Fast forward about 2 weeks. The car start having problems starting. It turns, but doesn't fire off until about 5 seconds into it. After it has been started, you can shut it off and start it right back up again with no problem. This past week it started dying while driving down the road. You could start it right back up in neutral. We just started parking the car in a garage and had noticed after the car had been sitting in there for about 10 minutes, the garage was filled with a gasoline odor. However, there were no evident puddles of gas. I initially suspected a failing fuel pump, but the fuel smell was nagging me. So today, after driving it home, I popped the hood. Low and behold the vacuum tube near the fuel regulator has a wet appearance. I pulled the tube coming from the regulator, and gas started dripping out. I hopped online, did a search for "2001 Impala fuel regulator" and didn't find much, but about 2 pages into my search I see this link on a different vehicle: GMC Repair: 1999 GMC Sierra 1500 5.3L. Still, a GM vehicle, and similar year, but a different vehicle. However, the symptoms are identical. So I run down to the local Checker Auto, grab a new fuel regulator and some spring retainer clip pliers. Here's what I did: Remove the rubber tubing connector from the regulator. Be sure to drain the pressure from the fuel line. Place some towels around the Schraeder valve and press the pin. Fuel will spray, so be careful. Next, compress the retaining ring with the pliers, being careful to make sure the ring doesn't spring off and get lost. Finally, pull the top of the regulator off, and remove the screen and rubber gasket if they remain inside. Take the new regulator and push it in place. Replace the clip, tubes, and cap to the valve.

Now, just start it up! In my case it started immediately. However, it's possible you could have some air in the lines, so just let it turn a bit if it does not. Turn the car off and let it rest for about an hour, then try it again. In my case, it worked like a charm.

Good luck and have fun!

100% / High CPU usage by udev and/or nscd

At work we had an FC3 system that had apparently undergone an abrupt reboot or power outage. After it came back up, the CPU usage was at 100%, so bad that I could not run top. Stopping httpd and nscd seemed to help make the system responsive, though udev kept working hard.

Deleting /var/run/nscd and /var/db/nscd, then rebooting seemed to help. Oddly enough, I restarted nscd after removing these files, and that seemed to have no effect. It wasn't until I rebooted that everything seemed to go back to normal.

Weird. Just wanted to throw that out to anyone out there having the same problem. Just delete your nscd DB files or folders and re-create the folders if necessary (Fedora's nscd init script does this automatically), then reboot.

Fred Thompson on Federalism

Everyone needs to understand Federalism for the sake of this country, and Fred Thompson's got a great handle on that concept:


Simple HOWTO: Linux Source-Based Routing

At work we had a network that has no internet access, except what we provide via their VPN connection that had been allowed through the firewall. Simple, until a small problem arose where our VPN server, which is not configured for NAT, has it's default gateway set for it's direct connection to the internet, and not the router which serves as default gateway for the rest of the network.

Put simply, we needed to set up a source route on the VPN server that took any packets coming from 192.168.76.0/24 and redirected them to an alternate default gateway of 172.16.1.100 on eth1, instead of the default gateway on eth0.

Here's a quick description on how to do that:

# Create a custom route table
echo 200 remotesite >> /etc/iproute2/rt_tables
# Add your source network
ip rule add from 192.168.76.0/24 table remotesite
# Set the default route
ip route add default via 172.16.1.100 dev eth1 table remotesite
# Flush the route cache to immediately apply the change
ip route flush cache

200 = A table number you come up with (200 is fine, unless you have already created a 200 table)
192.168.76.0/24 = The network from which you want to redirect traffic
172.16.1.100 = The gateway that you wish to send 192.168.76.0/24 traffic to
eth1 = The interface that's local to 172.16.1.100
remotesite = A table name you come up with

Do this and, tada! You've redirected traffic from a specfic network to an alternate network, a.k.a, source-based routing.

Now, before you go, make sure you place these lines (all but the first) in /etc/rc.local to make it persistent across reboots.

Geek Squad: A New Face For An Old Problem

I just got done reading this article on the Geek Squad, written by a former Geek Squad employee.

This story is quite familiar to me, as I used to work as a Best Buy tech. However, I worked for them years before the rise and fall of Geek Squad, back when we were simply known as PC-Install Techs. Back then we had similar pride in our work, and similar reasons for an ailing department.

Initially Best Buy had some great techs, but they started transferring people from the sales floor to the tech bench. I recall being hired as a salesperson, a job I abhorred. I took a tech position 6 months to a year later. I excelled in the position, but not long after, the push for revenue came to our desks. The more PC's we could pump through, the better. Quality work became a thing of the past. I quit soon after, and gave my resignation to my managers, stating that the corporate culture had destroyed a good company.

The Consumerist's account nearly mirrored my own memories. And clearly, Best Buy has a lasting habit of applying bad management to great business models. Geek Squad, on it's own, was apparently a great service. Then Best Buy got ahold of it, applied it's management strategy, and killed the tech bench once again.

Way to go Best Buy, way to go.

Quotes: Fred Thompson for America

"America's government is bringing America down, and the only thing that can change that is a return to the basics"

Finally, I have a candidate in this election that I can get excited about. This guy seems like our best bet for the 2008 election.

Crashes On Windows After PCAnywhere Is Installed

I thought I'd take a note of this just in case it comes in handy to anyone else out there.

A couple of weeks ago I installed PCAnywhere 10 on my laptop and when it asked me to reboot, I declined. The next day, after rebooting my computer, I noticed my resolutions were all messed up. It kept trying to show me aspect ratios that didn't match the LCD screen I have. It would also set my resolution to 800x600, or something similarly weak. Whenever I'd try changing it, the computer would crash, saying something like invalid page fault "Page fault in nonpaged area" with "STOP: 0x00000050". The DLL always listed as being implicated was "awvid5.dll". Upon some Google searching, I realized that PCAnywhere had messed my computer's video drivers up. I proceeded to uninstall PCAnywhere, and after rebooting, got my stable operation back.

Cleaning up A**hole Spam in PHPNuke

When setting up PHPNuke, you really have to remember to turn on captcha checking for registrations first thing in config.php (gfx_chk). If you don't, you'll get pummeled with comment spam in a matter of hours.

If, like me, you messed up and forgot to, you'll have to delete those bogus accounts, and delete the comments. Deleting the comments can be tedious. So instead, run a command from a unix shell to generate some html content that will make your life easier...

mysql -u dbusername -pdbpassword dbname -e 'SELECT tid,sid FROM nuke_comments;' | grep -v tid | awk '{print "<a href=\"http://yourdomain.com/admin.php?op=RemoveComment&tid=" $1 "&sid=" $2 "&ok=1\">http://yourdomain.com/admin.php?op=RemoveComment&tid=" $1 "&sid=" $2 "&ok=1</a>"}'

This will output a bunch of HTML that you can insert into a page. Click on each of those links to delete a comment. Much quicker than searching for them all.

Now, I suppose someone could write a PHP module for Nuke that would automate this. I'm just too lazy to ;-)

Setting up Tiny MCE 2.1.1 with Advanced Editor on PHP-Nuke 7.9

I just got Tiny MCE updated on MuchTall and I just thought I'd pass the update instructions on

1) Download and unpack Tiny MCE from http://tinymce.moxiecode.com/download.php
2) Move the folder /includes/tiny_mce to /includes/tiny_mce.orig
3) Copy the new tinymce/jscripts/tiny_mce folder to /includes/tiny_mce
4) Download this javascript.php.patch patch into /includes/
5) Run "patch -p0 < javascript.php.patch" from within /includes/
6) Open your PHPNuke editor page

That's it! Now you have a rich text editor with advanced editing features right within PHPNuke!

Windows is Bad for Bind Zone Files

A buddy of mine was recently setting up bind on his linux box and had an issue. His zone files wouldn't load without spewing out errors:

Jun 8 10:33:05 server named: hisdomain.com:18: unknown RR type 'host1'
Jun 8 10:33:05 server named: hisdomain.com:19: unknown RR type 'host2'
Jun 8 10:33:05 server named: hisdomain.com:20: unknown RR type 'host3'
Jun 8 10:33:05 server named: hisdomain.com:23: unknown RR type 'host4.hisdomain.com.'
Jun 8 10:33:05 server named: dns_master_load: hisdomain.com:24: isc_lex_gettoken() failed: unexpected end of input
Jun 8 10:33:05 server named: dns_master_load: hisdomain.com:24: unexpected end of input
Jun 8 10:33:05 server named: hisdomain.com: file does not end with newline
Jun 8 10:33:05 server named: zone hisdomain.com/IN: loading from master file hisdomain.com failed: unknown class/type
Jun 8 10:33:05 server named: _default/hisdomain.com/in: unknown class/type

Fun stuff. After messing around with his domain files for about an hour, I realized something. There were all these excessive spaces after each line. So I opened vi and proceeded to remove them all, as well as replacing spaces in the doc where a tab should be. Lo and behold, it loaded fine.

It appears the the root of the problem were those "spaces" at the end of the line. I figure they were probably DOS carriage returns created my some lame windows text editor. Once removed, the file loads fine.

The New Tower Of Babel

Quantum Scoop

After reading the conclusion on this article, I get to wondering if we're spending inordinate amounts of time and money trying to reach an explanation of the universe. It's almost as if we're trying to climb the the heights of God. I'm not saying we shouldn't try to understand nature and the science of things, but I have to wonder when we reach that point where some think they can explain away God.

All in all, I believe that we will never fully understand the universe. There will always be some particle, some blob of energy who's function or even existence will never be fully explained. We will inevitably reach a point where there is no physical way of proving its function or existence, and then what are you left with: something you have to believe, merely on faith.

And at that point what separates Religion from Science? Nothing really.

The Server Blew Up

The past month and a half has been filled with many great days, and a few bad days. One of the bad days was 4/12. My server decided that it's hard drive absolutely had to die a week before my wedding and two-three week honeymoon. I managed to get a bunch of files recovered from the server, but not everything.. I had to re-install the servver and get some people's sites up and limping. Fun stuff.

So after getting my life back on track, catching up with some projects at work, and getting some things straightened up at home, I finally got my own site working. It's not all here, but all the stories and comments should be. I have to see what database tables got lost and re-create them to make sure that the site is at least functional.

I have to say thanks to my new wife, Kaylan, for being patient with me as I geeked out and fixed stuff.

Wedding and Honeymoon pictures coming soon!

- Mr. MuchTall