免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5869 | 回复: 3
打印 上一主题 下一主题

关于 kernel panic - not syncing: 的思考 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-07-15 22:35 |只看该作者 |倒序浏览
前阵也遇到了kernel panic的问题,google了好久,也没有找到最终的解决办法,

但是还是把自己总结的一些结果写出来,供大家参考!


kernel panic 出错一般会在屏幕上显示,看了下message文件、并没有相关记录。

kernel panic 主要有以下几个出错提示:

kernel panic - not syncing: Attempted to kill the idle task!
kernel panic - not syncing: killing interrupt handler!
Kernel Panic - not syncing:Attempted to kill init !

无奈之下,查看了一下 linux的源码文件,找到了相关位置

kernel/panic.c

NORET_TYPE void panic(const char * fmt, ...)
{
    static char buf[1024];
    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.c

    if (unlikely(in_interrupt()))
        panic("Aiee, killing 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 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-message slightly.
#      
#read/write causes a command error from
#      the subsystem and this causes kernel-panic


2、系统过热
如果系统过热会调用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.


3、文件系统引起

#A variety of panics and hangs with /tmp on a reiserfs  filesystem
#Any other panic, hang, or strange behavior
#
#  It turns out that there's 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 'root=' 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= 参数会没有传进去
启动时会引发panics错误。

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.img
title 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=/
        initrd /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 rebooting the machine.
         * We can't 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!  否则,键盘鼠标没有响应

[ 本帖最后由 cbs20 于 2008-7-15 22:36 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2008-07-31 12:07 |只看该作者
我刚刚碰到了一个kernel panic,看了你的帖子算是把问题找出来了,解决了

是安装ipw2200是出现的,kernel panic原因是两个内核模块接口不兼容(ipw2200 和 ieee80211)

还有啊,我的机子出现kernel panic不会自己重启啊!

论坛徽章:
0
3 [报告]
发表于 2008-07-31 12:19 |只看该作者
原帖由 xxyqiufeng 于 2008-7-31 12:07 发表
我刚刚碰到了一个kernel panic,看了你的帖子算是把问题找出来了,解决了

是安装ipw2200是出现的,kernel panic原因是两个内核模块接口不兼容(ipw2200 和 ieee80211)

还有啊,我的机子出现kernel panic不 ...


kernel panic一般不会自动重启,但是作了netdump又是另外一回事。

论坛徽章:
0
4 [报告]
发表于 2011-03-22 09:13 |只看该作者
"应该是 其中的 root=LABEL=/   没有起作用。"
不理解,“Linux内核命令行有6个环境变量”是哪6个呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP