LinuxSir.cn,穿越时空的Linuxsir!

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

问大家一个LFS的问题,谢谢!!!

[复制链接]
发表于 2008-2-2 11:31:08 | 显示全部楼层 |阅读模式
我在vmware安装CentOS,分了三个分区:
hda1主分区ext3类型
hda2交换分区
hda3挂载点是home,ext3

然后把hda3格式化,用来装LFS,现在做到最后一步:

cat > /etc/fstab << "EOF"
# Begin /etc/fstab

# file-system  mount-point  type   options         dump  fsck
#                                                        order

/dev/hda3      /            ext3  defaults         1     1
#                swap         swap   pri=1           0     0
proc           /proc        proc   defaults        0     0
sysfs          /sys         sysfs  defaults        0     0
devpts         /dev/pts     devpts gid=4,mode=620  0     0
shm            /dev/shm     tmpfs  defaults        0     0
# End /etc/fstab
EOF


grub> root (hd0,2)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found



我改成
grub> root (hd0,0)
grub> setup (hd0)
就好了,但是
/boot/grub/stage1好像是到宿主系统下查找,而不是在LFS下面的/boot目录下面,因为$LFS/boot/grub下面有stage1和stage2
但是如果把宿主系统的stage1去掉的话就出错了

还有这样的话用的不是hda3而是hda1,而且用的是宿主系统下的,不是LFS目录下的/dev/hda1,应该会冲突

另一个问题:
在LFS系统下面编辑/boot/grub/menu.lst
但是重启系统的话,宿主系统下面的grub.conf文件根本没有加载LFS系统的信息,LFS怎么可能会出现在启动菜单项里面???

谢谢!
祝大家新年快乐!!!
发表于 2008-2-2 15:08:27 | 显示全部楼层
即使是多個 Linux 版本,bootloader 一個就夠了,最簡單把你現在用的 CentOS 裡加入 LFS 的選項,分區路徑等配置就行了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-2-2 15:46:06 | 显示全部楼层
我试了,进不去,新手,很多东西不太懂

我原来的做法是:
#cp -rp /home /bak
#umount /dev/hda3
#rm /home
#mv /bak /home
#vi /etc/fstab        把home那行注释掉
这样hda3就从原来的系统分离出来了

#fdisk /dev/hda3
command:w
#mke2fs /dev/hda3        在空白分区上创建ext3系统

#export LFS=/mnt/lfs
#mkdir -pv $LFS
#mount -v -t ext3 /dev/hda3 $LFS

但是CHROOT到LFS后
grub> root (hd0,2)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found

/mnt/lfs/boot/grub/stage1
/mnt/lfs/boot/grub/stage2
都存在

宿主CentOS的/boot/grub/grub.conf
我改成:
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS-4 i386 (2.6.9-42.EL)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.9-42.EL ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.9-42.EL.img
title LFS 6.1.1
       root (hd0,2)
       kernel /boot/lfskernel-2.6.11.12 ro root=/dev/hda3

/etc/fstab增加一行:
/dev/hda3        /mnt/lfs                ext3    default         1 2

但是启动系统的时候,进入菜单选择LFS 6.1.1
进不去系统,提示文件找不到
回复 支持 反对

使用道具 举报

发表于 2008-2-2 16:01:35 | 显示全部楼层
Post by gylin1982;1813631
我试了,进不去,新手,很多东西不太懂

我原来的做法是:
#cp -rp /home /bak
#umount /dev/hda3
#rm /home
#mv /bak /home
#vi /etc/fstab        把home那行注释掉
这样hda3就从原来的系统分离出来了

#fdisk /dev/hda3
command:w
#mke2fs /dev/hda3        在空白分区上创建ext3系统

#export LFS=/mnt/lfs
#mkdir -pv $LFS
#mount -v -t ext3 /dev/hda3 $LFS

但是CHROOT到LFS后
grub> root (hd0,2)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found

/mnt/lfs/boot/grub/stage1
/mnt/lfs/boot/grub/stage2
都存在

宿主CentOS的/boot/grub/grub.conf
我改成:
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS-4 i386 (2.6.9-42.EL)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.9-42.EL ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.9-42.EL.img
title LFS 6.1.1
       root (hd0,2)
       kernel /boot/lfskernel-2.6.11.12 ro root=/dev/hda3

/etc/fstab增加一行:
/dev/hda3        /mnt/lfs                ext3    default         1 2

但是启动系统的时候,进入菜单选择LFS 6.1.1
进不去系统,提示文件找不到
什麼文件找不到?

錯誤信息是?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-2-2 16:13:30 | 显示全部楼层
就是菜单刚选择lfs 6.1.1的时候
提示文件找不到,就一句话,
应该是找不到
title LFS 6.1.1
root (hd0,2)
kernel /boot/lfskernel-2.6.11.12 ro root=/dev/hda3
中的内核文件

因为我在宿主df的时候看不到hda3了
可能识别不了设备
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-2-2 16:17:24 | 显示全部楼层
[root@localhost ~]# df
Filesystem             1K-?        ??     ?? ??% ???
/dev/hda1             13986148   3838912   9436764  29% /
none                     79268         0     79268   0% /dev/shm
/dev/hdc               2266932   2266932         0 100% /media/cdrom
回复 支持 反对

使用道具 举报

发表于 2008-2-2 16:27:25 | 显示全部楼层
Post by gylin1982;1813646
就是菜单刚选择lfs 6.1.1的时候
提示文件找不到,就一句话,
应该是找不到
title LFS 6.1.1
root (hd0,2)
kernel /boot/lfskernel-2.6.11.12 ro root=/dev/hda3
中的内核文件

因为我在宿主df的时候看不到hda3了
可能识别不了设备
那是一句什麼話呢?

Bootloader 啟動時跟宿主系統是沒有關係的

你把分區佈置說明一下吧(fdisk -l 的輸出結果)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-2-2 17:36:05 | 显示全部楼层
[root@localhost /]# fdisk -l

Disk /dev/hda: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1769    14209461   83  Linux
/dev/hda2            1770        1834      522112+  82  Linux swap
/dev/hda3            1835        2088     2040255   83  Linux
----------------------------------------------------------------------------------------------
[root@localhost /]# cat /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
#LABEL=/home             /home                   ext3    defaults        1 2
/dev/hda3               /mnt/lfs                ext3    default         1 2
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=SWAP-hda2         swap                    swap    defaults        0 0
/dev/hdc                /media/cdrom            auto    pamconsole,fscontext=system_ubject_r:removable_t,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,fscontext=system_ubject_r:removable_t,exec,noauto,managed 0 0
---------------------------------------------------------------------------------------------------
[root@localhost /]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/hda1
#          initrd /boot/initrd-version.img
#boot=/dev/hda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS-4 i386 (2.6.9-42.EL)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.9-42.EL ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.9-42.EL.img
title LFS 6.1.1
        root (hd0,2)
        kernel /boot/lfskernel-2.6.11.12 ro root=/dev/hda3
-------------------------------------------------------------------------------------------------
Booting 'LFS 6.1.1'

root (hd0,2)
Filesystem type is ext2fs,partition type 0x83
kernel /boot/lfskernel-2.6.11.12 ro root=/dev/hda3

Error 15: File not found
Press any key to continue...
回复 支持 反对

使用道具 举报

发表于 2008-2-2 22:37:28 | 显示全部楼层
root (hd0,2)
=>
root (hd0,0)

试试
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-2-3 13:36:48 | 显示全部楼层
root (hd0,0)
应该不行吧,因为用fdisk -l命令能看到hda3分区,而且我的lfs在hda3,不是在hda1
而且在grub< 输入root (hd0,0),去查找的是宿主系统的stage1和stage2
回复 支持 反对

使用道具 举报

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

本版积分规则

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