Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 2 down vote accepted

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).

share|improve this answer
    
chroot is often not as simple as this, but there's a good tutorial on using chroot for those who need more detail. – quack quixote Apr 12 '10 at 8:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .