23 December 2008

JkDefrag HowTo -- the Free Software, amazing MSWindows rejuvenater!

I have come across enough MSWindows machines that run dog-slow that this simple fix will often highly impress the person who was complaining about their Windows system being slow.

Briefly here are the top reasons (IMHO) for a MSWindows slowdown to begin with -- note that NONE of these affect a GNU/Linux system.
  1. Fragmented hard drive -- even if Windows' built-in defragger says the drive is OK, it probably isn't.
  2. Malware -- viruses and the like all use up system resources, slowing you down, changing your browser pages, capturing your keystrokes at the bank websites, and a lot more.
  3. Autostart programs -- do you really need Office Quickstarter? Quicktime to start at login? There are dozens of these auto-starting apps, all using resources unneccessarily. See "Dominant Monkey Theory"
  4. Security Apps -- yep all those firewalls and antivirus programs, which a Windows machine truly should be running, use up resources as well and slow you down.
These are the most common reasons for a Windows slowdown and other issues, but it doesn't cover problems with Bit Rot, with the Windows Registry, and with the many many other issues that Windows can have.

So other than removing the junk with ClamWin, Spybot, AdAware, and HiJackThis, and after stopping a lot of stuff from starting with the Microsoft built-in app 'msconfig', I love giving a good defrag to the system. Here is how.

  1. Download JkDefrag.zip from here. This GPL Free Software application uses the Windows defragment libraries but in a smarter way than the built-in Defrag program does. Unpack (aka 'unzip', if you must) the downloaded JkDefrag.zip on, say, your desktop.
  2. Open a Command Prompt ([Start menu] > Run ... > cmd [enter]).
  3. Use 'cd' to 'change directory' to the place where you unpacked JkDefrag. For example (depending on the folder name),
    cd Desktop\JkDefrag-3.36
  4. At the command prompt, (looks like > symbol on MSWindows), first run
    jkdefrag.exe -a7 c:
    and let JkDefrag run fully until it finished -- note this may take an hour or more. Or less. The '-a7' flag tells JkDefrag to optimize for apps to start faster, by putting all of a programs' files together on the hard drive for faster access. Once that is done, run
    jkdefrag.exe c:
    to just run a regular defragment on your C:\ drive.

See the screenshot for some more information on this, including the steps 1-4, visually. Click it to make it much larger and more readable.



Apache2 SSL errors and a fix

I was getting the following error for a website that I was setting up
Error code: ssl_error_rx_record_too_long

Initially I thought the error was due to having two IP Addresses answering for a single SSL Certificate, but that wasn't it. The fix was to edit the the Apache2 config file and make sure that it has the following info before the Virtual Host directives (substitute your own IP Address(es) but you need the :80 for regular web serving and the :443 for SSL) :
NameVirtualHost 192.168.170.8:80
NameVirtualHost 10.0.0.2:80

NameVirtualHost 192.168.170.8:443
NameVirtualHost 10.0.0.2:443

meaning that both IP Addresses are answering for both ports. Previously I only had this:
NameVirtualHost 192.168.170.8
NameVirtualHost 10.0.0.2

It's also necessary to have the following in the /etc/apache2/ports.conf file (on a Debian system):
Listen 80
Listen 443
I was previously getting these errors when I was checking the apache configuration and this also fixed those errors:

shell~# apache2ctl -t

[error] VirtualHost 10.0.0.2:443 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results

[error] VirtualHost 10.0.0.2:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results

[error] VirtualHost 192.168.170.8:443 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results

[error] VirtualHost 192.168.170.8:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results

Syntax OK

shell~#

All is good now :)

08 December 2008

CUPS failing at startup on Debian Lenny (cupsdmodprobe ??)

A client has a Debian box, running mostly Debian Etch but there is CUPS from Lenny and perhaps some other things as well (the newer CUPS was needed due to a newer printer that needed a newer HPLIP, which itself was a major issue because it wanted to upgrade CUPS and HPLIP's script was hiding the "dpkg --reconfigure" dialog, and and and and it was all a headache, but that was months ago).

So today out of the blue (says the client), CUPS just stopped printing. When trying to manually start the service we got these errors and then CUPSD would just hang:
shell# /etc/init.d/cups start
Starting Common Unix Printing System: cupsdmodprobe: module lp not found.
modprobe: failed to load module lp
modprobe: module ppdev not found.
modprobe: failed to load module ppdev
Looking at dmesg, we see these drivers load with the kernel and shouldn't need to be modprobed:
shell# dmesg |grep lp
lp: driver loaded but no devices found
dmesg |grep ppdev
ppdev: user-space parallel port driver
We commented out the modprobe lines in the startup script /etc/init.d/cups but the hang would still happen. We eventually pinned it down to the file /etc/default/cups which has these lines:
# Cups configure options

# LOAD_LP_MODULE: enable/disable to load "lp" parallel printer driver module
LOAD_LP_MODULE=yes
By changing that last line to "=no" we were able to get CUPS started properly. This only took about two hours to pin down; why doesn't CUPS have a --verbose switch??