Home > Linux, Windows > Återställa boot i Windows & Linux

Återställa boot i Windows & Linux

September 3rd, 2010 Leave a comment Go to comments

Windows 7

Boot on the Win7 installation DVD and select “Repair” to repair the boot. Go into the command shell and enter the command:

bootsect /nt60 C:

If you don’t have a Windows installation DVD and want to fix the MBR you can use MbrFix: http://www.sysint.no/nedlasting/mbrfix.htm

MbrFix is also available on the bootable CD “Ultimate Boot CD for Windows” ( http://www.ubcd4win.com/downloads.htm ).

Windows XP

Are you using WinXP and the order of the drives have been changed since you installed WinXP maybe NTLDR can’t find your XP-files when booting.

To fix: Boot a WinXP installation CD, go into recovery command console, and copy NTDETECT.COM to the XP root drive. NTDETECT.COM must be present in the root of the active partition on disk 0, together with BOOT.INI, or else Windows XP will fail to load. If the drive order in BIOS has changed you might have to edit your boot.ini to get your system to boot.

Ref: http://vlaurie.com/computers2/Articles/bootini.htm

Some explanation of the boot process: http://neosmart.net/wiki/display/EBCD/Windows+XP


Boot an Ubuntu LiveCD and start a terminal window. Check which partition you want to mount:

sudo fdisk -l

Mount the partition and set it as root (I use sda1 in the example below):

sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev
sudo chroot /mnt
sudo update-grub

Alternative chroot method

sudo mkdir -p /media/ubuntu
sudo mount /dev/sda1 /media/ubuntu

Then you need to mount the proc, dev, and sys filesystems into your new environment:

sudo mount --bind /dev /media/ubuntu/dev
sudo mount --bind /proc /media/ubuntu/proc
sudo mount --bind /sys /media/ubuntu/sys

Finally, chroot into it:

sudo chroot /media/ubuntu

From here you can run apt-get and dpkg to fix your system.

Other Linux boot troubleshooting tips

grub-install /dev/sda

This will re-install Grub to the MBR. However, if you get a Grub prompt you don’t need this since the Grub currently residing in the MBR is working alright; there is no need to reinstall, you only need to update the Grub menu via “sudo update-grub”. Grub needs to be re-installed only when Windows overwrites the MBR.

If you’re able to boot to the Grub prompt you can use the Grub prompt for launching your installed system. You could then issue the update-grub command once the system is running.

Since this is a common scenario, the Ubuntu help site contains a most precise howto: https://help.ubuntu.com/community/Grub2#Using CLI to Boot

The instructions should be self-explanatory. Please note how Grub counts drives and partitions: sda = hd0, sdb = hd1, sdc = hd2 etc., hence sda2 would be (hd0,2) and sda5 would be (hd0,5) in “Grub speak”.

Also, if you cannot determine which of the partitions found with the ‘set’ and ‘ls’ commands actually contain your Ubuntu root, use the instructions given here: https://help.ubuntu.com/community/Grub2#Rescue Mode to use the ‘ls’ command in order to list boot files on the partitions in question.

To edit the Grub menu:

Debian Lenny, by default, uses Grub Legacy, not Grub2.
Ubuntu Karmic, by default, uses Grub2, but *only* if it was an original installation; if you made a dist-upgrade from Ubuntu Jaunty, it will also still use Grub Legacy.

Then you need to find out which OS is the one that placed its Grub into the MBR and thus is the one responsible for your main boot menu. This will usually be the OS which is mentioned first in the boot menu and/or the one that was installed last.

You will have to modify the Grub menu from inside the OS to which it belongs.
– If that is Debian (or Ubuntu upgraded from Jaunty or earlier), go look for the file /boot/grub/menu.lst and edit it (as root). Remove or uncomment the entries you don’t want to see (menu entries start with the word: “title”). Please don’t forget to make a backup copy of the old menu.lst first!
– If you’re running Grub2 (if you have an Ubuntu Karmic original installation or later) you can’t use menu.lst. Read this instead: http://ubuntuforums.org/showthread.php?t=1195275

Categories: Linux, Windows Tags:
  1. No comments yet.
  1. No trackbacks yet.