Resurrecting an old thread here. I just added grub to a live-usb and can boot an iso with a very minimal grub.cfg. All done in jessie.
To install grub2 to the mbr, you need to have 2MB free space before the first partition. I did this on a flash drive that was already prepared with refracta2usb and was booting with syslinux, and I always leave 2MB free at the beginning for this purpose.
Plug the stick into a running system. Mount the first partition (fat32).
Create /boot/grub/ on the flash drive. (did this as unprivileged user)
Create /boot/grub/grub.cfg. The menuentry only needs to contain the linux line and the initrd line (oh, and the name, so you can see it in the menu) and those lines only need to show the path on the flash drive to the kernel, initrd and iso file. No need to specify the device - findiso will look for it on all disks. Mine looks like this:
- Code:
menuentry "jessv64nox (text-mode)" {
linux /jessv64nox/vmlinuz boot=live findiso=/jessv64nox/jessV_amd64_nox.iso
initrd /jessv64nox/initrd.img
}
I assume that a similar entry would work with the grub.cfg on a hard drive installation, but I haven't tried it.
Install the bootloader (as root) with:
- Code:
grub-install --boot-directory=/media/sdX1/boot /dev/sdX
where X is the right letter for your flash drive, and /media/sdX1/ is the mountpoint of the first partition of that flash drive.
You can add more to grub.cfg if you want.
You can add the word, persistence, to the linux line, and that will allow root to edit grub.cfg or other files in the root of the flash drive while running the live system, in case you need to make some changes to it. (it'll be in /lib/live/mount/persistence/sdX1/boot/grub/)
I see that using vga=791 gives you a complaint, but it actually works. I haven't seen that in a few years. Thanks, whoever did that.