无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
查看: 8938|回复: 38
打印 上一主题 下一主题

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

[复制链接]
跳转到指定楼层
1#
发表于 2017-3-20 10:32:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 carpho 于 2017-3-20 10:32 编辑

教程贴在这里

http://bbs.wuyou.net/forum.php?m ... &extra=page%3D1

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


grub2efi的配置如下


启动后出错的图片


LINUX分区图片


最后我尝试更换系统 换16.10 也不能正常启动。同样的问题,我感觉是引导可能出了问题,但不知道怎么解决 求大神……
推荐
 楼主| 发表于 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系统内还需要怎么操作么

点评

应该没有问题。  详情 回复 发表于 2017-3-20 19:27
应该没有问题。  详情 回复 发表于 2017-3-20 19:27
回复

使用道具 举报

2#
 楼主| 发表于 2017-3-20 10:33:24 | 只看该作者
用的系统是 ubuntukylin-16.04-desktop-i386.iso
回复

使用道具 举报

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

使用道具 举报

4#
 楼主| 发表于 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 这个是怎么操作的呢?

点评

/host是启动过程中创建的,如果原来不存在的话。在VirtualBox中启动不会执行创建/host命令的。  详情 回复 发表于 2017-3-20 18:48
回复

使用道具 举报

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


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

使用道具 举报

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

应该没有问题。
回复

使用道具 举报

8#
发表于 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来引导。
回复

使用道具 举报

9#
 楼主| 发表于 2017-3-20 19:40:42 | 只看该作者
2011niumao 发表于 2017-3-20 19:27
应该没有问题。也可以下载制作好的initrd.img  和vmlinuz来引导。

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

使用道具 举报

10#
 楼主| 发表于 2017-3-20 20:38:41 | 只看该作者
2011niumao 发表于 2017-3-20 19:27
应该没有问题。也可以下载制作好的initrd.img  和vmlinuz来引导。



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



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

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

使用道具 举报

11#
发表于 2017-3-20 21:59:40 | 只看该作者
感觉这次引导没有进入kloop那一段代码。
你检查local文件里面修改的段落看看。
是不是没有加入 if  fi 跳过原来的引导代码呢。
回复

使用道具 举报

12#
发表于 2017-3-20 22:02:33 | 只看该作者
另外贴一下修改的local文件里面的代码看看。
回复

使用道具 举报

13#
 楼主| 发表于 2017-3-20 22:20:32 | 只看该作者
2011niumao 发表于 2017-3-20 22:02
另外贴一下修改的local文件里面的代码看看。

无标题文档 1.7z (3.13 KB, 下载次数: 7)



点评

就是删除那些 export 语句和它前面的语句。后面段落里面仍然使用小写参数。  详情 回复 发表于 2017-3-20 22:42
这个版本的,可能有问题。请按照附件修改。或者  详情 回复 发表于 2017-3-20 22:40
回复

使用道具 举报

14#
发表于 2017-3-20 22:40:33 | 只看该作者

local.zip (2.96 KB, 下载次数: 1)

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

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

  5.         ### reset the value of the root variable
  6.         HOSTDEV="${ROOT}"
  7.         NEWROOT="${rootmnt}"
  8.        
  9.         ###  auto probe the fs-type of the partition in which dir-root live and mount it  /host
  10.         mkdir -p /host
  11.         if [ -e $NEWROOT$upperdir ]; then
  12.                 mount --move  $NEWROOT  /host
  13.         else
  14.                 if [ -z "$hostfstype" ]; then
  15.                         hostfstype="$(blkid -s TYPE -o value "${HOSTDEV}")"
  16.                         [ -z "$hostfstype"  -o "${hostfstype}" = "ntfs" ] && hostfstype="ntfs-3g"
  17.                 fi
  18.                 [ "${hostfstype}" = "ntfs-3g" ] || modprobe ${hostfstype}
  19.                 mount -t ${hostfstype} -o rw  ${HOSTDEV}  /host
  20.         fi
  21.        
  22.         ###try to boot from dir-root
  23.         modprobe overlay
  24.         if [ -z "$lowerdir" ]; then
  25.         mkdir  /run/lowerdir
  26.         lowerdir="/run/lowerdir"
  27.         fi       
  28.         mount  -t overlay overlay -o lowerdir=$lowerdir,upperdir=/host$upperdir,workdir=/host$workdir $NEWROOT

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

  35. if [ -n "$squashfs" ];  then

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

  39.         ###  auto probe the fs-type of the partition in which sfs-file live and mount it  /host
  40.         if [ -e $NEWROOT$squashfs ]; then
  41.                 mount --move  $NEWROOT  /host
  42.         else
  43.                 if [ -z "$hostfstype" ]; then
  44.                         hostfstype="$(blkid -s TYPE -o value "${HOSTDEV}")"
  45.                         [ -z "$hostfstype"  -o "${hostfstype}" = "ntfs" ] && hostfstype="ntfs-3g"
  46.                 fi
  47.                 [ "${hostfstype}" = "ntfs-3g" ] || modprobe ${hostfstype}
  48.                 mount -t ${hostfstype} -o rw  ${HOSTDEV}  /host
  49.         fi
  50.        
  51.         ###try to boot from squashfs
  52.         modprobe overlay
  53.         mkdir  -p /run/lowerdir /run/upperdir  /run/workdir
  54.         mount  /host$squashfs  /run/lowerdir
  55.         mount  -t overlay overlay -o lowerdir=/run/lowerdir,upperdir=/run/upperdir,workdir=/run/workdir    $NEWROOT

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

  62. if [ -n "$kloop" ]; then

  63.         ### reset the value of the root variable
  64.         HOSTDEV="${ROOT}"
  65.         NEWROOT="${rootmnt}"
  66.         [ -n "$kroot" ] && ROOT="$kroot"
  67.         [ -n "$kroot" ] || ROOT="/dev/loop0"
  68.         export ROOT
  69.         realroot="$ROOT"

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

  81.         ### mount the vhd-file on a loop-device
  82.         if [ "${kloop#/}" !=  "${kloop}" ]; then              
  83.                 modprobe  loop  
  84.                 kpartx -av /host$kloop
  85.                 [ -e "$realroot" ] || sleep 3
  86.         fi

  87.         ### probe lvm on vhd-file
  88.         if [ -n "$klvm" ];  then
  89.                 modprobe dm-mod
  90.                 vgscan
  91.                 vgchange  -ay  $klvm
  92.                 [ -e "$realroot" ] ||  sleep 3
  93.         fi

  94.         if [ "${readonly}" = "y" ] ; then
  95.                 roflag="-r"
  96.         else
  97.                 roflag="-w"
  98.         fi
  99.          
  100.         ### mount the realroot / in vhd-file on $NEWROOT
  101.         if [ -z "${kloopfstype}" ]; then
  102.                 kloopfstype="$(blkid -s TYPE -o value "$realroot")"
  103.                 [ -z "${kloopfstype}" ] && kloopfstype="ext4"
  104.         fi
  105.         [ -e "$realroot" ] || sleep 3
  106.         mount    ${roflag} -t "${kloopfstype}"  $realroot $NEWROOT
  107.        
  108.         ### mount /host in initrd to /host of the realrootfs
  109.         if [  "${hosthidden}" != "y" ] ; then
  110.                 [ -d "${NEWROOT}"/host ] || mkdir -p ${NEWROOT}/host
  111.                 mount --move /host   ${NEWROOT}/host
  112.         fi
  113. fi

  114.         ######################################
  115.         #                                   kloop by niumao                                #
  116.         ######################################
复制代码

回复

使用道具 举报

15#
发表于 2017-3-20 22:42:57 | 只看该作者

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

使用道具 举报

16#
 楼主| 发表于 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配置文件 请大神帮我看看 自己熬夜折腾半天也没弄好 多谢多谢啦

配置文件.7z (4.43 KB, 下载次数: 3)





点评

看过。没有问题。  详情 回复 发表于 2017-3-21 08:50
回复

使用道具 举报

17#
发表于 2017-3-20 22:59:54 | 只看该作者
本帖最后由 2011niumao 于 2017-3-21 08:49 编辑

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

使用道具 举报

18#
发表于 2017-3-21 08:50:22 | 只看该作者
carpho 发表于 2017-3-20 22:50
而且我发现教程里面有个小问题

readme-ubuntu-kloop 文件里面

看过。没有问题。
回复

使用道具 举报

19#
 楼主| 发表于 2017-3-21 10:13:53 | 只看该作者
2011niumao 发表于 2017-3-21 08:50
看过。没有问题。

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

点评

一是看看有没有执行kloop那一段的代码。参数的写法必须正确。 if 条件里面要有空格,如 [ 空格 -n 空格 "$kloop"空格 ]. 二是ntfs-3g挂载时候有没有出错----这时候可能需要在windows下做一次磁盘错误 检查和修复  详情 回复 发表于 2017-3-21 10:54
回复

使用道具 举报

20#
发表于 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下做一次磁盘错误
检查和修复错误。
三,引导参数加入 rw  rootdelay=60 试试,有可能挂载后还没有准备好就
执行kpartx ,会找不到vhd 文件。或者在 local 文件里面 kpartx 命令上面加入
一行 sleep 3  让它多等一会儿。
回复

使用道具 举报

21#
 楼主| 发表于 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盘已经检查过错误 提示无错误

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

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

点评

如果没有出错信息,一般没有问题。  详情 回复 发表于 2017-3-21 12:51
回复

使用道具 举报

22#
发表于 2017-3-21 12:51:04 | 只看该作者
carpho 发表于 2017-3-21 12:36
嗯嗯 还有一种可能就是 我的NTFS-3G 是不是没有装好

原教程第73行

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

使用道具 举报

23#
 楼主| 发表于 2017-3-21 13:00:26 | 只看该作者
2011niumao 发表于 2017-3-21 10:54
一是看看有没有执行kloop那一段的代码。参数的写法必须正确。
if 条件里面要有空格,如 [ 空格 -n 空格  ...

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

  1. if search --no-floppy -f  /ubuntu/ubuntu.vhd; then
  2. menuentry "Ubuntu" --class ubuntu {
  3.         insmod gzio
  4.         insmod part_msdos
  5.         insmod part_gpt
  6.         insmod ext2
  7.         insmod ntfs
  8.         insmod probe
  9.         set vhdfile="/ubuntu/ubuntu.vhd"
  10.         set root=(hd0,1)
  11.         search --no-floppy -f --set=aabbcc  $vhdfile
  12.         set root=${aabbcc}
  13.         probe -u --set=ddeeff ${aabbcc}
  14.         linux        /ubuntu/vmlinuz root=UUID=${ddeeff}  kloop=$vhdfile  kroot=/dev/mapper/loop0p1
  15.         initrd /ubuntu/initrd.img
  16. }
  17. fi
复制代码
回复

使用道具 举报

24#
发表于 2017-3-21 13:04:23 | 只看该作者
linux语句里面,位置随意,前后空格。
回复

使用道具 举报

25#
 楼主| 发表于 2017-3-21 13:30:43 | 只看该作者
2011niumao 发表于 2017-3-21 13:04
linux语句里面,位置随意,前后空格。



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

  1. set root=(hd0,1)
复制代码


回复

使用道具 举报

26#
 楼主| 发表于 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 的代码

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

  7. ### BEGIN /etc/grub.d/00_header ###
  8. if [ -s $prefix/grubenv ]; then
  9.   set have_grubenv=true
  10.   load_env
  11. fi
  12. if [ "${next_entry}" ] ; then
  13.    set default="${next_entry}"
  14.    set next_entry=
  15.    save_env next_entry
  16.    set boot_once=true
  17. else
  18.    set default="0"
  19. fi

  20. if [ x"${feature_menuentry_id}" = xy ]; then
  21.   menuentry_id_option="--id"
  22. else
  23.   menuentry_id_option=""
  24. fi

  25. export menuentry_id_option

  26. if [ "${prev_saved_entry}" ]; then
  27.   set saved_entry="${prev_saved_entry}"
  28.   save_env saved_entry
  29.   set prev_saved_entry=
  30.   save_env prev_saved_entry
  31.   set boot_once=true
  32. fi

  33. function savedefault {
  34.   if [ -z "${boot_once}" ]; then
  35.     saved_entry="${chosen}"
  36.     save_env saved_entry
  37.   fi
  38. }
  39. function recordfail {
  40.   set recordfail=1
  41.   if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
  42. }
  43. function load_video {
  44.   if [ x$feature_all_video_module = xy ]; then
  45.     insmod all_video
  46.   else
  47.     insmod efi_gop
  48.     insmod efi_uga
  49.     insmod ieee1275_fb
  50.     insmod vbe
  51.     insmod vga
  52.     insmod video_bochs
  53.     insmod video_cirrus
  54.   fi
  55. }

  56. if [ x$feature_default_font_path = xy ] ; then
  57.    font=unicode
  58. else
  59. insmod part_msdos
  60. insmod ext2
  61. if [ x$feature_platform_search_hint = xy ]; then
  62.   search --no-floppy --fs-uuid --set=root  a72e218c-b44f-4e06-8f22-bd6180c2193e
  63. else
  64.   search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
  65. fi
  66.     font="/usr/share/grub/unicode.pf2"
  67. fi

  68. if loadfont $font ; then
  69.   set gfxmode=auto
  70.   load_video
  71.   insmod gfxterm
  72.   set locale_dir=$prefix/locale
  73.   set lang=zh_CN
  74.   insmod gettext
  75. fi
  76. terminal_output gfxterm
  77. if [ "${recordfail}" = 1 ] ; then
  78.   set timeout=30
  79. else
  80.   if [ x$feature_timeout_style = xy ] ; then
  81.     set timeout_style=menu
  82.     set timeout=10
  83.   # Fallback normal timeout code in case the timeout_style feature is
  84.   # unavailable.
  85.   else
  86.     set timeout=10
  87.   fi
  88. fi
  89. ### END /etc/grub.d/00_header ###

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

  97. ### BEGIN /etc/grub.d/10_linux ###
  98. function gfxmode {
  99.         set gfxpayload="${1}"
  100.         if [ "${1}" = "keep" ]; then
  101.                 set vt_handoff=vt.handoff=7
  102.         else
  103.                 set vt_handoff=
  104.         fi
  105. }
  106. if [ "${recordfail}" != 1 ]; then
  107.   if [ -e ${prefix}/gfxblacklist.txt ]; then
  108.     if hwmatch ${prefix}/gfxblacklist.txt 3; then
  109.       if [ ${match} = 0 ]; then
  110.         set linux_gfx_mode=keep
  111.       else
  112.         set linux_gfx_mode=text
  113.       fi
  114.     else
  115.       set linux_gfx_mode=text
  116.     fi
  117.   else
  118.     set linux_gfx_mode=keep
  119.   fi
  120. else
  121.   set linux_gfx_mode=text
  122. fi
  123. export linux_gfx_mode
  124. menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-a72e218c-b44f-4e06-8f22-bd6180c2193e' {
  125.         recordfail
  126.         load_video
  127.         gfxmode $linux_gfx_mode
  128.         insmod gzio
  129.         if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  130.         insmod part_msdos
  131.         insmod ext2
  132.         if [ x$feature_platform_search_hint = xy ]; then
  133.           search --no-floppy --fs-uuid --set=root  a72e218c-b44f-4e06-8f22-bd6180c2193e
  134.         else
  135.           search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
  136.         fi
  137.         linux        /boot/vmlinuz-4.4.0-65-generic root=UUID=a72e218c-b44f-4e06-8f22-bd6180c2193e ro  quiet splash $vt_handoff
  138.         initrd        /boot/initrd.img-4.4.0-65-generic
  139. }
  140. submenu 'Ubuntu 高级选项' $menuentry_id_option 'gnulinux-advanced-a72e218c-b44f-4e06-8f22-bd6180c2193e' {
  141.         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' {
  142.                 recordfail
  143.                 load_video
  144.                 gfxmode $linux_gfx_mode
  145.                 insmod gzio
  146.                 if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  147.                 insmod part_msdos
  148.                 insmod ext2
  149.                 if [ x$feature_platform_search_hint = xy ]; then
  150.                   search --no-floppy --fs-uuid --set=root  a72e218c-b44f-4e06-8f22-bd6180c2193e
  151.                 else
  152.                   search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
  153.                 fi
  154.                 echo        '载入 Linux 4.4.0-65-generic ...'
  155.                 linux        /boot/vmlinuz-4.4.0-65-generic root=UUID=a72e218c-b44f-4e06-8f22-bd6180c2193e ro  quiet splash $vt_handoff
  156.                 echo        '载入初始化内存盘...'
  157.                 initrd        /boot/initrd.img-4.4.0-65-generic
  158.         }
  159.         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' {
  160.                 recordfail
  161.                 load_video
  162.                 gfxmode $linux_gfx_mode
  163.                 insmod gzio
  164.                 if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  165.                 insmod part_msdos
  166.                 insmod ext2
  167.                 if [ x$feature_platform_search_hint = xy ]; then
  168.                   search --no-floppy --fs-uuid --set=root  a72e218c-b44f-4e06-8f22-bd6180c2193e
  169.                 else
  170.                   search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
  171.                 fi
  172.                 echo        '载入 Linux 4.4.0-65-generic ...'
  173.                 linux        /boot/vmlinuz-4.4.0-65-generic root=UUID=a72e218c-b44f-4e06-8f22-bd6180c2193e ro  quiet splash $vt_handoff init=/sbin/upstart
  174.                 echo        '载入初始化内存盘...'
  175.                 initrd        /boot/initrd.img-4.4.0-65-generic
  176.         }
  177.         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' {
  178.                 recordfail
  179.                 load_video
  180.                 insmod gzio
  181.                 if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  182.                 insmod part_msdos
  183.                 insmod ext2
  184.                 if [ x$feature_platform_search_hint = xy ]; then
  185.                   search --no-floppy --fs-uuid --set=root  a72e218c-b44f-4e06-8f22-bd6180c2193e
  186.                 else
  187.                   search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
  188.                 fi
  189.                 echo        '载入 Linux 4.4.0-65-generic ...'
  190.                 linux        /boot/vmlinuz-4.4.0-65-generic root=UUID=a72e218c-b44f-4e06-8f22-bd6180c2193e ro recovery nomodeset
  191.                 echo        '载入初始化内存盘...'
  192.                 initrd        /boot/initrd.img-4.4.0-65-generic
  193.         }
  194. }

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

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

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

  198. ### BEGIN /etc/grub.d/20_memtest86+ ###
  199. menuentry 'Memory test (memtest86+)' {
  200.         insmod part_msdos
  201.         insmod ext2
  202.         if [ x$feature_platform_search_hint = xy ]; then
  203.           search --no-floppy --fs-uuid --set=root  a72e218c-b44f-4e06-8f22-bd6180c2193e
  204.         else
  205.           search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
  206.         fi
  207.         knetbsd        /boot/memtest86+.elf
  208. }
  209. menuentry 'Memory test (memtest86+, serial console 115200)' {
  210.         insmod part_msdos
  211.         insmod ext2
  212.         if [ x$feature_platform_search_hint = xy ]; then
  213.           search --no-floppy --fs-uuid --set=root  a72e218c-b44f-4e06-8f22-bd6180c2193e
  214.         else
  215.           search --no-floppy --fs-uuid --set=root a72e218c-b44f-4e06-8f22-bd6180c2193e
  216.         fi
  217.         linux16        /boot/memtest86+.bin console=ttyS0,115200n8
  218. }
  219. ### END /etc/grub.d/20_memtest86+ ###

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

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

  226. ###############################William themes setup
  227. insmod gfxmenu
  228. loadfont ${prefix}/themes/ubuntu/DejaVuSans-Bold14.pf2
  229. loadfont ${prefix}/themes/ubuntu/DejaVuSans10.pf2
  230. loadfont ${prefix}/themes/ubuntu/DejaVuSans12.pf2
  231. loadfont ${prefix}/themes/ubuntu/ascii.pf2
  232. insmod png
  233. set theme=${prefix}/themes/ubuntu/grub-theme-small.txt
  234. export theme
  235. ##################################William themes setup

  236. if search --no-floppy -f  /vmlinuz; then
  237. menuentry 'UBUNTU 硬盘系统' --class ubuntu {
  238.         insmod gzio
  239.         insmod part_msdos
  240.         insmod part_gpt
  241.         insmod ext2
  242.         insmod ntfs
  243.         insmod probe
  244.         set root=(hd0,1)
  245.         search --no-floppy -f --set=aabbcc /vmlinuz
  246.         set root=${aabbcc}
  247.         probe -u --set=ddeeff ${aabbcc}
  248.         linux        /vmlinuz root=UUID=${ddeeff}  quiet splash
  249.         initrd        /initrd.img
  250. }
  251. fi

  252. if search -s -f /bootmgr; then
  253. menuentry "启动硬盘Windows7,8 " --class windows {
  254.         insmod part_msdos
  255.         insmod ntfs
  256.         insmod fat
  257.         set root=(hd0,1)
  258.         search -s -f /bootmgr
  259.         ntldr /bootmgr
  260. }
  261. fi

  262. if search -s -f /ntldr; then
  263. menuentry "启动硬盘Windowsxp" --class windows {
  264.         insmod part_msdos
  265.         insmod ntfs
  266.         insmod fat
  267.         set root=(hd0,1)
  268.         search -s -f /ntldr
  269.         ntldr /ntldr
  270. }
  271. fi

  272. if search -s -f /grldr; then
  273. menuentry "启动grub4dos" --class windows {
  274.         insmod ntfs
  275.         insmod fat
  276.         set root=(hd0,1)
  277.         search -s -f /grldr
  278.         ntldr /grldr
  279. }
  280. fi

  281. menuentry "REBOOT " --class reboot {
  282.         reboot
  283. }

  284. menuentry "HALT " --class halt {
  285.         halt
  286. }

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

  288. ### BEGIN /etc/grub.d/41_custom ###
  289. if [ -f  ${config_directory}/custom.cfg ]; then
  290.   source ${config_directory}/custom.cfg
  291. elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  292.   source $prefix/custom.cfg;
  293. fi
  294. ### END /etc/grub.d/41_custom ###
复制代码

回复

使用道具 举报

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

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

使用道具 举报

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

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

点评

从你所给的硬盘图片看。应该是 root=/dev/sdb2 .但是引导信息上是挂载 /dev/sdb3 失败。 所以你可以试试 把 linux 语句后面的 root=UUID=... 更改为 root=/dev/sdb2 看看。 因为根本没有sdb3。不知道这个 sdb3  详情 回复 发表于 2017-3-21 14:27
回复

使用道具 举报

29#
发表于 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从哪里来的。
回复

使用道具 举报

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

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

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

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

顺便问下 引导错误的日志能不能截图 或者有什么日志文件 手机拍太麻烦了

点评

root=UUID=${ddeeff} 和 root=LABEL=XXXXX 也可以试试。似乎引导参数里面,你没有使用UUID,这个比较固定。不会出错。  详情 回复 发表于 2017-3-21 14:51
一是在initramfs界面你输入命令 ls 看看有没有 host 目录。如果没有就需要 检查 local文件里面是不是丢掉了那个 mkdir -p /host 就可以看出来了. 二是initramfs界面,手工建立 /host ,mkdir -p /host 然后手工挂  详情 回复 发表于 2017-3-21 14:48
回复

使用道具 举报

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

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-4-20 11:55

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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