Spiga

Apache Self Linking error

===========
[11/Mar/2008:16:05:45 -0400] "OPTIONS * HTTP/1.0" 200 - "-" "Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8b mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 (internal dummy connection)"
=========

Fix : Update MaxSpareServers and MinSpareServers

Innodb error: Unable to restart Mysql

Forcing InnoDB Recovery

If there is database page corruption, you may want to dump your tables from the database with SELECT INTO OUTFILE. Usually, most of the data obtained in this way is intact. Even so, the corruption may cause SELECT * FROM tbl_name statements or InnoDB background operations to crash or assert, or even to cause InnoDB roll-forward recovery to crash. However, you can force the InnoDB storage engine to start up while preventing background operations from running, so that you are able to dump your tables. For example, you can add the following line to the [mysqld] section of your option file before restarting the server :

vi /etc/my.cnf
[mysqld]
innodb_force_recovery = 4


The allowable non-zero values for innodb_force_recovery follow. A larger number includes all precautions of smaller numbers. If you are able to dump your tables with an option value of at most 4, then you are relatively safe that only some data on corrupt individual pages is lost. A value of 6 is more drastic because database pages are left in an obsolete state, which in turn may introduce more corruption into B-trees and other database structures.

* 1 (SRV_FORCE_IGNORE_CORRUPT)

Let the server run even if it detects a corrupt page. Try to make SELECT * FROM tbl_name jump over corrupt index records and pages, which helps in dumping tables.
* 2 (SRV_FORCE_NO_BACKGROUND)

Prevent the main thread from running. If a crash would occur during the purge operation, this recovery value prevents it.
* 3 (SRV_FORCE_NO_TRX_UNDO)

Do not run transaction rollbacks after recovery.
* 4 (SRV_FORCE_NO_IBUF_MERGE)

Prevent also insert buffer merge operations. If they would cause a crash, do not do them. Do not calculate table statistics.
* 5 (SRV_FORCE_NO_UNDO_LOG_SCAN)

Do not look at undo logs when starting the database: InnoDB treats even incomplete transactions as committed.
* 6 (SRV_FORCE_NO_LOG_REDO)

Do not do the log roll-forward in connection with recovery.

You can SELECT from tables to dump them, or DROP or CREATE tables even if forced recovery is used. If you know that a given table is causing a crash on rollback, you can drop it. You can also use this to stop a runaway rollback caused by a failing mass import or ALTER TABLE. You can kill the mysqld process and set innodb_force_recovery to 3 to bring the database up without the rollback, then DROP the table that is causing the runaway rollback.

The database must not otherwise be used with any non-zero value of innodb_force_recovery. As a safety measure, InnoDB prevents users from performing INSERT, UPDATE, or DELETE operations when innodb_force_recovery is greater than 0.

Installing Domain Keys on Cpanel

Delivering mail to yahoo and google is so hard those days. Almost every server has had this problem even if it is not used to relay spam.
Installing DomainKeys can help your server deliver “clean” emails directly to your user’s inbox.
What are DomainKeys?
Well you will find more information on this topic at: http://antispam.yahoo.com/domainkeys

Installation is simple and it’s done on a domain basis.

How to install DomainKeys on a specific domain.

1. First check that you are running the latest version on RELEASE or CURRENT of cPanel 11.
2. Run the script

/usr/local/cpanel/bin/domain_keys_installer username

Where username is the cPanel user.

If you get an error similar to “Domain keys are not installed on this machine.” you either are not running the latest release or current version of cPanel or you have not converted yet to maildir. Maildir conversion is required before you install DomainKeys.
You will find an article about converting to maildir on this site !

Ok, we just installed DomainKeys for a domain, but how about if we want to install it for all the domains (users)?
Well I found the solution just a few days ago on a public forum. Someone wrote a nice bash script that will parse all the cpanel users and then run the installation for each of them.

for i in `ls /var/cpanel/users` ;do /usr/local/cpanel/bin/domain_keys_installer $i ;done

Ok, but what about if we want that every new created account to have DomainKeys installed. Well this is a bit harder to do.
I recommend editing /scripts/postwwwacct and adding:

my %OPTS = @ARGV;
my $user = $OPTS{’user’};
/usr/local/cpanel/bin/domain_keys_installer $user

Courtesy: http://www.cpanelconfig.com/cpanel-administration/installing-domainkeys-on-a-cpanel-server/

Common Kernel Panic Errors

Unable to mount root fs and solution The error is common as soon as the compile happens on a new partition and the most common error will be when the grub/lilo configuration is manually edited by the user, it is preferred to keep the settings to the default. If you drive into error then login to the machine using single user mode and have the grub configuration edited such that the drive letter is corresponded, normally adding /dev/hda0 instead of /dev/hda on the LABEL keyword help.

2. No Init found

1. Boot computer. As soon as Grub splash screen comes up, hit up or down arrow key to stop the clock.
2. Press "c" to get the Grub command line like this: grub>
3. Type:
root (
You should get a list of valid drives. If the result fails then assume that the grub does know the details of the root partition.
4. Press the next character corresponding to the drive OR partition where your /boot directory is and then press
5. Repeat step 4 until you have completed the line so it looks like
root (hdx,y)
where x and y are correct drive (x) and partition (y) where your /boot directory is. You should know already that Grub counts drives and partitions starting with zero for the first primary partition and 4 for the first extended partition.
6. If you do not have a separate /boot partition, type:
kernel /boot/vmlin
If you do have a separate /boot partition, do not enter the /boot and instead, just
kernel /vmlin
In either case, when you hit , Grub will complete the filename, or list possible files ONLY if you have correctly entered all other information. If Grub says something like "no files found", go back and correct your error.
7. Repeat step 6 until you have a complete filename but do not press enter yet.
8. Following the kernel filename, on the same line, add ro so the filesystems will be initially mounted read only so that integrity checks may be made without adding corruption, and add information telling Grub where your top level root partition is: / so that the line looks something like this:
kernel /vmlinuz-2.4.22-1.2115.nptl ro root=/dev/hda8
where, instead of "hda8" you have the correct drive and partition where your / partition is. If you make a mistake here, Grub will not complain. Instead, you will get the message saying there was no init found.
8a. If you want to boot in single user mode, without a graphic display, you should add the word single to the end of the line. When the line is complete, press enter.
9. If you do not have a separate /boot partition, type:
Code:

initrd /boot/initrd

If you do have a separate /boot partition, do not enter the /boot and instead, just
Code:

initrd /initrd

In either case, when you hit , Grub will complete the filename, or list possible files ONLY if you have correctly entered all other information. If Grub says something like "no files found", go back and correct your error.
10. Repeat step 9 until you have a complete filename.
11. Press "enter".
12. Finally, if the system doesn't boot automatically, type: boot and press enter.

Kernel Panic's !

To keep it simple. Kernel panic errors are displayed by the server when it finds itself in a irrecoverable error. The error is mostly seen in linux machines and if you were to compile a new kernel for the machine with wrong settings it is that quick to view :).

Most of the unix like systems or linux systems have a seperate panic() routine which will be responsible for displaying the error output on a console and once this is done, it will be dumping the memory of the kernel on to the disk for further check or debugging. In panic states, you can either restart the machine manually or schedule a automatic reboot.

To set a automatic reboot during kernel panic sessions, use the following settings:

vi /etc/sysctl.conf

now hit i then copy paste this line

kernel.panic = 10

this should initiate a reboot in 10 seconds for normal servers.

A common cause for the kernel panic are memory dump error. The kernel may try accessing a memory area that is currently not available. Again, as mentioned, it can either be due to the a faulty hardware or error with the latest update of the operating system.

Causes for Kernel Panics

* With increasing set of applications or clients wherein for webservers, the increase of RAM becomes inevitable. This is the first and foremost cause for Kernel Panics.

* As mentioned earlier, recompile your kernel and expect it to happen. While recompiling the kernel it is common that we may try few available extensions or support modules which may drive back to this situation unless there is through fixing of the necessary dependencies.

* Hard disk failure, this is common one to happen, your disk may develop a bad sector or bad block

* Odd but a common problem, trouble with system file permissions can drive us to the kernel panic situation.

* Insufficient RAM or Harddisk is another common trouble to be viewed.

* Improperly installed software or hardware.

* Defective hardware like a trouble with CPU

* And very rare chance of having a hardware mismatch which shouldn't happen for most of the branded versions available.

Linux Commands : Kernel administration commands

Quick commands on linux administration continued...

Kernel administration command,

LSMOD is used to list the loaded modules on the kernel, the usage is:

$lsmod

Module Size Used by
autofs 11904 1 (autoclean)
3c59x 25568 1 (autoclean)
iptable_filter 2288 0 (autoclean) (unused)
md 59008 0 (unused)
usb-uhci 20912 0 (unused)
usbcore 53200 1 [usb-uhci]


**********************************************************************

MODINFO is the command used to learn about the modules active on the kernel.

usage:
$/sbin/modinfo usb-uhci

filename: /lib/modules/2.4.4-18k/kernel/drivers/usb/usb-uhci.o
description: "USB Universal Host Controller Interface driver"
author: "Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber"

**********************************************************************

INSMOD is the command used to activate or to add in the command to an active kernel. The syntax is :

$insmod msdos

************************************************************************

RMMOD is the command used to remove any modules that you find running on the server. The list of modules can be found using the command lsmod.

$rmmod msdos

************************************************************************

DEPMOD is the command used to create the dependencies list for the modules. Normally the details are fetched from /etc/modules.conf and have the descriptions added up.

The normal usage of the same is : /sbin/depmod -a

There are other options like depmod -A which should perform the quick check on the dependencies.

*************************************************************************

MODPROBE is another important command that helps the users to load the modules and the dependencies for the functioning. If we are to use

modprobe fat

then it should be loading up the fat module along with the supporting modules. Again,

modprobe -r fat

should remove the module fat along with the supporting modules for the fat.

This should provide you with the best removal technique.

*******************************************************************************





more coming...

quick commands : Linux administration - Hardware section

Linux will be having most of the hardware devices created at the start of the system but you can always create new devices using the command:

# /dev/MAKEDEV -v ttyS0
create ttyS0 c 4 64 root:dialout 0660

This will be creating a device /dev/ttyS0 with permissions 0660 and ownership as root and dialout as group.

The kernel will be using the major and minor node numbers for the system and the same indicates that the device so created is a serial device.

*************************************************************************

MKNOD is another command used in creating devices. MKDEV is normally the preferred way of creating devices which do not exist but in rare cases there is a chance that the device files may not be known to the MKDEV command.

For the perfect usage of mknod command you should be aware about the minor and major nodes, the file devices.txt should contain the canonical names and details of the nodes.

So for creating the same node as created using the MAKEDEV command the commands will be :

mknod /dev/ttyS0 c 4 24
chmod 0660 /dev/ttyS0
chown root:dialout /dev/ttyS0

*******************************************************************************

LSPCI command is used to list the number of PCI buses available for the server. It is normally used to diagnose the troubles with PCI buses.

usage: $ lspci -tv

*******************************************************************************

LSDEV command is used for learning the information and status of the virtual I/O Devices. The normal usage is:

lsdev -type disk -fields name status

the various types are :

adapter
Lists adapters
disk
Lists disks
lv
Lists logical volumes and volume groups
optical
Lists optical devices (cdrom/dvdrom)
tape
Lists tape devices
tty
Lists tty devices
ent4sea
Lists all physical Ethernet adapters and Etherchannel adapters available for creating a shared Ethernet adapter
ven4sea
Lists all virtual Ethernet adapters available for creating shared Ethernet adapter
ent4ip
Lists all adapters over which interface can be configured.

To display the parent of a devices, type:

lsdev –dev hdisk0 -parent


************************************************************************************

LSUSB is the command used to list the current connected USB connections on the drive.Normal installations may fail to have this command inbuilt you will need to get the packages updated on the distribution with usbutils to get this working.

usage: lsusb

************************************************************************************

lsraid is the command used for displaying the status of the md devices on the server. The details are as mentioned in the configuration file /etc/raidtab. Again the command is able to distinguish between the online and offline devices and can give out the detailed statistics.

usage : lsraid -A

*************************************************************************************

HDPARM is used to modify or view the statistics of the hard disk. The command allows us to pass on the parameters on to the system and also to modify the current disk parameters like DMA settings, power management, etc..

The options available with hdparm can be dangerous on occasions since the parameters if specified incorrectly can cause trouble.

Turn on DMA for the first hard drive.

hdparm -d1 /dev/hda

Turn off DMA for the first hard drive.

hdparm -d0 /dev/hda

*******************************************************************************



more coming up....