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.

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

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.