Dec 06

The recently released Fedora 11(CentOS 5) Leonidas has some issues with it’s regular update process. Many users are getting a strange error which complains about the inability of the update system to retrieve the repository metadata, namely repomd.xml. You can see the error as attached in this inlet below:

Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again

When we tried to install Fedora 11(CentOS5) for the first time, we also faced a similar problem. A quick twitter search brought us to a conclusion that we were not alone. But a little tweaking of a few system files brought us back on track. In this article we tell you, how to go about resolving the problem in case you face it too.

  • You need to edit two of your repository files: /etc/yum.repos.d/fedora.repo and /etc/yum.repos.d/fedora-updates.repo. Now un-comment all the lines that start with  the term baseurl and place a comment before all lines that start with mirrorlist. This should be done for both the above files.

Now edit your /etc/hosts file and append the following to it’s contents:

80.239.156.215 mirrors.fedoraproject.org

OR you can close yum-updatesd daemon on runlevel 3

chkconfig level 3 yum-updatesd off

/etc/rc.d/init.d/yum-updatesd stop

Now try updating your system or installing any software via Yum. You will see, the error is now resolved and the error message is not shown anymore.

Tagged with:
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:
Jan 19

Q: apt-get update error:apt error:

E: Dynamic MMap ran out of room.

       how to resolve it.

A: It Is because the default buffer is too small,you can change it. edit /etc/apt/apt.conf

echo “APT::Cache-Limit "125000000";” >> /etc/apt/apt.conf

Tagged with:
Jan 18

Linux Kernel 2.6.20 kernel support for the process of more than IO statistics, can use such tools like iotop each process to monitor the situation on the IO operation, just as with the top real-time view process memory, CPU and so take the case in.  But for Linux kernel version 2.6.20 the following not so lucky, according to Stack Overflow of Replies in this way is given, VPSee Python to write a simple script that is used in linux kernel <2.6.20 the printing process under the IO condition .

Kernel < 2.6.20 Kernel <2.6.20

This idea is very simple script to redirect the results of dmesg to a file and then parse out the process once every 1 second to print the statistics IO read and write, execute this script needs root:

 

#!/usr/bin/python
# Monitoring per-process disk I/O activity
# written by Jason

import sys, os, time, signal, re

class DiskIO:
    def __init__(self, pname=None, pid=None, reads=0, writes=0):
        self.pname = pname
        self.pid = pid
        self.reads = 0
        self.writes = 0

def main():
    argc = len(sys.argv)
    if argc != 1:
        print "usage: ./iotop"
        sys.exit(0)

    if os.getuid() != 0:
        print "must be run as root"
        sys.exit(0)

    signal.signal(signal.SIGINT, signal_handler)
    os.system(‘echo 1 > /proc/sys/vm/block_dump’)
    print "TASK              PID       READ      WRITE"
    while True:
        os.system(‘dmesg -c > /tmp/diskio.log’)
        l = []
        f = open(‘/tmp/diskio.log’, ‘r’)
        line = f.readline()
        while line:
            m = re.match(\
                ‘^(\S+)\((\d+)\): (READ|WRITE) block (\d+) on (\S+)’, line)
            if m != None:
                if not l:
                    l.append(DiskIO(m.group(1), m.group(2)))
                    line = f.readline()
                    continue
                found = False
                for item in l:
                    if item.pid == m.group(2):
                        found = True
                        if m.group(3) == "READ":
                            item.reads = item.reads + 1
                        elif m.group(3) == "WRITE":
                            item.writes = item.writes + 1
                if not found:
                    l.append(DiskIO(m.group(1), m.group(2)))
            line = f.readline()
        time.sleep(1)
        for item in l:
            print "%-10s %10s %10d %10d" % \
                (item.pname, item.pid, item.reads, item.writes)

def signal_handler(signal, frame):
    os.system(‘echo 0 > /proc/sys/vm/block_dump’)
    sys.exit(0)

if __name__=="__main__":
    main()

Kernel> = 2.6.20

If you want to use IO iotop process real-time view the status of activities, then, need to download and upgrade the new kernel (2.6.20 or later).  Compile a new kernel need to open TASK_DELAY_ACCT and TASK_IO_ACCOUNTING options.  Extract the kernel into the configuration interface:

# tar jxvf linux-2.6.30.5.tar.bz2
# mv linux-2.6.30.5 /usr/src/
# cd /usr/src/linux-2.6.30.5

# make menuconfig

Select Kernel hacking -> Collect scheduler debugging info and Collect scheduler statistics, save compile the kernel after kernel:

# Make; make modules; make modules_install; make install

Modify grub, start a new kernel recognized correctly:

# Vi / boot / grub / menu.lst

Out of the new kernel outside, iotop also need to run Python 2.5 or above, so if the current Python 2.4, then you need to download and install the latest Python package.  Compile and install using the source code here:

# Tar jxvf Python-2.6.2.tar.bz2
# cd Python-2.6.2 # Cd Python-2.6.2
# ./configure
#. / Configure # make; make install
# Make; make install

Do not forget to download setuptools:

# Mv setuptools-0.6c9-py2.6.egg.sh setuptools-0.6c9-py2.6.egg # sh setuptools-0.6c9-py2.6.egg # Sh setuptools-0.6c9-py2.6.egg

More

If you want to know more about block_dump information, you can look at this process in real-time Linux IO monitoring the situation .  When using block_dump is best to turn off klogd process.

Tagged with:
Oct 31

A. RAR files are in compressed archive format, if you have downloaded rar files from the Internet, you need to unpack or unrar them (extract rar files).

RAR is a proprietary file format for data compression and archiving, developed by Eugene Roshal.

Under Linux and UNIX, use command called unrar. By default unrar is not being installed on Linux, FreeBSD or UNIX oses. You can install unrar command with the help of apt-get or yum command.
Install unrar command

Under Debian Linux, you need to type apt-get as follows to install unrar program:
# apt-get install unrar

If you are using Fedora core Linux then use yum command as follows

# yum install unrar

If you are using FreeBSD, use:
# pkg_add -v -r unrar

If any of above, methods is not working for you, download binary package from official rarlab site:
$ cd /tmp
$ wget http://www.rarlab.com/rar/rarlinux-3.6.0.tar.gz

Untar file
$ tar -zxvf rarlinux-3.6.0.tar.gz

Both unrar and rar commands are located in rar sub-directory. Just go to rar directory:
$ cd rar
$ ./unrar

Now copy rar and unrar to /bin directory:
# cp rar unrar /bin

How to use unrar

unrar command supports various options below are common options that you need to use everyday.

Task: To open rar (unpack) file in current directory type command:

$ unrar e file.rar

Please note that replace file.rar filename with your actual filename.

Task: List (l) file inside rar archive:

$ unrar l file.rar

Task: To extract (x) files with full path type command:

$ unrar x file.rar

(D) To test (t) integrity of archive, file type command:
$ unrar t file.rar

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:
preload preload preload