LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1048|回复: 9

unable to open initial console

[复制链接]
发表于 2008-6-3 22:15:08 | 显示全部楼层 |阅读模式
我换硬盘,把原来的硬盘tar备份,然后弄到新硬盘上,启动的时候出现上面的错误。
/dev下面有console。这是什么原因呢?

********这样解决的***********

http://www.gentoo.org/doc/en/udev-guide.xml

第3部分
To see which devices nodes are present before the /dev filesystem is mounted, run the following commands:

Code Listing 3.1: Listing device nodes available at boot

# mkdir test
# mount --bind / test
# cd test/dev
# ls

The devices needed for a successful boot are /dev/null and /dev/console. If they didn't show up in the previous test, you have to create them manually. Issue the following commands in the test/dev/ directory:

Code Listing 3.2: Creating necessary device node files

# mknod -m 660 console c 5 1
# mknod -m 660 null c 1 3

When you're finished, don't forget to unmount the test/ directory:

Code Listing 3.3: Unmounting the test/ directory

# cd ../..
# umount test
# rmdir test
 楼主| 发表于 2008-6-4 17:56:59 | 显示全部楼层
http://forums.gentoo.org/viewtopic-t-640316.html

他和我是一样的问题,不知道怎么解决这个事情
回复 支持 反对

使用道具 举报

发表于 2008-6-4 21:39:10 | 显示全部楼层
重新生成/dev/console不知是否可以

  1. #rm -vi /dev/{console,null}
  2. #mknod -m 660 console c 5 1
  3. #mknod -m 660 null c 1 3
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-6-4 23:53:55 | 显示全部楼层
Post by Blahster;1859119
重新生成/dev/console不知是否可以

  1. #rm -vi /dev/{console,null}
  2. #mknod -m 660 console c 5 1
  3. #mknod -m 660 null c 1 3
复制代码


已经用过这个办法了。一样。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-6-5 09:59:35 | 显示全部楼层
在/usr/src/linux/init/main.c里面有这个。
    if (sys_open((const char __user *) "/dev/console", O_RDWR, 0)  0)
        printk(KERN_WARNING "Warning: unable to open an initial console.\n");
我在之前把/dev/console的值打印出来,是一个看起来正常的值。c70xxxx什么的。那么sys_open无法打开设备是什么原因呢?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-6-5 10:03:43 | 显示全部楼层
哦,今天晚上回家试一试把sys_open的返回值打印出来看看。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-6-6 00:11:22 | 显示全部楼层
使用printk,一直跟踪到fs/namei.c里面的__link_path_walk函数出错。累了,明天继续。gdb能否直接跟踪kernel的代码呢?
回复 支持 反对

使用道具 举报

发表于 2008-6-6 13:31:53 | 显示全部楼层
kgdb..
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-7-5 22:26:03 | 显示全部楼层
很奇怪的解决了
回复 支持 反对

使用道具 举报

发表于 2008-7-7 09:17:38 | 显示全部楼层
换硬盘用clonezilla吧,这样折腾太累人
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表