pepoとネットワークを語ろう

40年前からこれまでとこれからのネットワークを語る

devの検出とmodulesのインストール

2009-01-28 22:41:56 | Linux
1CDLinuxでデバイス検出とモジュールのロードがうまく行う方法が無いかと探していたら、素晴らしいスクリプトを発見
http://blog.gcd.org/archives/2007-12.html
少し改造して下記で、CentOS4.7ベースはこれをCentOS5.2はudevだけでもOKだが念ためにこれで
[ -x /sbin/start_udev ] && /sbin/start_udev
#initialize hardware
inst2dev() {
echo initialize hardware
# disable kernel messages while probing dev
echo "0" > /proc/sys/kernel/printk
dev2mod() { while read dev; do modprobe $dev >/dev/null 2>&1; done }
cat /sys/bus/*/devices/*/modalias | dev2mod
modprobe yenta_socket
cat /sys/bus/*/devices/*/modalias | dev2mod
# enable kernel messages
echo "6" > /proc/sys/kernel/printk
}
inst2dev

HAL daemonがFAILEDする

2009-01-27 21:53:50 | Linux
Centos5.2ベースの1CDlinuxがVmware2.0上で走らすと時々HAL daemonがFAILEDする
haldのhelp確認
# hald --help
usage : hald [--daemon=yes|no] [--verbose=yes|no] [--help]

--daemon=yes|no Become a daemon
--verbose=yes|no Print out debug (overrides HALD_VERBOSE)
--retain-privileges Retain privileges (for debugging)
--use-syslog Print out debug messages to syslog instead of stderr.
Use this option to get debug messages if HAL runs as
daemon.
--help Show this information and exit
--version Output version information and exit
The HAL daemon detects devices present in the system and provides the
org.freedesktop.Hal service through the system-wide message bus provided
by D-BUS.

For more information visit http://freedesktop.org/Software/hal
# /usr/sbin/hald --daemon=yes --verbose=yes --use-syslog
verboseとuse-syslogオプションをつけてログを確認
# cat /var/log/messages |grep hald
Jan 27 21:20:08 (none) hald[5736]: 21:20:08.537 [I] hald.c:479: hal 0.5.8.1
Jan 27 21:20:08 (none) hald[5736]: 21:20:08.538 [I] hald.c:488: Will daemonize
Jan 27 21:20:08 (none) hald[5736]: 21:20:08.538 [I] hald.c:489: Becoming a daemon
Jan 27 21:20:08 (none) hald[5737]: 21:20:08.540 [I] hald_dbus.c:4058: local server is listening at unix:abstract=/var/run/hald/dbus-k9j6uFwiDc,guid=f8fb7e4944b12ba5098add6c08282400
Jan 27 21:20:08 (none) hald[5737]: 21:20:08.548 [I] hald_runner.c:220: Runner has pid 5738
Jan 27 21:20:08 (none) hald[5737]: 21:20:08.554 [I] osspec.c:625: Synthesizing sysfs events...
Jan 27 21:20:08 (none) hald[5737]: 21:20:08.561 [I] coldplug.c:120: dev_root is /dev
Jan 27 21:20:08 (none) hald[5737]: 21:20:08.592 [I] coldplug.c:252: found in udevdb '/sys/class/graphics/fb0' '/dev/fb0'
Jan 27 21:20:08 (none) hald[5737]: 21:20:08.593 [I] coldplug.c:274: found device_file /dev/ttyS2 for sysfs_path /sys/class/tty/ttyS2
Jan 27 21:20:08 (none) hald[5737]: 21:20:08.593 [I] coldplug.c:274: found device_file /dev/ttyS3 for sysfs_path /sys/class/tty/ttyS3

中略

Jan 27 21:20:10 (none) hald[5737]: 21:20:10.238 [W] blockdev.c:1127: Not adding device object
Jan 27 21:20:10 (none) hald[5737]: 21:20:10.238 [I] hotplug.c:172: /sys/block/ram15 is a block device (subsystem)
Jan 27 21:20:10 (none) hald[5737]: 21:20:10.239 [I] blockdev.c:613: block_add: sysfs_path=/sys/block/ram15 dev=/dev/ram15 is_part=0, parent=0x00000000
Jan 27 21:20:10 (none) hald[5737]: 21:20:10.239 [I] blockdev.c:661: Looking in /sys/block/ram15/slaves
Jan 27 21:20:10 (none) hald[5737]: 21:20:10.239 [I] blockdev.c:709: Done looking in /sys/block/ram15/slaves
Jan 27 21:20:10 (none) hald[5737]: 21:20:10.239 [I] blockdev.c:715: Ignoring hotplug event - no parent
Jan 27 21:20:10 (none) hald[5737]: 21:20:10.239 [W] blockdev.c:1127: Not adding device object
Jan 27 21:20:10 (none) hald[5737]: 21:20:10.239 [I] hotplug.c:172: /sys/block/hda is a block device (subsystem)
Jan 27 21:20:10 (none) hald[5737]: 21:20:10.240 [I] blockdev.c:613: block_add: sysfs_path=/sys/block/hda dev=/dev/hda is_part=0, parent=0x0808ec60

ログを確認するが何や分からん、結局実機で立ち上げたけど問題無いみたいなのであきらめ

fedora10のinitがなんか変

2009-01-20 12:05:06 | Linux
fedoraの1CDLinux化を計画
fedora10をインストール後/etc/inittabへ起動用のscriptを設定するが思惑通り動かず
かなりの思考錯誤が続いた後・・・もっと早く確認したら良かったが
ふとinitのマニュアルを確認するとブートアップ後/etc/event.d/以下のscriptsを順次実行するようだ
# ls /etc/event.d/
control-alt-delete quit-plymouth rc2 rc5 rcS-sulogin tty1 tty4
logd rc0 rc3 rc6 serial tty2 tty5
prefdm

fedoraのいつのバージョンからか知らないが、fedora10の起動は -->grub -->kernelイメージロード&実行 -->linuxrc -->
/etc/event.d/rcS --> /etc/rc.d/rc.sysinit --> /etc/event.d/rc3

# man init
init(8)

NAME
init - process management daemon

SYNOPSIS
init [OPTION]...

DESCRIPTION
init is the parent of all processes on the system, it is executed by
the kernel and is responsible for starting all other processes; it is
the parent of all processes whose natural parents have died and it is
responsible for reaping those when they die.

Processes managed by init are known as jobs, and can be further split
into two types; services are supervised and respawned if they should
terminate unexpectedly, and tasks are simply run once and not respawned
if they should terminate.

On startup init reads the /etc/event.d directory, each file describes a
job that should be managed. This includes the particulars about what
binary or shell script code should executed while the job is running,
and which events can cause the job to be started or stopped.

inittabはinitdefaultしか使ってない!との事で  -->Centos5.2のinitへ入れ替え
# vi /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/event.d/rcS
#
# Individual runlevels are started by /etc/event.d/rc[0-6]
#
# Ctrl-Alt-Delete is handled by /etc/event.d/control-alt-delete
#
# Terminal gettys (tty[1-6]) are handled by /etc/event.d/tty[1-6] and
# /etc/event.d/serial
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(8), initctl(8), and events(5).
#
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:

fedora kernel make

2009-01-17 15:08:16 | Linux
http://ftp.jaist.ac.jp/pub/Linux/Fedora/
あたりからkernelソースをwget
kerenlをインストール
# rpm -ihv kernel-2.6.27.9-73.fc9.src.rpm
cpio: MD5 チェックサムが適合しません。
が表示されたらMD5チェックを無視してインストール
# rpm --nomd5 -Uvh kernel-2.6.27.9-73.fc9.src.rpm
kerenlのビルド、パッチ
# rpmbuild -bp --target i686 /usr/src/redhat/SPECS/kernel.spec
 ビルドが終了すると、/usr/src/redhat/BUILD/kernel-2.6.27ディレクトリの下に
linux-2.6.x(ここではlinux-2.6.27)というサブディレクトリが作成されるので、それを/usr/srcに移動する
# mv /usr/src/redhat/BUILD/kernel-2.6.27/linux-2.6.27 /usr/src/linux-2.6.27.9-pepo
# cd /usr/src/linux-2.6.27.9-pepo
# vi Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 27
EXTRAVERSION = .9-pepo <--適当な名前を追加
NAME = Trembling Tortoise

UNIONFSのパッチを適応
# patch -p1 <unionfs-2.5_for_2.6.27-rc6.diff # patch -p1 <acm-FOMA.v0.26.06.patch # make menuconfig
ここでコンフィグの設定
# make && make install && make modules && make modules_install
エラーなしで一発でインストールが終わらないがとりあえずmake && make

apache2.2 cgiが動かん

2009-01-16 14:14:00 | Linux
apache2.2 cgiが動かん、error_logにも記録されない
久々にapacheをバージョンアップindex.htmlに書いたcgiが動かん

httpd.confへ.htmlを追加でOK
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml .html #<--.htmlを追加