3

I just tried to clone a failing existing boot drive for a dual boot system with Ubuntu karmic and Windows XP installed using Clonezilla. The cloning worked fine right up until the end when I got the following error:

Running: grub-install --no floppy --root-directory=/tmp/hd_img.twABYW /dev/sdb
grub-probe: error: Cannot open '/boot/grub/device.map'
/usr/sbin/grub-install:line 374: [: =: unary operator expected

What's my next step?

I imagine I need to somehow rebuild my boot record for Windows and Ubuntu and edit grub.

quack quixote
  • 42,186
  • 14
  • 105
  • 129
srboisvert
  • 139
  • 1
  • 3
  • 17

1 Answers1

2

When you want to re-install Grub from a system that you cannot boot, you usually boot from a live CD like Knoppix or Ubuntu. There you mount your Linux installation:

mount /dev/sdbX /mnt

Where X is the partition number on your hard drive. Then, you have two possibilities. Either you install the Grub version installed on your live CD:

grub-install --no-floppy --root-directory=/mnt /dev/sdb

Or you install the Grub version on your Linux installation:

chroot /mnt /bin/bash
grub-install --no-floppy /dev/sdb
exit

If this still throws the same error, you should send us that line of the grub-install script and the lines above it (using head -374 /usr/sbin/grub-install | tail -10).

cdauth
  • 368
  • 2
  • 3
  • 19
  • *chroot* is often not as simple as this, but there's a good tutorial on [using chroot](http://superuser.com/questions/111152/whats-the-proper-way-to-prepare-chroot-to-recover-a-broken-linux-installation) for those who need more detail. – quack quixote Apr 12 '10 at 08:17