Originally Posted by
Praetor77
So how should I proceed if I have grub-legacy? Is there any way to upgrade grub to grub2 before proceeding with scripts?
Thanks in advance....
Try this. The following is only for wubi installs with grub-legacy.
I used it to migrate a Jaunty (9.04) wubi install. It's a vanilla install (with all updates applied) and so I make no guarantees - not tested on 9.10/10.04. Also, since the commands are manual you have to be very careful. Take backups before hand, especially the wubi files (the \ubuntu directory).
Also, note, I do not try and use grub-legacy on the migrated install as a matter of preference - I remove and replace it with grub2 (grub-pc), and this behaves differently depending on the version. With Jaunty it's version 1.96 and it's very different to the version on 10.04 (I'll describe the differences you might see).
Following example migrates a wubi install to an external drive (/dev/sdb) - root is /dev/sdb10 and swap is /dev/sdb7 - change as appropriate before cut-and-pasting (as you can easily paste a newline and then the command executes immediately).
Code:
sudo -i
mkfs.ext3 /dev/sdb10
mkdir /tmp/wubimove
mount /dev/sdb10 /tmp/wubimove
rsync -av --exclude=/host --exclude=/mnt/* --exclude=/home/*/.gvfs --exclude=/media/*/* --exclude=/tmp/* --exclude=/proc/* --exclude=/sys/* / /tmp/wubimove
mkswap /dev/sdb7
echo "RESUME=UUID=$(blkid -o value -s UUID /dev/sdb7)" > /tmp/wubimove/etc/initramfs-tools/conf.d/resume
sed -i 's:/.*[\.]disk .*::' /tmp/wubimove/etc/fstab
sed -i 's:/.*/disks/boot .*::' /tmp/wubimove/etc/fstab
echo "UUID=$(blkid -o value -s UUID /dev/sdb10) / ext3 errors=remount-ro 0 1" >> /tmp/wubimove/etc/fstab
echo "UUID=$(blkid -o value -s UUID /dev/sdb7) none swap sw 0 0" >> /tmp/wubimove/etc/fstab
mkdir /tmp/wubimove/host
cp /etc/resolv.conf /tmp/wubimove/etc
for i in dev proc sys dev/pts host; do mount --bind /$i /tmp/wubimove/$i; done
chroot /tmp/wubimove
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
apt-get -y remove lupin-support
apt-get -y purge grub grub-common
mv /boot/grub /boot/grubold
#... continues below
This part installs grub2 - if you are on 10.04 it will automatically generate grub.cfg and prompt you where to install the bootloader. If you are on 9.04 and probably 9.10 you have to do it yourself (lines in italics).
Code:
apt-get -y install grub-pc grub-common
update-grub
grub-install /dev/sdb
rm /sbin/initctl
dpkg-divert --local --rename --remove /sbin/initctl
exit
for i in host dev/pts dev proc sys; do umount /tmp/wubimove/$i; done
rmdir /tmp/wubimove/host
umount /dev/sdb10
update-grub
exit
exit
Bookmarks