Archive for the ‘Linux’ Category.

mysqlhotcopy cause MySQL server has gone away

As I was performing a backup for a ~5GB database on a new db server, I encounter this error.

DBD::mysql::db do failed: MySQL server has gone away at /usr/bin/mysqlhotcopy line 521.

The above means that the MySQL timeout while doing the mysqlhotcopy, you just need to increase the timeout. If your database is really huge, you will need to adjust the timeout accordingly.

For me, I will just set 15mins.

Append the following lines to /etc/my.cnf under [mysql] section

interactive_timeout = 3600
wait_timeout = 3600

Hope this helps!

Changing Linux Network Interface Bonding

WARNING: The following steps will stop your network interface, please ensure that you have KVM-Over-IP before attempting to do it remotely.

If you ever had to change the bonding type while the server is live, follow the steps:

[db2:/root]# ifdown bond0
[db2:/root]# modprobe -r bonding
[db2:/root]# modprobe bonding mode=1 miimon=100
[db2:/root]# ifup bond0
[db2:/root]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
 
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
 
Slave Interface: eth2
MII Status: up
Link Failure Count: 0
Permanent HW addr: 
 
Slave Interface: eth3
MII Status: up
Link Failure Count: 0
Permanent HW addr:

Hope this helps someone out there.

Locating Dell Service Tag in Linux

Here is a quick command to retrieve Dell Service Tag number remotely.

dmidecode|grep -A 2 "PowerEdge"

Hope this helps…

Detecting Creative Sound Card in Linux

As I am working on a project where I need to play external audio into a application, as you are aware that dealing with audio in Linux can be challenging.

As such, here is a simple solution to it =)

My test environment:
CentOS 5.5 64bit
Creative Blaster S80490 (USB)

yum install -y alsa-utils

Once I installed Advanced Linux Sound Architecture (known as ALSA), I can run the following command to see whether my audio is detected by the system.

[root@localhost src]# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: External [SB Live! 24-bit External], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I got my audio devices detected by the Linux system. So now, I can move on to the next stage of integrating into my applications now. :)

Hope this helps someone out there…

Windows 7 cause “mount: Cannot allocate memory”

Had a friend who want to backup all his files (300GB+) from a Linux server to a laptop harddisk, we hit with a error message that cause Linux unable to mount the shared folder in laptop.

Problem:

[root@localhost ~]# mount -t cifs "//192.168.1.10/abc" -o username=admin,password=1234
ed /mnt/laptop/
mount: Cannot allocate memory

The server has at least 3GB cached RAM available in the memory pool. So that’s not possible with memory issues.

Take a look at dmesg and you should see this error

Oct  3 00:33:18 localhost kernel:  CIFS VFS: Send error in SessSetup = -12
Oct  3 00:33:18 localhost kernel:  CIFS VFS: cifs_mount failed w/return code = -12

If you have the above error, most likely it is due to your Windows 7 machine. Let’s move to the Windows 7 and troubleshoot.
Continue reading ‘Windows 7 cause “mount: Cannot allocate memory”’ »

Detecting Duplicate IP Address using arping

I have been facing a loss of connection suddenly, so I am suspecting that some host on the network is using the same IP address with me.

So I used this tool called arping.

Let’s said I want to check whether 192.168.1.1 is configure on more than 1 host. You need to test it on another machine which is not configure as 192.168.1.1

[svr1:/root]# arping -I eth0 -c 3 192.168.1.1
ARPING 192.168.1.1 from 192.168.1.99 eth0
Unicast reply from 192.168.1.1 [00:0D:A2:02:3B:53] 1.090ms
Unicast reply from 192.168.1.1 [00:0D:A2:02:3B:53] 0.837ms
Unicast reply from 192.168.1.1 [00:0D:A2:02:3B:53] 1.031ms
Sent 3 probes (1 broadcast(s))
Received 3 response(s)

As you can see, the host that response has the same mac address means this IP address is not conflict with any of the host on the network.

To simplify things, you can use this single command that uses “Duplicate address detection mode (DAD)”.

[svr1:/root]# arping -D -I eth0 -c 3 192.168.1.1 >/dev/null;echo $?
1

If you get “0″, it means that the IP address has conflict with another host

    or

it also means that there is no host in the network configured on the IP address.

So I got “1″ on the IP address I am trying to detect, it looks like IP conflict is not a issue here for me.

Hope this helps someone…

Force fsck on reboot

Sometimes if you suspect your file system is corrupted, you might want to run fsck to check against the file system. You just need to create a simple file at the root partition.

touch /forcefsck
reboot

Simple and easy =)

Dell: No controllers found.

I am running some random check on the system that I handle. One of the Dell server controller is undetectable for unknown reason.

[svr3:/root]# omreport storage controller
No controllers found.

Before you start to panic, run the following command

modprobe mptctl
/etc/init.d/dataeng restart

Now try to execute the controller status command again.

[svr3:/root]# omreport storage controller
Controller SAS 6/iR Adapter (Slot 1)

Controllers
ID : 0
Status : Ok
Name : SAS 6/iR Adapter
Slot ID : PCI Slot 1
State : Ready
Firmware Version : 00.25.47.00.06.22.03.00
Minimum Required Firmware Version : Not Applicable
Driver Version : 3.04.05
Minimum Required Driver Version : Not Applicable
Number of Connectors : 2

Hope this helps… =)

NTFS read/write in Linux

Accessing NTFS parition via Linux is pretty simple. Here is the steps to get it running in less than 10 mins :)

Let’s install some basic stuff.

1
yum install gcc gcc-c++ make kernel-devel

Setup Fuse

1
2
3
4
5
6
wget http://jaist.dl.sourceforge.net/sourceforge/fuse/fuse-2.7.4.tar.gz
tar zxvf fuse-2.7.4.tar.gz
cd fuse-*
./configure
make
make install

Next, download NTFS-3G from here

1
2
3
4
5
6
wget http://www.ntfs-3g.org/ntfs-3g-2009.1.1.tgz
tar zxvf ntfs-3g-2009.1.1.tgz
cd ntfs-3g-*
./configure
make
make install

Last but not least

1
2
3
modprobe fuse
mkdir /windows
 mount -t ntfs-3g /dev/sdb1 /windows

You can then read/write your windows partition from /windows ;)

Hope this helps … :)

Dell OMSA and R300 issue

Well, today I was deploying my Dell R300 happily when I run into some trouble.

I setup Dell OpenManage Server Administrator (OMSA) based on the instructions here.

wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash

After which, I execute this command but it complain that “No package srvadmin-all available”.

yum install srvadmin-all

After 1 hour of troubleshooting, I found a way to install OMSA.

The latest version at this point of writing for OSMA is 5.5, I have to force to install 5.4.1 first.

wget -q -O - http://linux.dell.com/repo/hardware/OMSA_5.4.1/bootstrap.cgi | bash
yum install srvadmin-all

This will works for now. Grab a coffee and wait for it to finish installing first.

After you have installed 5.4.1, let’s upgrade to 5.5 now.

cd /etc/yum.repos.d/
sed -ie 's#OMSA_5.4.1#latest#' dell-hw-specific-repository.repo dell-hw-indep-repository.repo

Before you update, let’s make sure the srvadmin services is not running first.

srvadmin-services.sh status

Now, let’s update now and check the latest version :)

yum update
rpm -qa|grep srvadmin-all

Expected result:

[svr3:/root]# rpm -qa|grep srvadmin-all
srvadmin-all-5.5.0-364

Let’s start your OMSA and ready to go.

srvadmin-services.sh start

Visit your OMSA at https://IP-ADDRESS:1311/

Enjoy and hope this helps…