Cannot add custom menu entry to GRUB2 bootloader [Solved]

Anything that pertains to Portage

Moderator: Moderators

Cannot add custom menu entry to GRUB2 bootloader [Solved]

Postby donnie » Thu Apr 22, 2010 1:26

Tried to make things correctly, instead of just manually editing /boot/grub/grub.cfg. Emerge does not help, and many many errors:

Code: Select all
emerge grub
Calculating dependencies / * ERROR: x11-themes/sabayon-artwork-core-5.2 failed:
 *   sabayon-artwork.eclass could not be found by inherit()
 *
 * Call stack:
 *                         ebuild.sh, line 1875:  Called source '/var/lib/layman/sabayon/x11-themes/sabayon-artwork-core/sabayon-artwork-core-5.2.ebuild'
 *   sabayon-artwork-core-5.2.ebuild, line    4:  Called inherit 'eutils' 'mount-boot' 'sabayon-artwork'
 *                         ebuild.sh, line 1291:  Called die
 * The specific snippet of code:
 *              [ ! -e "$location" ] && die "${1}.eclass could not be found by inherit()"
 *
 * If you need support, post the output of 'emerge --info =x11-themes/sabayon-artwork-core-5.2',
 * the complete build log and the output of 'emerge -pqv =x11-themes/sabayon-artwork-core-5.2'.
 * This ebuild is from an overlay: '/var/lib/layman/sabayon/'
 * S: '/var/tmp/portage/x11-themes/sabayon-artwork-core-5.2/work/sabayon-artwork-core-5.2'
 \ * ERROR: sys-kernel/linux-sabayon-2.6.33 failed:
 *   sabayon-artwork.eclass could not be found by inherit()
 *
 * Call stack:
 *                     ebuild.sh, line 1875:  Called source '/var/lib/layman/sabayon/sys-kernel/linux-sabayon/linux-sabayon-2.6.33.ebuild'
 *   linux-sabayon-2.6.33.ebuild, line    7:  Called inherit 'sabayon-kernel'
 *                     ebuild.sh, line 1314:  Called qa_source '/var/lib/layman/sabayon/eclass/sabayon-kernel.eclass'
 *                     ebuild.sh, line   35:  Called source '/var/lib/layman/sabayon/eclass/sabayon-kernel.eclass'
 *         sabayon-kernel.eclass, line   25:  Called inherit 'eutils' 'kernel-2' 'sabayon-artwork' 'mount-boot' 'linux-mod'
 *                     ebuild.sh, line 1291:  Called die
 * The specific snippet of code:
 *              [ ! -e "$location" ] && die "${1}.eclass could not be found by inherit()"
 *
 * If you need support, post the output of 'emerge --info =sys-kernel/linux-sabayon-2.6.33',
 * the complete build log and the output of 'emerge -pqv =sys-kernel/linux-sabayon-2.6.33'.
 * This ebuild used the following eclasses from overlays:
 *   /var/lib/layman/sabayon/eclass/sabayon-kernel.eclass
 * This ebuild is from an overlay: '/var/lib/layman/sabayon/'
 * S: '/var/tmp/portage/sys-kernel/linux-sabayon-2.6.33/work/linux-2.6.33-linux'
... done!

>>> Verifying ebuild manifests

!!! A file listed in the Manifest could not be found: /var/lib/layman/sabayon/sys-boot/grub/grub-1.97.2-r1.ebuild


I will end up manually editing grub.cfg again, help!
Last edited by donnie on Fri Apr 23, 2010 21:14, edited 2 times in total.
donnie
 

Re: GRUB2 package issue: update-grub and update-grub2 not fo

Postby wolfden » Thu Apr 22, 2010 4:14

moved to correct forum, please post in correct forum

Are you sure you have synced with layman and portage and are fully up to date with entropy? I guess I don't understand what you are really tying to do as the post really doesn't make sense other than grub wont merge

Code: Select all
wolf64 wolfden # emerge -av grub

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] app-admin/eselect-ruby-20100402  2 kB [0]
[ebuild  N    ] dev-lang/ruby-1.8.7_p249  USE="berkdb gdbm ipv6 ssl -debug -doc -emacs -examples -rubytests -socks5 -threads -tk -xemacs" 4,058 kB [0]
[ebuild   R   ] sys-boot/grub-1.98-r1  USE="multislot truetype -custom-cflags -debug -static" 2,392 kB [1]

Total: 3 packages (2 new, 1 reinstall), Size of downloads: 6,452 kB
Portage tree and overlays:
 [0] /usr/portage
 [1] /var/lib/layman/sabayon
User avatar
wolfden
Sharecropper
 
Posts: 8822
Joined: Sat Jan 14, 2006 0:55
Location: Midwest USA

Re: GRUB2 package issue: update-grub and update-grub2 not fo

Postby donnie » Thu Apr 22, 2010 9:39

I synced layman, portage, and updated equo, upgraded entropy, sulfur, grub, and configs. Now equo upgrade started.

I'm trying to install SystemRescueCD to HDD, I did it a couple of times before. When I edit grub.cfg, QEMU shows that it really adds menuentry, and I can boot Sabayon, but not SRCD, messages are:
qemu.png
Doesn't boot!
qemu.png (62.78 KiB) Viewed 5385 times


I tried both 1.5.1 version of SRCD I installed before, and 1.5.2.
Code: Select all
grub2-install -v
grub2-install (GNU GRUB 1.98)

Code: Select all
cat /media/sda1/boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_fonts ###
### END /etc/grub.d/00_fonts ###

### BEGIN /etc/grub.d/00_header ###
set default=saved
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 31cb1145-fc2c-4796-8454-8648d7126c3e
if loadfont /boot/grub/unifont.pf2 ; then
  set gfxmode=1024x768
  # vga= is deprecated, grub2 handles this just fine
  # making grub2 res == linux fb res
  set gfxpayload=keep
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
if sleep --interruptible 0 ; then
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_distro_theme ###
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 31cb1145-fc2c-4796-8454-8648d7126c3e
insmod png
if background_image /usr/share/grub/default-splash.png ; then
  set color_normal=white/black
  set color_highlight=magenta/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_distro_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Sabayon GNU/Linux, with Linux x86-2.6.33-sabayon" {
        insmod ext2
        set root=(hd0,5)
        search --no-floppy --fs-uuid --set 31cb1145-fc2c-4796-8454-8648d7126c3e
        linux   /boot/kernel-genkernel-x86-2.6.33-sabayon ro root=/dev/ram0 ramdisk=8192 real_root=/dev/sda5 dolvm init=/linuxrc splash=verbose,theme:sabayon quiet resume=swap:/dev/sda7 real_resume=/dev/sda7
        initrd  /boot/initramfs-genkernel-x86-2.6.33-sabayon
}
menuentry "Sabayon GNU/Linux, with Linux x86-2.6.33-sabayon (recovery mode)" {
        insmod ext2
        set root=(hd0,5)
        search --no-floppy --fs-uuid --set 31cb1145-fc2c-4796-8454-8648d7126c3e
        linux   /boot/kernel-genkernel-x86-2.6.33-sabayon ro single root=/dev/ram0 ramdisk=8192 real_root=/dev/sda5 dolvm init=/linuxrc splash=verbose,theme:sabayon quiet resume=swap:/dev/sda7 real_resume=/dev/sda7
        initrd  /boot/initramfs-genkernel-x86-2.6.33-sabayon
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### 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.
menuentry "SystemRescueCd (isoloop)" {
    insmod ext2
    set root=(hd0,1)
#                 ^
    loopback loop /systemrescuecd-x86-1.5.1.iso
#                                     ^ ^ ^
    linux (loop)/isolinux/rescuecd isoloop=systemrescuecd-x86-1.5.1.iso
#                                                             ^ ^ ^
    initrd (loop)/isolinux/initram.igz
}
### END /etc/grub.d/40_custom ###


I am sure this is because DO NOT EDIT THAT FILE, but how to edit it in any manner? update-grub and update-grub2 does not exist! :shock:

Need workaroud,
qemu2.png
Params
qemu2.png (75.23 KiB) Viewed 5385 times
donnie
 

Re: GRUB2 package issue: update-grub and update-grub2 not fo

Postby donnie » Thu Apr 22, 2010 10:33

equo upgraded

From The Beginning.

Code: Select all
mount /dev/sda1 /media/sda1
rm -rf /media/sda1/*
grub2-install --root-directory=/media/sda1 /dev/sda
Installation finished. No error reported.
cp /boot/grub/grub.cfg /media/sda1/boot/grub/
cp /home/tmp/systemrescuecd-x86-1.5.1.iso /media/sda1/
vim /media/sda1/boot/grub/grub.cfg

menuentry "SystemRescueCd (isoloop)" {
    insmod ext2
    set root=(hd0,1)
    loopback loop /systemrescuecd-x86-1.5.2.iso
    linux (loop)/isolinux/rescuecd isoloop=systemrescuecd-x86-1.5.2.iso
    initrd (loop)/isolinux/initram.igz
}   

sync ; echo 3 > /proc/sys/vm/drop_caches ; qemu -hda /dev/sda

qemu3.png
Im scared to reboot
qemu3.png (24.88 KiB) Viewed 5381 times
donnie
 

Re: GRUB2 package issue: update-grub and update-grub2 not fo

Postby wolfden » Thu Apr 22, 2010 10:57

Trying to understand this.

You installed SystemRescueCD

The menu entry is there in Grub?

SystemRescueCD just wont boot?

So if it's in the grub menu entry and you can select it, but it don't boot, it would than appear that something is wrong with the entry.

I believe you are needing grub-mkconfig

The configuration file is called /boot/grub/grub.cfg, and it generates the boot menu you see on your screen when you boot your PC (and so, /boot/grub/grub.cfg can be called the boot menu configuration file). You are NOT supposed to edit it (it is read-only). It is generated from a folder of scripts called /etc/grub.d. Another key file is /etc/grub/default and it feeds default data to the scripts in /etc/grub.d. You may edit /etc/grub/default (as root). You may also edit the scripts in /etc/grub.d (as root). If you create a new file in /etc/grub.d, you must make it executable if you want the entry included in the configuration file grub.cfg. If you do not want a script to execute (and so remove that entry from grub.cfg), you must remove the execute bit (i.e., remove the execute permission).

>>> Key reminder:
Generate a new grub.cfg after changing anything in /etc/default/grub or /etc/grub.d by:
grub-mkconfig -o /boot/grub/grub.cfg


I would try reading the gentoo wiki on Grub2, server seems to be unresponsive at moment but the cached page is still there on google
User avatar
wolfden
Sharecropper
 
Posts: 8822
Joined: Sat Jan 14, 2006 0:55
Location: Midwest USA

Re: GRUB2 package issue: update-grub and update-grub2 not fo

Postby donnie » Thu Apr 22, 2010 14:23

Yes, its a GRUB2 issue, because there are only 4 things: Sabayon, GRUB2, SRCD, my hands. I will try my best now, just didn't sleep, not because of GRUB, and got that problem in the end :roll:
donnie
 

Re: GRUB2 package issue: update-grub and update-grub2 not fo

Postby donnie » Fri Apr 23, 2010 2:41

Its for sure a bug in GRUB2. I fixed all error messages. So, partially fixed. Will just add SystemRescueCD menuentry and try boot.

Code: Select all
grub-mkconfig -o /media/sda1/boot/grub/grub.cfg
head: cannot open `/boot/grub/video.lst' for reading: No such file or
directory
Generating grub.cfg ...

Solution (found on Ubuntu forums):
Code: Select all
echo "vbe" >> /boot/grub/video.lst

Code: Select all
grub-mkconfig -o /media/sda1/boot/grub/grub.cfg
Generating grub.cfg ...
/sbin/grub-probe: error: cannot stat `/boot/grub/locale'.
No path or device is specified.

Solution:
Code: Select all
vim /etc/grub.d/00_header
# BUGGY code, don't need locales at all !!
#if [ "x${LANG}" != "xC" ] ; then
#    prepare_grub_to_access_device `${grub_probe} --target=device
${locale_dir}\locale`
#  cat << EOF
#set locale_dir=(\$root)$(make_system_path_relative_to_its_root ${locale_dir})
#set lang=${grub_lang}
#insmod gettext
#EOF
#fi

Now working with no errors:
Code: Select all
grub-mkconfig -o /media/sda1/boot/grub.cfg
Generating grub.cfg ...
Found background image: media_life_800x600.png
Found linux image: /boot/vmlinuz-2.6.31.12-rt21
Found linux image: /boot/kernel-genkernel-x86-2.6.33-sabayon
Found initrd image: /boot/initramfs-genkernel-x86-2.6.33-sabayon
done

Here is how GRUB2 installed from the beginning:
Code: Select all
rm -rf /media/sda1/*
grub2-install --root-directory=/media/sda1 /dev/sda
grub-mkconfig -o /media/sda1/boot/grub/grub.cfg

qemu4.png
Now customizable
qemu4.png (84.79 KiB) Viewed 5335 times
donnie
 

Re: GRUB2 package issue: update-grub and update-grub2 not fo

Postby donnie » Fri Apr 23, 2010 3:39

It seems a script generating grub.cfg, in this new version of GRUB2 is executed during a boot. That's why I can only customize boot menu, but cannot effectively add menu entries. They can appear in grub.cfg, but even if I manually add menu entry to grub.cfg sections, they does not appear. Now I rebooted, and see all manual changes to grub.cfg gone.

Theme renamed to: Cannot add custom menu entry to GRUB2 bootloader :roll:
donnie
 

Re: Cannot add custom menu entry to GRUB2 bootloader

Postby donnie » Fri Apr 23, 2010 13:47

Now I know, why I couldn't create menu entries for GRUB2:

qemu5.png
Looks good
qemu5.png (82.36 KiB) Viewed 5312 times


Why it didn't work? Parser

lol.png
A Tab in grub.cfg
lol.png (39.68 KiB) Viewed 5312 times


A problem with booting .iso image of SystemRescueCD (and possibly other iso-s?) from GRUB2, have no known solution for now:

http://www.sysresccd.org/forums/viewtop ... 5&start=30

[EDIT] Clonezilla was able to boot from .iso too (didn't try it myself though), does not boot with the same messages:

error: cannon read the Linux header.
error: you need to load the kernel first.
donnie
 

Re: Cannot add custom menu entry to GRUB2 bootloader

Postby donnie » Fri Apr 23, 2010 21:13

Here is solution that works, PartedMagic and Clonezilla:

viewtopic.php?f=86&t=20450

Solved because im not GRUB dev and tired. This way all works much much better, I win :shock:
donnie
 


Return to Portage|Emerge Package Managers

Who is online

Users browsing this forum: No registered users and 1 guest