分享
 
 
 

linux系统的设定

王朝system·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

著作权属陈建业

在这□我们先了解整个linux启动的流程,首先系统核心由lilo

或loadlin程式读入记忆体,在解压缩後分别载入各周边的驱动程

式。必须注意的是,有些驱动程式采自动侦测(auto-probe)的方

式,判断硬体的设定情形,如果在核心载入的过程中,发现有侦测

错误的情况,必须把确实的硬体设定参数由lilo、loadlin在载入

时传入核心。

在核心完成载入後,linux会执行init程式,init程式会根据

/etc/inittab的设定完成系统启动的程序。由於在启动系统时,我

们可能希望进入正常的运作模式提供对外服务,或进入系统维护模

式暂时停止对外服务,所以除了特殊事件处理外,每一个项目都指

定run level,通知init这次启动本项目是否要执行。接著init监督

所有由它启动的程式及停电等系统事件,直到shutdown为止。例如

getty负责使用者签入,而一般getty的action为respawn,表示使用

者离线後,init会再重新启动getty等待下一个使用者。

#

# inittab This file describes how the INIT process should set up

# the system in a certain run-level.

#

# Version: @(#)inittab 2.04 17/05/93 MvS

#

# Author: Miquel van Smoorenburg,

#

# 格式: ## Default runlevel.#id:5:initdefault:## System initialization (runs when system boots).#si:S:sysinit:/etc/rc.d/rc.S## Script to run when going single user.#su:S:wait:/etc/rc.d/rc.K## Script to run when going multi user.#rc:123456:wait:/etc/rc.d/rc.M## What to do at the "Three Finger Salute".#ca::ctrlaltdel:/sbin/shutdown -t3 -rf now## What to do when power fails (shutdown to single user).#pf::powerfail:/sbin/shutdown -f +5 "THE POWER IS FAILING"## If power is back before shutdown, cancel the running shutdown.#pg:0123456:powerokwait:/sbin/shutdown -c "THE POWER IS BACK"## If power comes back in single user mode, return to multi user mode.#ps:S:powerokwait:/sbin/init 5## The getties in multi user mode on consoles an serial lines.## NOTE NOTE NOTE adjust this to your getty or you will not be# able to login !!## Note: for 'agetty' you use linespeed, line.# for 'getty_ps' you use line, linespeed and also use 'gettydefs'#c1:12345:respawn:/sbin/getty tty1 38400 consolec2:12345:respawn:/sbin/getty tty2 38400 consolec3:45:respawn:/sbin/getty tty3 38400 consolec4:45:respawn:/sbin/getty tty4 38400 vt100#c5:45:respawn:/sbin/agetty 38400 tty5#c6:456:respawn:/sbin/agetty 38400 tty6## Serial lines##s1:45:respawn:/sbin/agetty 19200 ttyS0#s2:45:respawn:/sbin/agetty 19200 ttyS1## Dialup lines##d1:45:respawn:/sbin/agetty -mt60 38400,19200,9600,2400,1200 ttyS0#d2:45:respawn:/sbin/mgetty -D -n 5 ttyS1 38400 vt100## Runlevel 6 used to be for an X-window only system, until we discovered# that it throws init into a loop that keeps your load avg at least 1 all# the time. Thus, there is now one getty opened on tty6. Hopefully no one# will notice. ;^)# It might not be bad to have one text console anyway, in case something# happens to X.#x1:6:wait:/etc/rc.d/rc.6# End of /etc/inittab*上表除中文说明外,节录自slackware 2.1.0之/etc/inittab从inittab可以看到,id:5:initdefault表示在载入核心时若没有指定runlevel,则以5作为内定值。rc.S的action属於sysinit,会在系统启动後首先被执行。接著id为rc那一项,指定在runlevel为1~6时执行,属性为wait表示init会执行rc.M且等待它执行完毕。这两个script和系统环境较密切,我们下面会作较详细的介绍。另外id为ca那一项定义了按ctrl-alt-del时,执行shutdown并立即reboot。至於id为c1~c6、s1~s2、d1~d2者,指定在那一个runlevel下,启动那些终端机,它们的action属於respawn表示这些程式在结束後,init会再次重新执行它们,直到shutdown为止。如果须要更详细的资料,可用man init得到更详细的说明。#!/bin/sh## /etc/rc.d/rc.S## These commands are executed at boot time by init(8).# User customization should go in /etc/rc.local.PATH=/sbin:/usr/sbin:/bin:/usr/bin## 启动swap系统:## 1. mount所有定义在/etc/fstab内的swap partition##/sbin/swapon -av## 2.启动swap file而不是swap partition#/sbin/swapon /.Swapfile## Start update.#/sbin/update &## Test to see if the root partition is read-only, like it ought to be.## 测试档案系统的完整性#READWRITE=noif echo -n"Testing filesystem status"; thenrm -f "Testing filesystem status"READWRITE=yesfi## Check the integrity of all filesystems#if [ ! $READWRITE = yes ]; then/sbin/fsck -A -a# If there was a failure, drop into single-user mode.if [ $? -gt 1 ] ; thenechoechoecho "**************************************"echo "fsck returned error code - REBOOT NOW!"echo "**************************************"echoecho/bin/loginfi## Remount the root filesystem in read-write mode#echo "Remounting root device with read-write enabled."/sbin/mount -w -n -o remount /if [ $? -gt 0 ] ; thenechoecho "Attempt to remount root device as read-write failed! This is going to"echo "cause serious problems... "echoecho "If you're using the UMSDOS filesystem, you **MUST** mount the rootpartition"echo "read-write! You can make sure the root filesystem is getting mounted"echo "read-write with the 'rw' flag to Loadlin:"echoecho "loadlin vmlinuz root=/dev/hda1 rw (replace /dev/hda1 with your rootdevice)"echoecho "Normal bootdisks can be made to mount a system read-write with therdev command:"echoecho "rdev -R /dev/fd0 0"echoecho "You can also get into your system by using a bootkernel disk with acommand"echo "like this on the LILO prompt line: (change the root partition nameas needed)"echoecho "LILO: mount root=/dev/hda1 rw"echoecho "Please press ENTER to continue, then reboot and use one of the abovemethods to"echo -n "get into your machine and start looking for the problem. "read junk;fielseecho "Testing filesystem status: read-write filesystem"if [ -d /DOS/linux/etc -a -d /DOS/linux/dev ]; then # no warn for UMSDOScat*** ERROR: Root partition has already been mounted read-write. Cannot check!For filesystem checking to work properly, your system must initially mountthe root partition as read only. Please modify your kernel with 'rdev' so thatit does this. If you're booting with LILO, add a line:read-onlyto

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有