Professional Documents
Culture Documents
winXP Dopo Ubuntu1
winXP Dopo Ubuntu1
winXP Dopo Ubuntu1
You can check the current version installed on your system via Synaptic or from the
command line. Open a Terminal and enter the following:
grub-install -v
GRUB 2 should display a version number of 1.96 or later. Legacy GRUB is version 0.97.
Skip this section if you are sure about your version of Grub
Go into boot/grub directory and check for the existence of the files menu.lst and grub.cfg.
Grub Legacy uses boot/grub/menu.lst.
Grub 2 uses uses boot/grub/grub.cfg.
If you are still not sure, view the file and check whether syntax follows Grub2 conventions.
If you downloaded Ubuntu Karmic 9.10 Live CD, but your installed version of Ubuntu uses
Grub Legacy, please use this guide
https://help.ubuntu.com/community/DualBoot/Grub#Ubuntu%209.10%20&%20earlier
Your Ubuntu partition is now mounted. You will need to continue Using the Terminal.
mount | tail -1
Note the designation for the disk /dev/sda which you will be using later, and the
directory in /media.
Use Tab Completion in Terminal to complete the path. Hitting the <TAB> key will
automatically finish file names, directory locations, and other long or hard to type file names.
To make sure this is indeed the Ubuntu boot partition, run ls /media/0d104aff-
ec8c-44c8-b811-92b993823444/boot, substituting 0d104aff-ec8c-
44c8-b811-92b993823444 with your volume's UUID from before, which should
output something like this:
If what you have is not similar, unmount it and try another partition.
Now that everything is mounted, we just need to reinstall GRUB by specifying the correct
directory and the correct drive name:
Replace /dev/sda with the location you want to install GRUB on.
(hd0) /dev/sda
Reboot, making sure to boot to your hard drive and not to the live CD. Grub should be
installed and both Ubuntu and Windows should have been automatically detected and listed
in the menu.
The Master Boot Record will execute Grub as the initial bootloader. The Windows
bootloader is contained within the Windows partition and will then be chainloaded by the
Grub bootloader.
https://help.ubuntu.com/community/DualBoot/Grub#Ubuntu%209.10%20&%20earlier
Troubleshooting
I don't see a Grub menu
If the menu is not normally displayed during boot, hold down the SHIFT key as the
computer attempts to boot to display the GRUB 2 menu. For Grub Legacy, use ESC key to
display a menu.
You may have mixed up Grub Legacy and Grub 2. This symptom is most typical when you
assumed you have Grub 2, but your Ubuntu OS actually uses Grub Legacy. Follow these
instructions again using Ubuntu 9.04 Live CD.
If you are certain you have Grub 2 and it's still displaying shell mode by now, follow the
method using chroot listed here... http://www.ubuntu-inside.me/2009/06/howto-recover-
grub2-after-windows.html.
If, after installing grub, Windows does not appear in the boot menu, boot into Ubuntu and
execute command
sudo update-grub2
If at any time grub2 gives this error, boot up into Ubuntu (on hard disk if possible, otherwise
with Live CD), open a terminal and run command
sudo update-grub2
This should automatically detect the devices and configure grub appropriately.
If, after installing grub, Windows does not appear in the boot menu, you will need to edit
/boot/grub/menu.lst (That is a lowercase "L" and not the number 1 in menu.lst)
Or, in Kubuntu:
title Windows XP/Vista # Use any title you wish, it will appear in the
grub boot menu
rootnoverify (hd0,0) # This is the location of the windows partition
makeactive
chainloader +1
Note: Put your Windows stanza before or after AUTOMAGIC KERNEL LIST in the
menu.lst
This method allows you to restore GRUB and keep the Windows bootloader as your primary
bootloader. Thanks to Ubuntu's support for NTFS writing this method is now quite simple.
The previous method puts GRUB back on the MBR (Master Boot Record) of the hard drive
instead of in the root partition. Should you not wish to do so, for instance if you use a third-
party boot manager like Boot Magic or System Commander, this next suggestion will be
helpful. Another reason to prefer this method is for when restoring the Grub menu after a re-
ghosting. In either case, use this alternative.
Restoring GRUB
1. Boot from a Live CD, like Ubuntu Desktop, or similar. It is recommended to use Ubuntu
9.04 or newer as this has NTFS write support.
2. Open a Terminal. Open a root terminal (For non-Ubuntu live CDs type su the terminal.
For Ubuntu based distros run sudo -i) Enter root passwords as necessary.
Note:
You should have mounted the partition which has your Linux system before typing this
command. (e.g. In Knoppix Live CD partitions are shown on the desktop but they're not
mounted until you double-click on them or mount them manually)
5. Type root (hd0,3) note the space between root and (hd0,3).
6. Type setup (hd0,3) into the prompt. This is key. Other instructions say to use
"(hd0)", and that's fine if you want to write GRUB to the MBR. If you want to write it to
your Linux root partition, then you want the number after the comma, such as "(hd0,3)".
7. Type quit
8. At this stage you can either restart the system and install your own bootloader, or you can
continue and tell the Windows bootloader where to find GRUB which will handle booting
Linux.
2. Mount a drive which you can share with Windows. This could be a USB drive, a FAT32
partition on your hard drive, or if you are using a Linux distribution which supports NTFS
writing natively (Such as Ubuntu 8.04 or later) then you can mount the actual Windows C:\
drive itself! The advantage of writing to the Windows drive is that you are going to need to
put a file there eventually, so it saves time copying a file around. For example:
#mkdir /tmp/windows
#mount /dev/sda1 /tmp/windows
However, when writing directly to the C:\ drive you could also do some damage to the
system if you delete or move something. If you do pick the option to write directly, go in, put
the file where it belongs, and touch NOTHING else.
3. Now you are going to make a copy of your boot partition. Finding out what this is called is
not always completely reliable since the Linux naming conventions differ from the GRUB
naming conventions. Linux labels partitions as hd[Letter][Number] or sd[Letter][Number]
whereas GRUB always names them as hd[Number][Number]. If you installed GRUB on
(hd0,0), then the /boot partition will be on hda1 or sda1. (Since (hd1,0) == hdb1 or sdb1,
then by extension if you installed GRUB on (hd0,1) then the /boot partition will be on hda2
or sda2 and so on and so forth.) This narrows you down to two possibilities. If you now
paste ls /dev |grep hd it will let you know if you have that drive on your machine.
If nothing comes up which matches, then that means you must have an sd drive.
Note: The command df won't work as you are booted from a Live CD.
Looking at this example /dev/sda2 is your boot partition and /tmp/windows/ is the
drive you want to copy the boot sector image to.
5. If you haven't created linux.bin in the Windows drive then you need to copy it there
now.
6. Next, reboot your computer and boot into Windows. Open c:\boot.ini in Notepad,
and add a new line at the bottom:
c:\linux.bin="Linux"
This file might be write protected. If that is so, you need to enable writing to the file. To do
so, right click, and from the context menu select Properties. Then uncheck the box that says
"File is read only". Make sure to put that checkmark back afterwards.
Next, make sure that at the top of the boot.ini file there is a timeout set, i.e
timeout=5 or some such number.
Do not edit this file from the Live CD, even if you have NTFS write support. Linux
and Windows represent line breaks in different ways, so even though you can edit the file, it
won't add a new line.
7. That's it, reboot and you will be given the option of booting into Linux, selecting that will
chainload GRUB and this will let you boot into your Linux distro.
Source: http://ubuntuforums.org/showpost.php?p=121355&postcount=5
Download Rescatux
Burn the Rescatux ISO in a cdrom
Make your PC boot from the cdrom
At Debian Live Boot screen just press ENTER
Select Restore grub / Fix Linux Boot option and click on OK button
Select the partition where your Ubuntu is and click on OK button
Select the hard disk where you want Grub to be installed (usually the first one)
Grub was installed OK confirmation / Grub was not installed error will appear
Look for System -> Shutdown in the top tray in order to halt your machine
As a standalone cd/floppy/usb
Download Super Grub Disk
Burn into a cdrom (better) or a floppy
Boot from it
Select: GRUB => MBR & !LINUX! (>2) MANUAL |8-)
Select the Linux or Grub installation you want to restore.
You see the message: SGD has done it!
Reboot
You're done.
NOTE: This alternative, used without a third-party boot manager, will not cause Ubuntu to
boot.
This method will let you boot your second hard disk Linux installations from Windows
while the Using the Ubuntu Desktop/Live CD. Preserving Windows Bootloader
instructions will not.
Either:
Or:
Then:
1. Enter your computers BIOS to check computer can boot from CD ROM. If you can
boot from CD, insert CD ROM into drive. Exit the BIOS (if needed save your settings
to make sure the computer boots from the CD ROM).
2. When the Ubuntu splash screen comes up with the boot: prompt, type in rescue
and press enter.
3. Choose your language, location (country) and then keyboard layout as if you were
doing a fresh install.
4. Enter a host name, or leave it with the default (Ubuntu).
5. At this stage you are presented with a screen where you can select which partition is
your root partition (there is a list of the partitions on your hard drive, so you are
required to know which partition number Ubuntu is on). This will be
dev/discs/disc0/partX, where the X is a partition number.
6. you are then presented with a command prompt (a hash).
7. type
$ grub-install /dev/XXX
where XXX is the device of your Ubuntu install. (eg: grub-install /dev/""hda"" or grub-
install /dev/""sdb"" ). Note: newer 2.6.xx kernels call all hard disks ""sdx"" now but not sure
if grub does.
EasyBCD software allows Microsoft Windows users to boot into multiple operating systems,
including Ubuntu Linux.
Troubleshooting
This section applies to...
Prerequisites:
Note: Since this is a LiveCD environment, any changes to user accounts or filesystem
layouts at this level will not be permanent. This means you can set a temporary root password
and create directories without affecting your actual installation.
Now, you need to gain root access. Under Ubuntu, this can be done with the following
commands:
sudo -i
Under Knoppix, the following command will suffice, and you will not be prompted for a
password.
su -
Now that you have root access, you need to mount the partition(s) containing your
bootloader files.
You will need access to both your /sbin/ and /boot/ directories. If you have a
/boot/ listing in your fstab, you are among those who will need to mount two
partitions.
Begin by creating a mount point for your working environment -- you'll notice this is the
same as creating a directory.
mkdir /mnt/work
mkdir /mnt/work/boot
Now it's time to actually load your filesystem data. Review your fstab and identify the
location(s) of / and /boot/; these will likely look something like /dev/hda3 and
/dev/hda4, though the letter 'a' and the numbers 3 and 4 may differ.
Note: For the remainder of this howto, /dev/hda3 and /dev/hda4 will be assumed, so
alter them as needed when typing them in yourself.
Enter the following commands to load your filesystem and some information GRUB may
need.
Now, you have to enter your working environment. The following command will take care
of that.
Warning: From this point on, any files you modify will affect your Ubuntu system. You
have left the safety of the LiveCD. Exercise caution.
Reinstalling GRUB from this point is easy. Just enter the following command.
If the command you used above failed, which is unlikely, you will need to configure GRUB
manually (it isn't too hard). If it succeeded, you should read the note at the start of the final
section: "Configuring the GRUB Menu".
Before you can undertake the next step, it's important that you understand how GRUB
identifies partitions.
To GRUB, numbers begin with 0, and letters are expressed numerically, also beginning with
0.
Note: The "root" line must point to the location of your /boot/ partition if you have one. If
you do not have one, point it at your / partition.
sudo /sbin/grub
grub> root (hd0,2)
grub> setup (hd0)
grub> quit
Note: This step does not need to be done if you're just trying to recover your MBR. Installing
Windows will not alter the contents of your existing menu.lst, so if everything was
working right before, everything will continue to work right now, and you can restart your
computer.
Open the GRUB menu file, /boot/grub/menu.lst, with your favourite text editor.
An example follows.
Note: Your menu.lst file is used to control the operating systems GRUB displays on
startup, as well as its visual appearance. This howto will only explain how to get your
operating systems to boot, it will not tell you how to make your bootloader pretty.
And that's it. Save and close the file, then reboot and try out the entries.
GRUB Resources
GRUB Manual
GRUB homepage
GRUB wiki
Recovering grub after installing Windows to dual-boot
Linux+Win+Grub HowTo
Rescatux - Ready to go cdrom that restores Grub on MBR thanks to a graphical
wizard (among many other options)
Super Grub Disk - Ready to go cdrom or floppy that restores Grub on MBR
automatically
GRUB for DOS
Page History