Kernelpanic常见原因

上传人:re****.1 文档编号:488831681 上传时间:2023-03-08 格式:DOC 页数:15 大小:78KB
返回 下载 相关 举报
Kernelpanic常见原因_第1页
第1页 / 共15页
Kernelpanic常见原因_第2页
第2页 / 共15页
Kernelpanic常见原因_第3页
第3页 / 共15页
Kernelpanic常见原因_第4页
第4页 / 共15页
Kernelpanic常见原因_第5页
第5页 / 共15页
点击查看更多>>
资源描述

《Kernelpanic常见原因》由会员分享,可在线阅读,更多相关《Kernelpanic常见原因(15页珍藏版)》请在金锄头文库上搜索。

1、kernel panic错误表现kernel panic主要有以下几个出错提示:Kernel panic-not syncing fatal exception in interruptkernel panic - not syncing: Attempted to kill the idle task!kernel panic - not syncing: killing interrupt handler!Kernel Panic - not syncing:Attempted to kill init !kernel错误分析查看了一下linux的源码文件,找到相关位置kernel/pan

2、ic.cNORET_TYPE void panic(const char * fmt, .)static char buf1024;va_list args;bust_spinlocks(1);va_start(args, fmt);vsnprintf(buf, sizeof(buf), fmt, args);va_end(args);printk(KERN_EMERG Kernel panic - not syncing: %s/n,buf);bust_spinlocks(0);kernel/exit.cif (unlikely(in_interrupt()panic(Aiee, killi

3、ng interrupt handler!); #中断处理if (unlikely(!tsk-pid)panic(Attempted to kill the idle task!); #空任务if (unlikely(tsk-pid = 1)panic(Attempted to kill init!); #初始化从其他源文件和相关文档看到应该有几种原因:1、硬件问题使用了SCSI-device并且使用了未知命令#WDIOS_TEMPPANIC Kernel panic on temperature trip# The SETOPTIONS call can be used to enable

4、and disable the card# and to ask the driver to call panic if the system overheats.# If one uses a SCSI-device of unsupported type/commands, one# immediately runs into a kernel-panic caused by Command Error. To better# understand which SCSI-command caused the problem, I extended this# specific panic-

5、message slightly.#read/write causes a command error from# the subsystem and this causes kernel-panic2、系统过热如果系统过热会调用panci,系统挂起#WDIOS_TEMPPANIC Kernel panic on temperature trip# The SETOPTIONS call can be used to enable and disable the card# and to ask the driver to call panic if the system overheats.

6、3、文件系统引起#A variety of panics and hangs with /tmp on a reiserfs filesystem#Any other panic, hang, or strange behavior# It turns out that theres a limit of six environment variables on the# kernel command line. When that limit is reached or exceeded, argument# processing stops, which means that the ro

7、ot= argument that UML# usually adds is not seen. So, the filesystem has no idea what the# root device is, so it panics.# The fix is to put less stuff on the command line. Glomming all your# setup variables into one is probably the best way to go.Linux内核命令行有6个环境变量。如果即将达到或者已经超过了的话root=参数会没有传进去启动时会引发pa

8、nics错误。vi grub.conf#title Red Hat Enterprise Linux AS (2.6.9-67.0.15.ELsmp)root (hd0,0)kernel /boot/vmlinuz-2.6.9-67.0.15.ELsmp ro root=LABEL=/initrd /boot/initrd-2.6.9-67.0.15.ELsmp.imgtitle Red Hat Enterprise Linux AS-up (2.6.9-67.EL)root (hd0,0)kernel /boot/vmlinuz-2.6.9-67.EL ro root=LABEL=/init

9、rd /boot/initrd-2.6.9-67.EL.img应该是其中的root=LABEL=/没有起作用。4、内核更新网上相关文档多半是因为升级内核引起的,建议使用官方标准版、稳定版另外还有使用磁盘的lvm逻辑卷,添加CPU和内存。可在BIOS中禁掉声卡驱动等不必要的设备。也有报是ext3文件系统的问题。解决:手工编译内核,把ext3相关的模块都编译进去,5、处理panic后的系统自动重启panic.c源文件有个方法,当panic挂起后,指定超时时间,可以重新启动机器if (panic_timeout 0)int i;/* Delay timeout seconds before rebo

10、oting the machine.* We cant use the normal timers since we just panicked.*/printk(KERN_EMERG Rebooting in %d seconds.,panic_timeout);for (i = 0; i panic_timeout; i+) touch_nmi_watchdog();mdelay(1000);修改方法:/etc/sysctl.conf文件中加入kernel.panic = 30 #panic错误中自动重启,等待时间为30秒kernel.sysrq=1 #激活Magic SysRq!否则,键

11、盘鼠标没有响应Linux Kernel Panic之后的招数Linux的稳定性勿容置疑,但是有些时候一些Kernel的致命错误还是会发生(有些时候甚至是因为硬件的原因或驱动故障),Kernel Panic会导致系统crash,并且默认的系统会一直hung在那里,直到你去把它重新启动!不过你可以在/etc/sysctl.conf文件中加入kernel.panic = 20来告诉系统从Panic错误中自动重启,等待时间为20秒!这个由管理员自己设定!另外一个讨厌的事情是系统hung住之后,键盘鼠标没有响应,这个可以通过设置Magic SysRq来试着解决,也是在/etc/sysctl.conf中,

12、kernel.sysrq=1来激活Magic SysRq!这样在挂住的时候至少还有一招可以使,按住ALT+SysRq+COMMAND,这里SysRq是Print SCR键,而COMMAND按以下来解释!b -立即重启e -发送SIGTERM给init之外的系统进程o -关机s - sync同步所有的文件系统u -试图重新挂载文件系统当然,谁也不希望经常用到这些招数!:O,有备无患而已Kernelpanic问题如何调试Linux kernel panic是很难定位和排查的重大故障,一旦系统发生了kernel panic,相关的日志信息非常少,而一种常见的排查方法重现法又很难实现,因此遇到kern

13、el panic的问题,一般比较头疼。没有一个万能和完美的方法来解决所有的kernel panic问题,这篇文章仅仅只是给出一些思路,一来如何解决kernel panic的问题,二来可以尽可能减少发生kernel panic的机会。什么是kernel panic就像名字所暗示的那样,它表示Linux kernel走到了一个不知道该怎么走下一步的状况,一旦到这个情况,kernel就尽可能把它此时能获取的全部信息都打印出来,至于能打印出多少信息,那就看是那种情况导致它panic了。有两种主要类型kernel panic:1.hard panic(也就是Aieee信息输出)2.soft panic

14、(也就是Oops信息输出)什么能导致kernel panic只有加载到内核空间的驱动模块才能直接导致kernel panic,你可以在系统正常的情况下,使用lsmod查看当前系统加载了哪些模块。除此之外,内建在内核里的组件(比如memory map等)也能导致panic。因为hard panic和soft panic本质上不同,因此我们分别讨论。如何排查hard panic一般出现下面的情况,就认为是发生了kernel panic:1. 机器彻底被锁定,不能使用2. 数字键(Num Lock),大写锁定键(Caps Lock),滚动锁定键(Scroll Lock)不停闪烁。3. 如果在终端下,

15、应该可以看到内核dump出来的信息(包括一段”Aieee”信息或者”Oops”信息)4. 和Windows蓝屏相似原因:对于hard panic而言,最大的可能性是驱动模块的中断处理(interrupt handler)导致的,一般是因为驱动模块在中断处理程序中访问一个空指针(null pointre)。一旦发生这种情况,驱动模块就无法处理新的中断请求,最终导致系统崩溃。信息收集根据panic的状态不同,内核将记录所有在系统锁定之前的信息。因为kenrel panic是一种很严重的错误,不能确定系统能记录多少信息,下面是一些需要收集的关键信息,他们非常重要,因此尽可能收集全,当然如果系统启动的时候就kernel panic,那就无法只知道能收集到多少有用的信息了。1. /var/log/messages:幸运的时候,整个kernel panic栈跟踪信息都能记录在这里。2. 应用程序/库

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 工作计划

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号