Comment 3 for bug 574883

Revision history for this message
Wolle (onkel-wolle) wrote :

I continued to search for a solution and found:
http://www.gnu.org/software/grub/manual/grub.html#Installing-GRUB-using-grub_002dinstall

The I tried, what the manual proposes for some USB devices (last paragraph of the refered section):
#### start code ####
caelinux@caelinux:~$ sudo -i
root@caelinux:~# losetup /dev/loop1 /dev/sda6
root@caelinux:~# mount /dev/loop1 /mnt
root@caelinux:/# grub-install --force --root-directory=/mnt /dev/loop1
/usr/sbin/grub-setup: warn: Attempting to install GRUB to a partitionless disk. This is a BAD idea..
/usr/sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and its use is discouraged..
Installation finished. No error reported.
root@caelinux:/# umount /mnt
root@caelinux:/# losetup -d /dev/loop1
root@caelinux:/# exit
logout
caelinux@caelinux:~$ sudo fdisk -l 2>/dev/null | egrep "Disk /|/dev/" | sed "s#^/dev/#Part /dev/#" | awk '{print $2}' | sed 's/://' | xargs -n1 -IX sudo sh -c "hexdump -v -s 0x80 -n 2 -e '2/1 \"%x\" \"\\n\"' X | xargs -n1 -IY sh -c \"case \"Y\" in '48b4') echo X: GRUB 2 v1.96 ;; 'aa75' | '5272') echo X: GRUB Legacy ;; '7c3c') echo X: GRUB 2 v1.97 oder höher ;; *) echo X: Kein GRUB Y ;; esac\""
/dev/sda: GRUB 2 v1.97 oder höher
/dev/sda1: Kein GRUB 00
/dev/sda2: Kein GRUB ffff
/dev/sda5: Kein GRUB 00
/dev/sda6: GRUB 2 v1.97 oder höher
/dev/sda7: Kein GRUB 00
/dev/sda8: Kein GRUB 00
/dev/sda9: Kein GRUB 00
#### end code ####

This obviously seems to work - at least GRUB is written to the PBR...

Why do I have to trick grub-install with a loop device? Isnt the --force option enough of a safeguard against users decisions?

DISCLAIMER!!!! This is just, what I found to appear as if it maybe could work!
Anybody who attempts something like that does so on his own risk!
I tried all of this on an empty hard disk, make sure you have complete and up-to-date backups before performing this somehow twisted approach!