LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: wang188

linux下无盘工作站的问题

[复制链接]
 楼主| 发表于 2006-5-31 09:15:58 | 显示全部楼层
Post by deerlux
先弄清楚几个问题:
1. 你是用的nfs的方式还是ramdisk的方式做无盘工作站
2. pxe启动分成这么几步:第一步是网卡的bootrom找dhcp服务器设置好IP地址,第二步根据此网络设置寻找tftp服务器上的启动文件,第三步根据tftp服务器上的设置加载内核及initrd的初始化程序,第四步mount root分区,启动系统init。你在1楼中出现的错误信息是在哪一步出现的?


应该是在第四步出现的,因为我看到出错中止信息前有:
RAMDISK:compressed image found at block 0
EXT2-fs waring:checktime reached, running e2fsck is recommended
VFS:Mounted root(ext2 filesystem).
Freeing unused kernel memory:152k freed
Running /linuxrc
Mounting /proc
Running dhcpcd on port 67

接着就出现我1楼所提到的故障了。
回复 支持 反对

使用道具 举报

发表于 2006-5-31 13:01:29 | 显示全部楼层
你的initrd.gz是自己做的吗?能否将其中的linuxrc发上来看看?看到你楼上的信息,觉得好象是在linuxrc中启动了dhcpd服务,而你的客户端应当不用启动此服务的,如果想要自动配置网络只需启动dhcp-client就可以了。

还有,在initrc.gz中网卡驱动有没有加载?


如果你的另外一台机子能启动没有问题而PC机启动有问题的话很可能是网卡驱动没有加载的缘故,那台能启动的机子的网卡被加载了或者编译进了内核。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-31 13:47:10 | 显示全部楼层
非常感谢楼上朋友的答复
如果驱动没编译进内核是不是就只能重新编译内核?
无盘工作站要对其进行编译内核该怎么办呢,恳请赐教,谢谢!
回复 支持 反对

使用道具 举报

发表于 2006-5-31 18:38:44 | 显示全部楼层
无盘工作站的内核一般都是在其他机子上编译的,其内核本来就是存储在远程服务器上的,每次启动的时候加载。不过看你的启动方式好象是用ramdisk的情况不是用的NFS的情况,应该不用重新编译内核。

将initrd.gz解压,将其中的linuxrc文件改一下,加一句insmod xxxx(你的网卡驱动),然后再试一下,看能不能正常启动,如果网卡的驱动没有加载的话可能会网络初始化有问题。也可以试将linuxrc中关于网络访问的部分启动代码去掉看能不能正常启动,如果能的话可以肯定是网卡驱动没有加载的问题了。

我正好前几天在搞这个东西,在一台vmware上用nfsroot的方式试成功了,遇到了不少麻烦,也学到了不少东西,所以看你在这里问问题比较感兴趣。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-31 22:48:15 | 显示全部楼层
谢谢,那我还真是幸运,遇到您这样的高手
我的问题又来了,initrd.gz解压缩是不是使用tar zxvf initrd.gz命令,还是gunzip initrd.gz
?前者好像没又什么变化,后者出来个initrd文件,但是原来的initrd.gz文件就没了
不知应该怎么办呢?
我也尝试过重新编译内核bzImage,但也没用,难道是因为thinclient 上有闪存而PC机没有的缘故?root=/dev/ram0 这句是不是适用PC上?
回复 支持 反对

使用道具 举报

发表于 2006-6-1 00:28:15 | 显示全部楼层
用gunzip解压,解压后initrd.gz就没有了只剩下initrd,用file initrd命令看一下这个文件是个什么文件。

我用过2.4内核的RHEL AS3,2.6内核的RHELAS4和Debian Etch,2.4内核的未压缩的initrd就是一个ext2的文件系统镜像,2.6的内核用是的cpio的包。

对于disk image的情况,你可以用mount命令将其mount到一个目录下直接进行操作
  1. mount -o loop initrd /mount_point_path
  2. cd /mount_point_path
  3. vi linuxrc
  4. umount /mount_point_path
复制代码
看一下linuxrc的内容。

对于是cpio档的情况,要将其解包后再进行操作,然后再打包:
  1. cpio -i < initrd #解包到一个新的目录
  2. vi linuxrc
  3. ls | cpio -ov --format newc > initrd
复制代码

修改其中的linuxrc后再将其用gzip -9 压缩,如果你知道了网卡驱动可以试试将你的网卡驱动拷贝到那个包中的/lib/modules/2.xxxxx/相应的目录下然后在linuxrc中加一句insmod试试。

建议你看一下关于linux启动过程的资料,然后再搞可能会清楚一些,还有这个论坛的mini linux和lfs两个版面高手比较多,到那里去问可能收获大一些,我只搞过nfsroot的无盘工作站,经验比较少。
回复 支持 反对

使用道具 举报

发表于 2006-6-1 00:28:18 | 显示全部楼层
用gunzip解压,解压后initrd.gz就没有了只剩下initrd,用file initrd命令看一下这个文件是个什么文件。

我用过2.4内核的RHEL AS3,2.6内核的RHELAS4和Debian Etch,2.4内核的未压缩的initrd就是一个ext2的文件系统镜像,2.6的内核用是的cpio的包。

对于disk image的情况,你可以用mount命令将其mount到一个目录下直接进行操作
  1. mount -o loop initrd /mount_point_path
  2. cd /mount_point_path
  3. vi linuxrc
  4. umount /mount_point_path
复制代码
看一下linuxrc的内容。

对于是cpio档的情况,要将其解包后再进行操作,然后再打包:
  1. cpio -i < initrd #解包到一个新的目录
  2. vi linuxrc
  3. ls | cpio -ov --format newc > initrd
复制代码

修改其中的linuxrc后再将其用gzip -9 压缩,如果你知道了网卡驱动可以试试将你的网卡驱动拷贝到那个包中的/lib/modules/2.xxxxx/相应的目录下然后在linuxrc中加一句insmod试试。

建议你看一下关于linux启动过程的资料,然后再搞可能会清楚一些,还有这个论坛的mini linux和lfs两个版面高手比较多,到那里去问可能收获大一些,我只搞过nfsroot的无盘工作站,经验比较少。
回复 支持 反对

使用道具 举报

发表于 2006-6-1 00:37:14 | 显示全部楼层
Post by wang188
谢谢,那我还真是幸运,遇到您这样的高手
我的问题又来了,initrd.gz解压缩是不是使用tar zxvf initrd.gz命令,还是gunzip initrd.gz
?前者好像没又什么变化,后者出来个initrd文件,但是原来的initrd.gz文件就没了
不知应该怎么办呢?
我也尝试过重新编译内核bzImage,但也没用,难道是因为thinclient 上有闪存而PC机没有的缘故?root=/dev/ram0 这句是不是适用PC上?

不好意思刚才不小心点了两次回复,再问你两个问题:
1.你重新编译内核后有没有将你的客户端的网卡驱动编译进内核?是编译进内核而不是编译成module
2. 你的那个initrd.gz文件是怎么来的,是自己做的还是随便拷贝一个系统的?

root=/dev/ram0参数对PC机应该是支持的,不过我没有用过。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-1 09:27:08 | 显示全部楼层
原先的环境包括initrd.gz 都是德国的程序员帮我们做的,应该不是随便拷的,我是新手,非常感谢您不厌其烦地解答

我把initrd.gz解压加载了,现在把linuxrc发上来麻烦您帮我看看

  1. #!/bin/sh

  2. echo "==============================================================================="
  3. echo "Running /linuxrc"

  4. echo "Mounting /proc"
  5. mount -t proc /proc /proc


  6. # exec /bin/sh


  7. #
  8. # dhcpcd runs as a daemon.  Once it acquires the info from the
  9. # server, it will automatically configure the interface.  A script called
  10. # /etc/dhcpc/dhcpcd.exe is used to perform additional configuration.
  11. #

  12. DPORT=67

  13. echo "Running dhcpcd on port ${DPORT}"
  14. /bin/dhcpcd -p ${DPORT} eth0 >/tmp/dhcpcd.out 2>&1
  15. if [ $? -ne 0 ]; then
  16.     echo
  17.     cat /tmp/dhcpcd.out
  18.     echo
  19.     echo "ERROR! dhcpcd failed!"
  20.     echo
  21.     exit 1
  22. fi

  23. #
  24. # The dhcpcd program deposited a bunch of important
  25. # information in the /etc/dhcpc/dhcpcd-eth0.info file.
  26. # Sourcing the file will set a bunch of environment variables.
  27. #

  28. #
  29. # On a slow machine, the dhclient program might fork and return
  30. # control to the /linuxrc script, before the info file gets written.
  31. #

  32. COUNT=5
  33. while [ $COUNT -gt 0 -a ! -f /etc/dhcpc/dhcpcd-eth0.info ]; do
  34.     sleep 1
  35.     COUNT=`expr $COUNT - 1`
  36. done

  37. if [ ! -f /etc/dhcpc/dhcpcd-eth0.info ]; then
  38.     echo
  39.     echo "ERROR!  No dhcpcd-eth0.info file."
  40.     echo "        This usually indicates that dhcpcd did not get"
  41.     echo "        a response from the DHCP server, or the NIC driver"
  42.     echo "        isn't working properly with the network card"
  43.     echo
  44.     exit 1
  45. fi

  46. . /etc/dhcpc/dhcpcd-eth0.info

  47. #
  48. # Check for a root-path from the dhcp server
  49. #
  50. if [ -z "${ROOTPATH}" ]; then
  51.     echo
  52.     echo "ERROR!  No root-path.  Check your DHCP configuration, to make"
  53.     echo "        sure that the 'option root-path' is specified"
  54.     echo
  55.     exit 1
  56. fi

  57. NFS_IP=` echo ${ROOTPATH} | cut -d : -f 1`
  58. NFS_DIR=`echo ${ROOTPATH} | cut -d : -f 2`

  59. if [ "${NFS_IP}" = "${NFS_DIR}" ]; then
  60.     #
  61.     # Only the root directory is specified, then we have to use the
  62.     # default IP address.  For now, we'll use the DHCP server address
  63.     #
  64.     NFS_IP=${DHCPSERVER}
  65. fi

  66. echo "Mounting root filesystem: ${NFS_DIR} from: ${NFS_IP}"
  67. mount -n -o nolock,ro ${NFS_IP}:${NFS_DIR} /mnt
  68. if [ $? -ne 0 ]; then
  69.     echo
  70.     echo "ERROR!  Failed to mount the root directory via NFS!"
  71.     echo "        Possible reasons include:"
  72.     echo
  73.     echo "        1) NFS services may not be running on the server"
  74.     echo "        2) Workstation IP does not map to a hostname, either"
  75.     echo "           in /etc/hosts, or in DNS"
  76.     echo "        3) Wrong address for NFS server in the DHCP config file"
  77.     echo "        4) Wrong pathname for root directory in the DHCP config file"
  78.     echo
  79.     exit 1
  80. fi

  81. umount /proc

  82. echo "Doing the pivot_root"
  83. cd /mnt
  84. /sbin/pivot_root . oldroot
  85. cd /

  86. echo "Running /sbin/init"
  87. exec /sbin/init
复制代码
回复 支持 反对

使用道具 举报

发表于 2006-6-1 13:11:53 | 显示全部楼层
你方不方便把你的整个initrd.gz都发给我。我的邮箱:deerlux at gmail.com

看这个linuxrc的内容应该是nfsroot的方式做得无盘工作站,但不是用的kernel级的nfsroot支持,而是通过initrd变成nfsroot的,你启动的时候问题出在这一行:
  1. /bin/dhcpcd -p ${DPORT} eth0 >/tmp/dhcpcd.out 2>&1
复制代码
,你再确认一下你的客户端网卡是什么型号?将你的网卡驱动拷贝到那个initrd的/lib/modules/2.xxx/kernel/drivers/net/目录下,然后在linuxrc的第一行加入一句
  1. modprobe xxxx
复制代码
xxxx为你的网卡驱动。

再有问题的话告诉我你的内核的版本、客户端网卡型号,如果方便 的话把你的内核包(包括所有的modules)及initrd.gz发给我,我看一下。
回复 支持 反对

使用道具 举报

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

本版积分规则

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