carpho 发表于 2017-3-20 10:32:01

按照2011niumao的帖子,一步一步做出来之后,引导失败,求教

本帖最后由 carpho 于 2017-3-20 10:32 编辑

教程贴在这里

http://bbs.wuyou.net/forum.php?mod=viewthread&tid=276747&extra=page%3D1

按照论坛大神2011niumao给出的附件 mydracut.zip ,下载后一步一步用kloop的方法做,最后把2个生成文件和VHD文件放在了一个目录下


grub2efi的配置如下


启动后出错的图片


LINUX分区图片


最后我尝试更换系统 换16.10 也不能正常启动。同样的问题,我感觉是引导可能出了问题,但不知道怎么解决 求大神……

carpho 发表于 2017-3-20 19:16:07

2011niumao 发表于 2017-3-20 18:48
/host是启动过程中创建的,如果原来不存在的话。在VirtualBox中启动不会执行创建/host命令的。
可以看 ...

那linux中就把initrd.img和vmlinux 两个文件拷贝出来 然后在引导菜单里面设置引导就可以了吧 这次安装我没有用LVM 固定vhd 64位系统 试一试 看下有木有问题……第一个分区是根分区 那我KROOT就设置kroot=/dev/mapper/loop0p1 就对了吧其他的地方在LINUX系统内还需要怎么操作么

carpho 发表于 2017-3-20 10:33:24

用的系统是 ubuntukylin-16.04-desktop-i386.iso

2011niumao 发表于 2017-3-20 18:17:52

有这么几点。第一,必须是固定大小vhd,图片显示的信息像是动态大小vhd,有使用动态vhd的网友发过类似的出错信息。
第二,不知道你有没有使用逻辑卷,lvm 。如果使用了逻辑卷,启动参数需要有 klvm=vg名称 。
如没有使用逻辑卷,那么从你的分区看,应该是kroot=/dev/mapper/loop0p5
第三,efi启动,应该以64位ubuntu为好吧,不知道32位是不是也能efi启动。

carpho 发表于 2017-3-20 18:36:58

2011niumao 发表于 2017-3-20 18:17
有这么几点。第一,必须是固定大小vhd,图片显示的信息像是动态大小vhd,有使用动态vhd的网友发过类似的出 ...

我使用的固定大小的VHD,第一次好像开了LVM,出错后我第二次安装就把LVM关闭了 我正在试64ubuntu 如果有问题还得麻烦你啊 对咯 我用了你的usb_small.vhd 根目录下面有个/host 启动后可以看到C盘的文件 可是我在virtualbox里面加载我自己的VHD 就没有这个/HOST 这个是怎么操作的呢?

2011niumao 发表于 2017-3-20 18:48:43

carpho 发表于 2017-3-20 18:36
我使用的固定大小的VHD,第一次好像开了LVM,出错后我第二次安装就把LVM关闭了 我正在试64ubuntu 如果有 ...

/host是启动过程中创建的,如果原来不存在的话。在VirtualBox中启动不会执行创建/host命令的。
可以看看 local文件里面的代码。

2011niumao 发表于 2017-3-20 19:27:00

carpho 发表于 2017-3-20 19:16
那linux中就把initrd.img和vmlinux 两个文件拷贝出来 然后在引导菜单里面设置引导就可以了吧 这次安装我 ...

应该没有问题。

2011niumao 发表于 2017-3-20 19:27:01

本帖最后由 2011niumao 于 2017-3-20 19:28 编辑

carpho 发表于 2017-3-20 19:16
那linux中就把initrd.img和vmlinux 两个文件拷贝出来 然后在引导菜单里面设置引导就可以了吧 这次安装我 ...

应该没有问题。也可以下载制作好的initrd.img和vmlinuz来引导。

carpho 发表于 2017-3-20 19:40:42

2011niumao 发表于 2017-3-20 19:27
应该没有问题。也可以下载制作好的initrd.img和vmlinuz来引导。

16.10 的 initrd.img和 vmlinuz 好像网上没有 求大神该抽空做出来一个 哈哈哈 正在装 这次试一试…… 有问题再问您

carpho 发表于 2017-3-20 20:38:41

2011niumao 发表于 2017-3-20 19:27
应该没有问题。也可以下载制作好的initrd.img和vmlinuz来引导。



还是一样的错误 我也知不道为啥



难道是内核的问题?系统里面我都是按照KLOOP-ubuntu 做的啊

这次我用的是 16.10 64位的ubuntu系统

2011niumao 发表于 2017-3-20 21:59:40

感觉这次引导没有进入kloop那一段代码。
你检查local文件里面修改的段落看看。
是不是没有加入 iffi 跳过原来的引导代码呢。

2011niumao 发表于 2017-3-20 22:02:33

另外贴一下修改的local文件里面的代码看看。

carpho 发表于 2017-3-20 22:20:32

2011niumao 发表于 2017-3-20 22:02
另外贴一下修改的local文件里面的代码看看。





2011niumao 发表于 2017-3-20 22:40:33

carpho 发表于 2017-3-20 22:20




这个版本的,可能有问题。请按照附件修改。或者
        ######################################
        #                                 kloop by niumao                              #
        ######################################

if [ -n "$upperdir" ] && [ -n "$workdir" ];then

        ### reset the value of the root variable
        HOSTDEV="${ROOT}"
        NEWROOT="${rootmnt}"
       
        ###auto probe the fs-type of the partition in which dir-root live and mount it/host
        mkdir -p /host
        if [ -e $NEWROOT$upperdir ]; then
                mount --move$NEWROOT/host
        else
                if [ -z "$hostfstype" ]; then
                        hostfstype="$(blkid -s TYPE -o value "${HOSTDEV}")"
                        [ -z "$hostfstype"-o "${hostfstype}" = "ntfs" ] && hostfstype="ntfs-3g"
                fi
                [ "${hostfstype}" = "ntfs-3g" ] || modprobe ${hostfstype}
                mount -t ${hostfstype} -o rw${HOSTDEV}/host
        fi
       
        ###try to boot from dir-root
        modprobe overlay
        if [ -z "$lowerdir" ]; then
        mkdir/run/lowerdir
        lowerdir="/run/lowerdir"
        fi       
        mount-t overlay overlay -o lowerdir=$lowerdir,upperdir=/host$upperdir,workdir=/host$workdir $NEWROOT

        ### mount /host in initrd to /host of the realrootfs
        if ["${hosthidden}" != "y" ] ; then
                [ -d "${NEWROOT}"/host ] || mkdir -p ${NEWROOT}/host
                mount --move /host   ${NEWROOT}/host
        fi
fi       

if [ -n "$squashfs" ];then

        ### reset the value of the root variable
        HOSTDEV="${ROOT}"
        NEWROOT="${rootmnt}"

        ###auto probe the fs-type of the partition in which sfs-file live and mount it/host
        if [ -e $NEWROOT$squashfs ]; then
                mount --move$NEWROOT/host
        else
                if [ -z "$hostfstype" ]; then
                        hostfstype="$(blkid -s TYPE -o value "${HOSTDEV}")"
                        [ -z "$hostfstype"-o "${hostfstype}" = "ntfs" ] && hostfstype="ntfs-3g"
                fi
                [ "${hostfstype}" = "ntfs-3g" ] || modprobe ${hostfstype}
                mount -t ${hostfstype} -o rw${HOSTDEV}/host
        fi
       
        ###try to boot from squashfs
        modprobe overlay
        mkdir-p /run/lowerdir /run/upperdir/run/workdir
        mount/host$squashfs/run/lowerdir
        mount-t overlay overlay -o lowerdir=/run/lowerdir,upperdir=/run/upperdir,workdir=/run/workdir    $NEWROOT

        ### mount /host in initrd to /host of the realrootfs
        if ["${hosthidden}" != "y" ] ; then
                [ -d "${NEWROOT}"/host ] || mkdir -p ${NEWROOT}/host
                mount --move /host   ${NEWROOT}/host
        fi
fi       

if [ -n "$kloop" ]; then

        ### reset the value of the root variable
        HOSTDEV="${ROOT}"
        NEWROOT="${rootmnt}"
        [ -n "$kroot" ] && ROOT="$kroot"
        [ -n "$kroot" ] || ROOT="/dev/loop0"
        export ROOT
        realroot="$ROOT"

        ###auto probe the fs-type of the partition in which vhd-file live and mount it/host
        if [ -e $NEWROOT$kloop ]; then
                mount --move$NEWROOT/host
        else
                if [ -z "$hostfstype" ]; then
                        hostfstype="$(blkid -s TYPE -o value "${HOSTDEV}")"
                        [ -z "$hostfstype"-o "${hostfstype}" = "ntfs" ] && hostfstype="ntfs-3g"
                fi
                [ "${hostfstype}" = "ntfs-3g" ] || modprobe ${hostfstype}
                mount -t ${hostfstype} -o rw${HOSTDEV}/host
        fi

        ### mount the vhd-file on a loop-device
        if [ "${kloop#/}" !="${kloop}" ]; then              
                modprobeloop
                kpartx -av /host$kloop
                [ -e "$realroot" ] || sleep 3
        fi

        ### probe lvm on vhd-file
        if [ -n "$klvm" ];then
                modprobe dm-mod
                vgscan
                vgchange-ay$klvm
                [ -e "$realroot" ] ||sleep 3
        fi

        if [ "${readonly}" = "y" ] ; then
                roflag="-r"
        else
                roflag="-w"
        fi
       
        ### mount the realroot / in vhd-file on $NEWROOT
        if [ -z "${kloopfstype}" ]; then
                kloopfstype="$(blkid -s TYPE -o value "$realroot")"
                [ -z "${kloopfstype}" ] && kloopfstype="ext4"
        fi
        [ -e "$realroot" ] || sleep 3
        mount    ${roflag} -t "${kloopfstype}"$realroot $NEWROOT
       
        ### mount /host in initrd to /host of the realrootfs
        if ["${hosthidden}" != "y" ] ; then
                [ -d "${NEWROOT}"/host ] || mkdir -p ${NEWROOT}/host
                mount --move /host   ${NEWROOT}/host
        fi
fi

        ######################################
        #                                 kloop by niumao                              #
        ######################################

2011niumao 发表于 2017-3-20 22:42:57

carpho 发表于 2017-3-20 22:20


就是删除那些 export 语句和它前面的语句。后面段落里面仍然使用小写参数。

carpho 发表于 2017-3-20 22:50:44

2011niumao 发表于 2017-3-20 22:02
另外贴一下修改的local文件里面的代码看看。

而且我发现教程里面有个小问题

readme-ubuntu-kloop 文件里面

第18-20行

3-0 修改init文件

sudo gedit /usr/share/initram-tools/init

我在16.10 64位系统下发现该文件是空的

我手动改成 sudo gedit /usr/share/initramfs-tools/init

才出来教程上的那个文件 是不是这个也有影响……

还有ntfs-3g的文件是否有影响……

以下是我的linux配置文件 请大神帮我看看 自己熬夜折腾半天也没弄好 多谢多谢啦







2011niumao 发表于 2017-3-20 22:59:54

本帖最后由 2011niumao 于 2017-3-21 08:49 编辑

看来有不少路径写错,笔误了。init文件你修改的是对的。
ntfs-3g在scripts/local-bottom里面。

2011niumao 发表于 2017-3-21 08:50:22

carpho 发表于 2017-3-20 22:50
而且我发现教程里面有个小问题

readme-ubuntu-kloop 文件里面


看过。没有问题。

carpho 发表于 2017-3-21 10:13:53

2011niumao 发表于 2017-3-21 08:50
看过。没有问题。

我昨天又把您做的UBT_Small.vhd 拿出来研究了下,这些修改的文件仔细比对,在我电脑上 UBT_Small.vhd 可以引导成功,我换成我的Vhd 还是昨天同样的错误 语句一行一行对过 也不知道啥问题 是不是我哪里配置文件还是写的不对呢?

2011niumao 发表于 2017-3-21 10:54:54

carpho 发表于 2017-3-21 10:13
我昨天又把您做的UBT_Small.vhd 拿出来研究了下,这些修改的文件仔细比对,在我电脑上 UBT_Small.vhd 可 ...

一是看看有没有执行kloop那一段的代码。参数的写法必须正确。
if 条件里面要有空格,如 [ 空格 -n 空格 "$kloop"空格 ].
二是ntfs-3g挂载时候有没有出错----这时候可能需要在windows下做一次磁盘错误
检查和修复错误。
三,引导参数加入 rwrootdelay=60 试试,有可能挂载后还没有准备好就
执行kpartx ,会找不到vhd 文件。或者在 local 文件里面 kpartx 命令上面加入
一行 sleep 3让它多等一会儿。

carpho 发表于 2017-3-21 12:36:42

2011niumao 发表于 2017-3-21 10:54
一是看看有没有执行kloop那一段的代码。参数的写法必须正确。
if 条件里面要有空格,如 [ 空格 -n 空格...

嗯嗯 还有一种可能就是 我的NTFS-3G 是不是没有装好

原教程第73行
附件ntfs-3g_ntfsprogs-2016.2.22.fixed 是已经修改好的ntfs-3g源码.

包里面自带的那个修改好的NTFS-3G 请大神帮忙 看下 有没有最新的 这个是不是不适用我这个版本(16.10)

C盘已经检查过错误 提示无错误

您说的第三个步骤 我还在尝试……等下反馈结果给您

等我这里全部弄好了 我重新写个详细的图文教程 到时候让其他人少走些弯路 还需要您的帮忙

2011niumao 发表于 2017-3-21 12:51:04

carpho 发表于 2017-3-21 12:36
嗯嗯 还有一种可能就是 我的NTFS-3G 是不是没有装好

原教程第73行


如果没有出错信息,一般没有问题。

carpho 发表于 2017-3-21 13:00:26

2011niumao 发表于 2017-3-21 10:54
一是看看有没有执行kloop那一段的代码。参数的写法必须正确。
if 条件里面要有空格,如 [ 空格 -n 空格...

引导参数 加在引导设置的哪里呢

if search --no-floppy -f/ubuntu/ubuntu.vhd; then
menuentry "Ubuntu" --class ubuntu {
        insmod gzio
        insmod part_msdos
        insmod part_gpt
        insmod ext2
        insmod ntfs
        insmod probe
        set vhdfile="/ubuntu/ubuntu.vhd"
        set root=(hd0,1)
        search --no-floppy -f --set=aabbcc$vhdfile
        set root=${aabbcc}
        probe -u --set=ddeeff ${aabbcc}
        linux        /ubuntu/vmlinuz root=UUID=${ddeeff}kloop=$vhdfilekroot=/dev/mapper/loop0p1
        initrd /ubuntu/initrd.img
}
fi

2011niumao 发表于 2017-3-21 13:04:23

linux语句里面,位置随意,前后空格。

carpho 发表于 2017-3-21 13:30:43

2011niumao 发表于 2017-3-21 13:04
linux语句里面,位置随意,前后空格。



还是同样的错误,有个问题是引导设置中,下面这行代码的设置是什么意思,会不会有影响

set root=(hd0,1)

carpho 发表于 2017-3-21 13:42:24

2011niumao 发表于 2017-3-21 13:04
linux语句里面,位置随意,前后空格。

还有几个问题
1. 是不是制作好的initrd.img需要复制到/boot里面,删除里面自带的initrd.img

2. 我看您做的UBT_Small.vhd中 /boot/grub.cfg里面还有引导代码,我的是不是也需要写这些引导代码呢

3. 我使用的是U盘引导 同样的引导代码 引导UBT_Small.vhd ,同样的文件夹、放置从您的百度云下载的 vmlinux 和 initrd.img 引导没有问题

我觉得问题可能就出在 initrd.img 文件上了

附上 UBT_Small.vhd 中 grub.cfg 的代码

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
fi
}
function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
    insmod all_video
else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=roota72e218c-b44f-4e06-8f22-bd6180c2193e
else
search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=zh_CN
insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
set timeout=30
else
if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=10
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
    set timeout=10
fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30,0; then
clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
        set gfxpayload="${1}"
        if [ "${1}" = "keep" ]; then
                set vt_handoff=vt.handoff=7
        else
                set vt_handoff=
        fi
}
if [ "${recordfail}" != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
      set linux_gfx_mode=keep
      else
      set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
else
    set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-a72e218c-b44f-4e06-8f22-bd6180c2193e' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_msdos
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=roota72e218c-b44f-4e06-8f22-bd6180c2193e
        else
          search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
        fi
      linux        /boot/vmlinuz-4.4.0-65-generic root=UUID=a72e218c-b44f-4e06-8f22-bd6180c2193e roquiet splash $vt_handoff
        initrd        /boot/initrd.img-4.4.0-65-generic
}
submenu 'Ubuntu 高级选项' $menuentry_id_option 'gnulinux-advanced-a72e218c-b44f-4e06-8f22-bd6180c2193e' {
        menuentry 'Ubuntu,Linux 4.4.0-65-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-65-generic-advanced-a72e218c-b44f-4e06-8f22-bd6180c2193e' {
                recordfail
                load_video
                gfxmode $linux_gfx_mode
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=roota72e218c-b44f-4e06-8f22-bd6180c2193e
                else
                  search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
                fi
                echo        '载入 Linux 4.4.0-65-generic ...'
                linux        /boot/vmlinuz-4.4.0-65-generic root=UUID=a72e218c-b44f-4e06-8f22-bd6180c2193e roquiet splash $vt_handoff
                echo        '载入初始化内存盘...'
                initrd        /boot/initrd.img-4.4.0-65-generic
        }
        menuentry 'Ubuntu, with Linux 4.4.0-65-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-65-generic-init-upstart-a72e218c-b44f-4e06-8f22-bd6180c2193e' {
                recordfail
                load_video
                gfxmode $linux_gfx_mode
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=roota72e218c-b44f-4e06-8f22-bd6180c2193e
                else
                  search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
                fi
                echo        '载入 Linux 4.4.0-65-generic ...'
                linux        /boot/vmlinuz-4.4.0-65-generic root=UUID=a72e218c-b44f-4e06-8f22-bd6180c2193e roquiet splash $vt_handoff init=/sbin/upstart
                echo        '载入初始化内存盘...'
                initrd        /boot/initrd.img-4.4.0-65-generic
        }
        menuentry 'Ubuntu, with Linux 4.4.0-65-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-65-generic-recovery-a72e218c-b44f-4e06-8f22-bd6180c2193e' {
                recordfail
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=roota72e218c-b44f-4e06-8f22-bd6180c2193e
                else
                  search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
                fi
                echo        '载入 Linux 4.4.0-65-generic ...'
                linux        /boot/vmlinuz-4.4.0-65-generic root=UUID=a72e218c-b44f-4e06-8f22-bd6180c2193e ro recovery nomodeset
                echo        '载入初始化内存盘...'
                initrd        /boot/initrd.img-4.4.0-65-generic
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry 'Memory test (memtest86+)' {
        insmod part_msdos
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=roota72e218c-b44f-4e06-8f22-bd6180c2193e
        else
          search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
        fi
        knetbsd        /boot/memtest86+.elf
}
menuentry 'Memory test (memtest86+, serial console 115200)' {
        insmod part_msdos
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=roota72e218c-b44f-4e06-8f22-bd6180c2193e
        else
          search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
        fi
        linux16        /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.Simply type the
# menu entries you want to add after this comment.Be careful not to change
# the 'exec tail' line above.

###############################William themes setup
insmod gfxmenu
loadfont ${prefix}/themes/ubuntu/DejaVuSans-Bold14.pf2
loadfont ${prefix}/themes/ubuntu/DejaVuSans10.pf2
loadfont ${prefix}/themes/ubuntu/DejaVuSans12.pf2
loadfont ${prefix}/themes/ubuntu/ascii.pf2
insmod png
set theme=${prefix}/themes/ubuntu/grub-theme-small.txt
export theme
##################################William themes setup

if search --no-floppy -f/vmlinuz; then
menuentry 'UBUNTU 硬盘系统' --class ubuntu {
        insmod gzio
        insmod part_msdos
        insmod part_gpt
        insmod ext2
        insmod ntfs
        insmod probe
        set root=(hd0,1)
        search --no-floppy -f --set=aabbcc /vmlinuz
        set root=${aabbcc}
        probe -u --set=ddeeff ${aabbcc}
        linux        /vmlinuz root=UUID=${ddeeff}quiet splash
        initrd        /initrd.img
}
fi

if search -s -f /bootmgr; then
menuentry "启动硬盘Windows7,8 " --class windows {
        insmod part_msdos
        insmod ntfs
        insmod fat
        set root=(hd0,1)
        search -s -f /bootmgr
        ntldr /bootmgr
}
fi

if search -s -f /ntldr; then
menuentry "启动硬盘Windowsxp" --class windows {
        insmod part_msdos
        insmod ntfs
        insmod fat
        set root=(hd0,1)
        search -s -f /ntldr
        ntldr /ntldr
}
fi

if search -s -f /grldr; then
menuentry "启动grub4dos" --class windows {
        insmod ntfs
        insmod fat
        set root=(hd0,1)
        search -s -f /grldr
        ntldr /grldr
}
fi

menuentry "REBOOT " --class reboot {
      reboot
}

menuentry "HALT " --class halt {
      halt
}

### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f$prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

2011niumao 发表于 2017-3-21 14:16:16

引导菜单应该是对的,否则找不到initrd。找到后基本上是
initrd的事情了。
看来是ntfs-3g挂载失败了。你可在initramfs界面
手动输入挂载命令的,例如,mount -t ntfs-3g -o rw /dev/sdb3/host

另外检查一下,host目录是否存在。 输入ls 即可。

carpho 发表于 2017-3-21 14:20:00

2011niumao 发表于 2017-3-21 14:16
引导菜单应该是对的,否则找不到initrd。找到后基本上是
initrd的事情了。
看来是ntfs-3g挂载失败了。你 ...

我用了您的initrd.img 引导我自己的系统成功了 但是引导有很多错误 (failed) 但是用我自己做的initrd.img 就不行了

2011niumao 发表于 2017-3-21 14:27:16

carpho 发表于 2017-3-21 14:20
我用了您的initrd.img 引导我自己的系统成功了 但是引导有很多错误 (failed) 但是用我自己做的initrd.i ...

从你所给的硬盘图片看。应该是 root=/dev/sdb2.但是引导信息上是挂载 /dev/sdb3 失败。
所以你可以试试 把 linux 语句后面的 root=UUID=... 更改为 root=/dev/sdb2 看看。

因为根本没有sdb3。不知道这个 sdb3从哪里来的。

carpho 发表于 2017-3-21 14:39:09

2011niumao 发表于 2017-3-21 14:27
从你所给的硬盘图片看。应该是 root=/dev/sdb2.但是引导信息上是挂载 /dev/sdb3 失败。
所以你可以试 ...

再次出错…… 额我都有点无语了……

/host 根据错误提示 没有这个目录

我现在去用您的initrd.img引导 启动后 把硬盘截图发给您看看

顺便问下 引导错误的日志能不能截图 或者有什么日志文件 手机拍太麻烦了
页: [1] 2
查看完整版本: 按照2011niumao的帖子,一步一步做出来之后,引导失败,求教