From : http://linuxplayer.org/2011/05/build-vanilla-linux-kernel-on-centos-5



Build vanilla linux kernel on CentOS 5


Building a Linux kernel itself is not complicated. In normal case, we just download the latest Linux kernel from http://www.kernel.org, extract the tarball, cd to the kernel source tree, then run a series of command:

wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.6.tar.bz2
tar -xjf linux-2.6.38.6.tar.bz2
cd linux-2.6.38.6
make mrproper
make menuconfig
make -j2 > /dev/null
sudo make modules_install
sudo make install

In order for the newly built kernel to be able to boot successfully, we need to configure it with required driver modules, this includes, but not limited to, filesystem drivers, block device drivers, network device drivers, …etc.

However, when it comes to CentOS/RHEL 5, our normal kernel building procedure may not be able to produce a bootable kernel. We may get this error message followed by the famous kernel panic when we are using LVM on the root filesystem.

Scanning and configuring dmraid supported devices
Scanning logical volumes
  Reading all physical volumes.  This may take a while...
  No volume groups found
Activating logical volumes
  Volume group "VolGroup00" not found
Trying to resume from /dev/VolGroup00/LogVol01
Unable to access resume device (/dev/VolGroup00/LogVol01)
Creating root device.
Mounting root filesystem.
mount: could not find filesystem '/dev/root'

The initrd generated by CentOS makes use of some old sysfs features, and the newly built kernel may have that feature disabled. we can reconfigure the kernel to enable it:

General setup->
 [*] enable deprecated sysfs features to support old userspace tools
  │ │    [*]   enabled deprecated sysfs features by default     

Or , manually edit the .config file, add these lines:

CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y

then run

make oldconfig

Make and install the kernel again, it should boot successfully.



WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,

daemon ntsysv

카테고리 없음 2014. 3. 28. 13:07


ntsysv
chkconfig name <on|off|reset>

For example:
chkconfig acpid off

List available daemons:
chkconfig --list

             acpid - off Advanced Configuration and Power Interface
		     event daemon. Shutdown applications if the power fails.

           aep1000 - off AEP1000/AEP2000 coprocessor driver.

           anacron - off Cron-like, but doesn't assume that the
 	             machine is always on.

              apmd - off Advanced Power Management. Only on for your
		     UPS to shutdown your computer when the power fails.

               atd - off Run jobs queued for later execution by "at". 

            autofs - off Auto mount CDs and other file system-like
		     devices and media.

           bcm5820 - off Hardware cryptographic accelerator support for
		     the BCM5820 Cryptonet driver.

          cpuspeed - on for laptops, off for desktop computers.

             crond - on Runs regularly scheduled system tasks, e.g. a
                     task that runs once a day.

              cups - on Common Unix Printing System. Necesary if you
		     want to print.

cups-config-daemon - off(?) Works with HAL to dynamically manage printer
                     configuration. Might overwrite
                     /etc/cups/cupsd.conf. See:
                     http://www.cups.org/articles.php?L301

          cxoffice - off Probably runs automatically if you have
                     Crossover Office and run an installed Windows application.

         dc_client - off Distributed session cache client proxy.

         dc_server - off Distributed session cache server.

               gpm - off unless you want mouse cut/paste on the
		     non-graphical console.

         haldaemon - on Auto-recognizes various kinds of hardware and
		     mountable media.

             httpd - off The Apache web server. Only on if you need a
		     web server.

          iptables - on The firewall.

              irda - off Infrared wireless device daemon. For PDA, etc.

        irqbalance - on If you have a multiprocessor system. Off on
		     all single cpu machines.

              isdn - off Only used if you have an ISDN network connection.
		     kudzu - off Detects and configures new and/or changed
		     hardware on a system. Can be run manually if you need it.

              lisa - off Scans your network to provide information
                     about hosts on your network, perhaps including
                     Windows shares. Some versions have security
                     problems. Part of kdenetwork utilities.

        lm_sensors - off Monitor system sensors such as CPU and
		     motherboard temperature.

     mDNSResponder - off Publishes and browses available network
		     services via Zeronconf (aka "Rendezvous").

         mdmonitor - off Part of the mdadm package to administer
                     software RAID. See rpm -qi mdadm

             mdmpd - off Monitor MD multipath devices, e.g. disks with
		     more than one controller. Apparently only for
		     RAID arrays.

        messagebus - on Provides a communication bus for dbus. Programs
                     talk to other programs. Probably leave enabled.

     microcode_ctl - on for Intel CPUs, off for AMD processors. Only works on Intel CPUs
                     (doesn't work with AMD). I'm not clear what the
                     updated microcode does. You can find out your cpu
                     info on Linux systems with this command:
		     cat /proc/cpuinfo
		     More info at:
                     http://www.urbanmyth.org/microcode/

            mysqld - off A crash prone, slow, non-standard SQL
		     database server.

             named - off A DNS server.

           netdump - off Only for diagnosing kernel crashes.

             netfs - off Automatically Mounts and unmounts all Network
                     File System (NFS), SMB/CIFS (Lan
                     Manager/Windows), and NCP (NetWare) mount points.
                     This is the only thing you need if you are an NFS
                     client (e.g. not an NFS server), since netfs will
                     run any other necessary daemons. Netfs may
                     automatically handle everything necessary for the
                     other (non-NFS) protocols, but I've only tested
                     it with NFS. Disable this if you don't use NFS,
                     Samba, or NetWare.

          netplugd - off Automatic recognition of active/inactive
		     network interfaces.

           network - on if you have an Ethernet connection. Off for
                     modem users.

               nfs - off Network File System. Only on to allows other
		     unix systems to share your hard drive (volume, file system). Not
		     necessary if you are a client to a shared volume.

           nfslock - off Provides NFS file locking functionality.
                     Disable if you aren't using NFS. Required by nfs.

              nifd - off Network interface monitor. Calls
		     mDNSResponder if your IP address changes.

              nscd - off Nscd provides cacheing for the passwd(5),
		     group(5), and hosts(5) databases.

              ntpd - off Network Time Protocol. Easier to put this in
		     cron: /usr/sbin/ntpdate -s -u ntp1.virginia.edu

            pcmcia - on for laptop users with PCMCIA cards. Off for
		     desktop machines.

           portmap - off Netfs will start portmap as necessary.
		     Portmap is DARPA port to RPC program number
		     mapper. Required if you are an nfs client or
		     server (although netfs starts portmap for
		     clients, so you don't need it explicitly
		     enabled). If you're not using NFS or NIS, then
		     you should disable portmap. Some (?) versions of
		     portmap are highly insecure. You can run `rpcinfo
		     -p $hostname` against your system to see what
		     additional services it is providing.  More info
		     at:
		     http://cert.uni-stuttgart.de/archive/suse/security/2003/04/msg00141.html

        postgresql - off The most powerful, fastest, easiest to use SQL
		     database. Robust and has excellent documentation. 

            psacct - off Daemon used by several utilities for monitoring process
                     activities, including ac, lastcomm, accton, and sa.

         readahead - off The readahead process preloads the buffer
                     cache with files that might be paged in one 'page
                     demand triggered' read at a time.  This can speed
                     things up of boxes with enough memory. Config
                     file is: /etc/readahead.files

   readahead_early - off See readahead. Config file is: /etc/readahead.early.files

             rhnsd - off Queries the Red Hat Network for updates and
		     information.

           rpcgssd - off Part of the nfs-utils package. Required by nfs.

         rpcidmapd - off Required if you are running an nfs server.

        rpcsvcgssd - off Required by nfs.

         saslauthd - off unless you are using plaintext SASL password
		     authentication

          sendmail - off Part of the mail server. Only on if you
		     machine is mail server.

           sgi_fam - off FAM is a file monitoring daemon that detects
                     when files have changed and then performs some action.

            smartd - off SMART Disk Monitoring Daemon. Monitor hard
		     drive and predict failure.

               smb - off Samba Windows file sharing server.

             snmpd - off Respond to SNMP request packets. Probably
		     only on if another machine is monitoring the
		     status of your machine.

         snmptrapd - off Receive and log SNMP trap messages. SNMP is
		     for monitoring system status.

      spamassassin - off Mail filter to identify spam using text
		     analysis. Only for mail servers(?)

             squid - off Proxy caching server for web and ftp.

              sshd - off SSH daemon. On if you want to ssh into your
		     machine.

            syslog - on Handles logging of system events. It is good
                     to leave this turned on. Logs autorotate and will
                     not fill your hard drive.

               tux - off Apparently a web server.

         vncserver - off Remote desktop sharing.

           winbind - off Related to Samba.

               xfs - on X Windows font server. Use by X windows to
		     support a graphical desktop (including KDE and Gnome)

            xinetd - on Super daemon (aka super server), launches network related daemons
		     on demand.

            ypbind - off Disabled unless you are using and NIS server, usually
		     for password authentication

         yppasswdd - off yppasswdd is the RPC server that lets users
		     change their passwords when you are using NIS
		     (a.k.a. YP).

            ypserv - off ypserv is an implementation of the standard
		     NIS/YP networking protocol.

            ypxfrd - off ypxfrd should be started in addition to ypserv to
		     accelerate transferring yp maps.

               yum - off Yellow dog Updater, Modified. Updates
	             software packages (rpm and/or apt
	             packages). Some people run it nightly, some run
	             it manually. 



WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,

출처 : http://www.thelinuxdaily.com/2012/03/simple-stopwatch-script/



Simple Stopwatch Script


The following is a short and plain shell script that will start a timer when you run the program that counts up. I think you could argue that it’s not a stopwatch because it doesn’t support laps, but it’s close enough for me. You can easy get started by copying the following code block into a text editor, saving as stopwatch.sh, running chmod +x stopwatch.sh to make it executable, and finally starting it with ./stopwatch.sh. To stop it, hit Ctrl+c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
 
BEGIN=$(date +%s)
 
echo Starting Stopwatch...
 
while true; do
   NOW=$(date +%s)
   let DIFF=$(($NOW - $BEGIN))
   let MINS=$(($DIFF / 60))
   let SECS=$(($DIFF % 60))
   let HOURS=$(($DIFF / 3600))
   let DAYS=$(($DIFF / 86400))
 
   # \r  is a "carriage return" - returns cursor to start of line
   printf "\r%3d Days, %02d:%02d:%02d" $DAYS $HOURS $MINS $SECS
   sleep 0.25
done

The previous script will allow you to track from the time you say “go” until you stop it. It’s also nice to the real-estate on your terminal and will use backspace to remove the characters printed from before to make room for the new ones.

If you’re not worried about starting it “now” or real estate in the terminal, you could always use uptime and throw it into a while loop like this:

1
2
3
#!/bin/sh
 
while true; do uptime | cut -d' ' -f2; done

Both are simple, both have their own advantages and disadvantages. Choose wisely. ;-)

Source: unix.com forums

I used the scripts to help me figure out how long it was taking my desktop to lock up so I could troubleshoot it better. Another use might be to keep track of how much time you’re spending on the computer vs the amount of time spent skiing! Have fun either way.

Edit
A subscriber, Jim, came up with a much better stopwatch script than my thrown together example. Jim sent it via email, but I’ll post it here for all to see.

It doesn’t start counting till you press the spacebar, pressing the
spacebar again pauses it counting, until the spacebar is pressed to
continue counting.

Press ‘q’ to quit
Press ‘r’ to reset to zero

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
 
# sets stdin to no echo and give a char every tenth of a sec.
stty -echo -icanon time 1 <&0
 
chkspace () {
 
  if ! read -t 0 ; then return 1 ; fi    # no char pressed
  read -n 1 ans
  if [ "$ans" = " " ]; then return 0 ; fi
  case "$ans" in
  r|R)  COUNT=0 ; BEGIN=$(date +%s)
        printf "\r%3d Days, %02d:%02d:%02d" 0 0 0 0
        ;;
  q|Q)  stty echo icanon <&0
        echo ""
        exit 0
        ;;
  [1-9]) echo " - $ans" ;;
  esac
  return 1
}
 
echo "Stopwatch: to start and stop press the SPACEBAR..."
 
printf "\r%3d Days, %02d:%02d:%02d" 0 0 0 0
 
COUNT=0
IFS=
while true ; do
 
  while true; do
    if chkspace ; then break; fi
    sleep 0.1
  done
 
  BEGIN=$(date +%s)
  while true; do
    NOW=$(date +%s)
    let DIFF=$(($NOW - $BEGIN + $COUNT))
 
    let MINS=$(($DIFF / 60))
    let SECS=$(($DIFF % 60))
    let HOURS=$(($DIFF / 3600))
    let DAYS=$(($DIFF / 86400))
 
    # \r  is a "carriage return" - returns cursor to start of line
    printf "\r%3d Days, %02d:%02d:%02d" $DAYS $HOURS $MINS $SECS
 
    if chkspace ; then break; fi
    sleep 0.1
  done
 
  COUNT=$DIFF
done


WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,

출처 : http://lpbox.co.kr/lp/read.php?id=Linux&main_No=60&sub_No=AAAAA



CentOS 5.4를 깔자마자, 사정상 커널 컴파일을 했는데 부팅시 에러로 인한 삽질을 경험하여 포스팅 함.

1. 컴파일 도구 설치

코드

# yum install gcc
# yum install ncurses-devel
# yum install rpm-build
# yum install bison
# yum install depmod
# yum install mkinitrd


2. 커널 다운로드& 압축 해제
코드

# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.33.1.tar.bz2
# tar xvf linux-2.6.33.1.tar.bz2
# ln -s linux-2.6.33.1 linux
# cd linux


3. 메뉴 구성
코드

# make clean
# make mrproper
# cp /boot/config-현재커널 버전 ./.config
# make menuconfig

현재 구동중인 커널의 환경정보를 기준으로 커널을 컴파일 하기 위하여 cp /boot/config-현재커널 버전 ./.config 를 함

이제 핵심!!!
메뉴 하단에 Load an Al ternate Configuration File을 선택
.config 파일이 입력되어 있는데, 이를 선택하여 현재 커널 환경을 불러들임
이후
General Setup ---> enable deprecated sysfs features which may confuse old usersp 를 Y키를 눌러 *로 활성화 시킨다.
이후 저장하여 메뉴 환경 설정 메뉴에서 탈출!!
또는 .config 파일에서 CONFIG_SYSFS_DEPRECATED_V2=y
로 설정

이를 하지 않고 부팅시 insmod: error inserting '/lib/dm-region-hash.ko': -1 File exists라는 메세지와 함께 커널 패닉!!
설정하더라도 같은 메세지는 나오지만 패닉없이 잘 넘어감

이후
코드
#make && make modules && make modules_install && make install
#cat /boot/grub/grub.conf

#cat /boot/grub/grub.conf를 통해 새로운 커널이 부팅할 수 있게 설정되었는지 확인한

코드

#reboot
...
#uname -a


WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,

출처 : https://www.ibm.com/developerworks/community/blogs/brian/entry/linux_show_the_number_of_cpu_cores_on_your_system17?lang=en


Finding the number of CPU cores on a Linux server can be challenging.   The way /proc/cpuinfo displays information makes it hard to distinguish between real CPU cores and logical hyperthreading CPU's.     
 
For example, consider if I run the following command on my Linux laptop:
$ cat /proc/cpuinfo  | grep processor
processor    : 0
processor    : 1
processor    : 2
processor    : 3


At first glance it appears that my laptop has 4 CPU cores in it.     However, it really has 2 CPU cores with hyperthreading enabled.  The hyperthreading presents 2 logical CPU's to the operating system for each actual core so it effectively doubles the number of logical CPU's your system will see in /proc/cpuinfo. 
 
The fields under /proc/cpuinfo that you need to compare to find the number of cores are "physical id" and "cored id".    The "physical id" will identifier for the physical CPU socket.   So to find the number of actual CPU sockets being used you can run this command:
 
$  cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
1

 
 In this example the computer only has 1 physical socket being used. 
 
To show the total number of cores, you need to look at both "physical id" and "core id".   "core id" is the identifier for each core on a CPU socket.    If we run this command:
 
 $ cat /proc/cpuinfo | egrep "core id|physical id" 
physical id    : 0
core id        : 0
physical id    : 0
core id        : 0
physical id    : 0
core id        : 2
physical id    : 0
core id        : 2
 
Put every 2 lines together (i.e. line 1 and 2, lines 3 and 4, lines 5 and 6, and lines 7 and 8) to see information about the 4 logical CPU's on the system.    If you compare lines 1 and 2 to lines 3 and 4 you will see that they are identical.   This is because lines 1-4 are actually a single CPU core that are presented as 2 logical CPU's due to hyperthreading.   So based on this output we can see there are 2 unique CPU cores (lines 1-4 and lines 5-8).
 
Using the following command we can tie all of this together to show the number of cores on a system:
 
 $ cat /proc/cpuinfo | egrep "core id|physical id" | tr -d "\n" | sed s/physical/\\nphysical/g | grep -v ^$ | sort | uniq | wc -l
2

 
This command squishes the /proc/cpuinfo physical id and core id for each logical CPU on to the same line, and then sorts them and runs uniq to remove the extra hyperthreading logical CPU's.   The final result is the number of CPU cores on your Linux system.  

As previously mentioned you can also run this command to see the number of physical CPU sockets in use:
 
 $  cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
1
 
So in our example here we have a single CPU socket and 2 CPU cores.   


WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,
http://www.iamroot.org/xe/49027

거진 2년동안 매주 토요일마다 성균관대학교에서 진행했던 리눅스 커널 스터디가 마침내

결실은 맺었네요~

리눅스 커널 2.6.30.4 의 arm 아키텍처부분과 numa, smp 관련 소스를 대상으로 분석했습니다.

결과물은 pdf 로 만들었으며 , 많은 피드백을 받기위해 공개하였습니다.

한땀한땀 정성들인 코멘트가 있는 소스코드는 svn 으로 관리르했는데 공개여부는 미정입니다.

커널 스터디를 호기롭게 시작했지만..시간이 지나면서 제 자신이 작아지기 시작했습니다 :(

분석이라는 표현보다는..그냥 한번 봤다라고 해야겠군요!

피드백 부탁드립니다~

무엇보다도..같이 오랜시간 스터디를 함께한 노서영 박사님, 윤석훈님, 강진성님, 임윤재님, 이윤재님,  안정모님 과 그 외의 스터디원들과의 좋은 인연과 소중한 시간을 만든것에 뿌듯함을 느낍니다!

그리고 매주 토요일마다 강의실을 빌려준 성균관대학교 정보통신학부 행정실 직원분께도 심심한 감사를 드립니다~



잠시 신변정리의 시간을 갖고.. 다시 커널을 복습하거나 XEN 스터디를 하려고합니다.

너무 즐거운시간이었습니다~

http://www.iamroot.org/xe/49027

WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,