3

I have a dual-boot Windows 7 & Ubuntu 16.04 , Now I need to upgrade windows 7 to 8.1 to be specific I want a "Clean Install which format the win 7 partition then install the win 8.1" so how to do that ? I think this won't effect Ubuntu partition but it will effect the (GRUB) so how to install grub from windows ?

I usually when get a GRUB rescue I use some GRUB commands then when boot from Ubuntu use this commands :

sudo grub-update then sudo grub-install /dev/sda

  • You're in luck as I successfully did this recently. After Win 8.1 install I downloaded Grub for Windows. Setup an option to call Ubuntu. Then reboot I get Windows multi-boot with Grub for Windows and select Ubuntu. From there run sudo update-grub which creates a new boot menu with Windows 8.1 instead of Windows 7. Then on subsequent boots Grub multi OS loader greets you instead of Windows multi-OS loader. – WinEunuuchs2Unix Jan 5 '17 at 1:26
  • @WinEunuuchs2Unix thank you I will try it now – Pro-Fun Jan 5 '17 at 1:37
  • Look at the answers below before trying it. I never had a live USB / DVD... that's a work in progress with UEFI and CSM. – WinEunuuchs2Unix Jan 5 '17 at 1:43
1
  1. Insert your Ubuntu LiveDVD / USB .
  2. after boot use try Ubuntu
  3. when live system started
  4. open terminal by using CTRL + ALT + T
  5. then type sudo grub-update
  6. then type sudo grub-install

That's it !

Update 1

mostly you will get error when using sudo grub-install on live environment so do steps bellow (on live env too):

P.S: make sure you have completely shutdown your Windows before do this to do this from windows CMD or RUN type shutdown /r /t 0 .

  1. Open Terminal (CTRL + ALT + T).

  2. mount the Ubuntu partition by sudo mount /dev/sd# /mnt replace # with your Ubuntu partition as ex. sudo mount /dev/sda2 /mnt

  3. mount the boot partition sudo mount /dev/sd# /mnt/boot replace # with boot partition, in most cases the boot partition is "sda1"

  4. finally use sudo grub-install --root-directory=/mnt /dev/sdX replace X with the order of disk you want to install grub on it , if you use a single hard drive it will be sda

It's done for now see Update 2

Update 2 (can also used for grub rescue)

after you installed grub successfully from Update 1 and restart , you will get a grub command line screen do the following commands :

  1. type ls you will get the partitions in order similar to this : (hd0)(hd0,msdos4)(hd0,msdos3)(hd0,msdos2)(hd0,msdos1)

  2. type ls (hd0,X) replace X with the number , you will get unknown file system , do it until you get file system ext2 that's our target

  3. after we get our target partition type set root=(hd0,X) replace X with target partition number

  4. then set prefix=(hd0,X)/boot/grub

  5. (For x32 bit, works both for i386 and i686 systems) type insmod /boot/grub/i386-pc/linux.mod

  6. (for x64 bit systems do step 5 too if you get Not found do this ) type /boot/grub/linux.mod

  7. (if step 6 not working only) type ls /boot/grub to see the directories and files check every folder to find the linux.mod file , then do the step 6 with modified path.

  8. type normal you will find your normal grub boot-loader boot into Ubuntu

  9. from Ubuntu terminal type sudo update-grub

  10. then sudo grub-install /dev/sdX replace X with the device , mostly it's sda

All done ! .

  • Most of it is not applicable to UEFI/GPT systems. You could improve your answer by rewriting it instead of adding corrections as "updates". – user589808 Jan 9 '17 at 15:16

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.