ubuntu / windows dual boot grub problem

Not sure what has happened here but...

I have dual boot Windows XP and ubuntu karmic.

At some point following a session using ubuntu I booted up and Windows had disappeared from the grub menu.

At this stage I could get into ubuntu. Since then, the ubuntu options (there are two kernels as options) do not work. Can't remember the exact message but the gist is that it cannot find a certain file.

So at the moment nothing boots.

I can boot to ubuntu from cd but don't know where to start diagnosing/fixing.

I am a bit of a linux noob so please be clear and explicit.

Help please.

TIA
LVL 13
Atdhe NuhiuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabio MarzoccaFreelancerCommented:
0
TobiasHolmCommented:
Hi!

Try this to install GRUB using your Ubuntu CD: http://ubuntuforums.org/showthread.php?t=224351

Regards, Tobias
0
ygouthamCommented:
boot through ubuntu cd

mount the system with the command provided at the end of the rescue screen

run the command

grub-install

and follow through
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Atdhe NuhiuAuthor Commented:
i can't get any of these to work
the reinstall grub seemed to go ok but nothing was different when i rebooted
 
0
TobiasHolmCommented:
Can you start Ubuntu Live CD and enter System / Admin / Disk Utility? And show us your disks partitions? See example pic.

Regards, Tobias
1DiskUtil.gif
0
Atdhe NuhiuAuthor Commented:
screenshot
Screenshot.png
0
TobiasHolmCommented:
Are you still unable to start WinXP or Ubuntu from your hard drive? What happens when you start the computer? Any error messages? Does GRUB menu start?

Regards, Tobias
0
Atdhe NuhiuAuthor Commented:
Can't start either Win or ubuntu.

The grub menu starts apparently ok. I have not seen any error messages. I does not have Windows as an option. I don't know of any other way to boot into windows. The options it contains are two ubuntu kernels and their corresponding safe modes and two mem tests.

The ubuntus all return an error message to the effect 'file not found'. No indication of what what file or where it is looking.

The mem tests appear to work (they start and I cancel out)

I did try to reinstall ubuntu but I wasn't sure what I was doing. I opted to not format anything. I wasn't sure what to do with the windows partition but it failed with a message, I think, saying that it couldn't mount windows.
0
TobiasHolmCommented:
Try the following to fix WinXP boot in GRUB: http://grub.enbug.org/ChainLoadWindows

Also, can you show us the content of the '/etc/grub.d/10_linux' file?

And the output of 'sudo fdisk -l'?

Regards, Tobias
0
Atdhe NuhiuAuthor Commented:
I will try this.

This will be this evening (BST) as I am at work at the moment
0
TobiasHolmCommented:
ok!

Then maybe you can show us the output of this too:

ls -l /dev/disk/by-uuid/
cat /etc/fstab

Regards, Tobias
0
Atdhe NuhiuAuthor Commented:
been having trouble with firefox hanging ubuntu

I followed the link and sudo update-grub gives

grub-probe: error cannot find a device for /.

the '/etc/grub.d/10_linux' file did not have a windows entry but I have added it as per the link you gave above but as mentioned the update errored

as i am on a different machine I can't copy and paste the output from the commands you suggest what are you looking for?

i'll try one more time from the machine in question
0
Atdhe NuhiuAuthor Commented:
ubuntu@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x5806f041

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       14281   114712101    7  HPFS/NTFS
/dev/sda2           14282       15549    10185210   83  Linux
/dev/sda3           15550       18888    26820517+  83  Linux
/dev/sda4           18889       19457     4570492+  82  Linux swap / Solaris
ubuntu@ubuntu:~$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 2010-04-09 21:59 36a5f64a-a99a-42fc-90cd-3649d8c03617 -> ../../sda2
lrwxrwxrwx 1 root root 10 2010-04-09 21:59 399331af-fcc6-4955-bbf3-a8b3236d0930 -> ../../sda3
lrwxrwxrwx 1 root root 10 2010-04-09 21:59 A67C30987C3064E9 -> ../../sda1
lrwxrwxrwx 1 root root 10 2010-04-09 21:59 bb176010-2bf9-47b5-9a81-b8044933a00e -> ../../sda4
ubuntu@ubuntu:~$ cat /etc/fstab
aufs / aufs rw 0 0
tmpfs /tmp tmpfs nosuid,nodev 0 0
/dev/sda4 swap swap defaults 0 0
ubuntu@ubuntu:~$



0
Atdhe NuhiuAuthor Commented:
ooh it worked
0
Atdhe NuhiuAuthor Commented:
hope that helps

this is getting on my nerves now :-)
0
TobiasHolmCommented:
You shouldn't put the Windows entry in the 10_linux file. Put the Windows entry in the 40_custom file instead.

Regards, Tobias
0
TobiasHolmCommented:
I'm have to sleep a little now. Getting really late here in Sweden... ;)

Regards, Tobias
0
Atdhe NuhiuAuthor Commented:
>You shouldn't put the Windows entry in the 10_linux file. Put the Windows entry in the >40_custom file instead.

sorry my bad. I did

I'll list 10_linux tomorrow, if I get time :-)

Thanks for your continuing help.
0
Atdhe NuhiuAuthor Commented:
10_linux
#! /bin/sh -e

# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
. ${libdir}/grub/grub-mkconfig_lib

if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
  OS=GNU/Linux
else
  OS="${GRUB_DISTRIBUTOR}"
fi

# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
  /dev/loop/*|/dev/loop[0-9])
    GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
    # We can't cope with devices loop-mounted from files here.
    case ${GRUB_DEVICE} in
      /dev/*) ;;
      *) exit 0 ;;
    esac
  ;;
esac

if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
    || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
    || [ "`grub-probe -t abstraction --device ${GRUB_DEVICE} | sed -e 's,.*\(lvm\).*,\1,'`" = "lvm"  ] ; then
  LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
  LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi

# add crashkernel option if we have the required tools
if [ -x "/usr/bin/makedumpfile" ] && [ -x "/sbin/kexec" ]; then
    GRUB_CMDLINE_EXTRA="$GRUB_CMDLINE_EXTRA crashkernel=384M-2G:64M,2G-:128M"
fi

linux_entry ()
{
  cat << EOF
menuentry "$1" {
        recordfail=1
        if [ -n \${have_grubenv} ]; then save_env recordfail; fi
EOF
  if [ "x$3" = "xquiet" ]; then
    cat << EOF
	set quiet=1
EOF
  fi
  save_default_entry | sed -e "s/^/\t/"
  prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
  cat << EOF
	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2
EOF
  if test -n "${initrd}" ; then
    cat << EOF
	initrd	${rel_dirname}/${initrd}
EOF
  fi
  cat << EOF
}
EOF
}

list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
        if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
      done`

while [ "x$list" != "x" ] ; do
  linux=`version_find_latest $list`
  echo "Found linux image: $linux" >&2
  basename=`basename $linux`
  dirname=`dirname $linux`
  rel_dirname=`make_system_path_relative_to_its_root $dirname`
  version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
  alt_version=`echo $version | sed -e "s,\.old$,,g"`
  linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"

  initrd=
  for i in "initrd.img-${version}" "initrd-${version}.img" \
	   "initrd-${version}" "initrd.img-${alt_version}" \
	   "initrd-${alt_version}.img" "initrd-${alt_version}"; do
    if test -e "${dirname}/${i}" ; then
      initrd="$i"
      break
    fi
  done
  if test -n "${initrd}" ; then
    echo "Found initrd image: ${dirname}/${initrd}" >&2
  else
    # "UUID=" magic is parsed by initrds.  Since there's no initrd, it can't work here.
    linux_root_device_thisversion=${GRUB_DEVICE}
  fi

  linux_entry "${OS}, Linux ${version}" \
      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
      quiet
  if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
    linux_entry "${OS}, Linux ${version} (recovery mode)" \
	"single ${GRUB_CMDLINE_LINUX}"
  fi

  list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
done

Open in new window

0
TobiasHolmCommented:
Hi again!

Has been out the whole weekend traveling! The 10_linux file looks good.

Did you manage to boot to WinXP after following the instructions on http://grub.enbug.org/ChainLoadWindows ? Did you get an Windows menu entry in your Grub menu? Or are you still unable to boot Ubuntu and WinXP? What are the exact error message when you select Ubuntu in the Grub menu?

Regards, Tobias
0
Atdhe NuhiuAuthor Commented:
No I didn't get windows booting. when I got to the

sudo update-grub step I get

grub-probe: error: cannot find a device for /.

though I believe it should be grub2 with ubuntu 9.10. I did update_grub 2 and got the same thing

I'll have to get back to you with exact wording of the error message from the grub menu but it is basically "file not found"

so basically I am in the same position. I can only boot to live cd
0
Atdhe NuhiuAuthor Commented:
having pressed e on the grub menu I can see the commands it is trying to run. it mentions

/boot/initrd.img-2.6.31-20-generic which I can't find so I guess this is the problem. Is there some way of replacing this file?
0
TobiasHolmCommented:
ok. Du you have a "2.6.31-19-generic" on your hard drive in your '/boot' directory? Or another version besides 2.6.31.20? Then you might try to change the text when booting in Grub. See pic for an example. Also check the UUID. It should be '36a5f64a-a99a-42fc-90cd-3649d8c03617'.

You can use the following command to rebuild the Linux menu after you have booted to your hard drive:
'sudo grub-mkconfig -o /boot/grub/grub.cfg'

Regards, Tobias


1Grub1.97eToEditBoot.gif
0
Atdhe NuhiuAuthor Commented:
>ok. Du you have a "2.6.31-19-generic" on your hard drive in your '/boot' directory? Or another version  besides 2.6.31.20?

No, I don't :-(
0
TobiasHolmCommented:
What files do you have in the /boot dir on your hard drive? Remember to mount the hard drive if you're booting from a LiveCD. Otherwise you'll show the files on the LiveCD instead of the files on the hard drive.

sudo mkdir /media/sda2
sudo mount /dev/sda2 /media/sda2
cd /media/sda2/boot
ls -l
1.gif
0
Atdhe NuhiuAuthor Commented:
0
Atdhe NuhiuAuthor Commented:
initrd.img-2.6.31-20-generic seems to be missing
0
TobiasHolmCommented:
Yes. Can you copy it from the CD? Which files do you have on the CD?

use 'ls /boot' when you have booted from the LiveCD.

Otherwise you could download the file and copy it to the hard drive.
0
Atdhe NuhiuAuthor Commented:
I can't seem to browse to the cd. It just wants to install ubuntu. I don't know where on the disc it is.

I googled but didn't find anywhere to download it
0
TobiasHolmCommented:
I've put the file here: http://eftprod.com/20.zip

First check that you have the Linux partition mounted if booting from a LiveCD. Maybe you don't even have to type this commands:
sudo mkdir /media/sda2
sudo mount /dev/sda2 /media/sda2

Check with 'ls /media' if you have the sda2 already mounted. Otherwise type the commands above.

unzip the file with: sudo unzip 20 -d /media/sda2/boot

Does this solve the Linux boot?

/Tobias
0
aadhabardeCommented:
To create initrd shot the following command
mkintird initrd-2.6.31-20-generic 2.6.31-20

Best Luck.
0
TobiasHolmCommented:
oh, you can download the file by typing:

wget http://eftprod.com/20.zip
0
Atdhe NuhiuAuthor Commented:
Thanks

I shall try this evening
0
Atdhe NuhiuAuthor Commented:
I now get the ubuntu logo and then the following

mount: mounting /sys on /root/sys failed: no such file or directory
mount: mounting /dev on /root/dev failed: no such file or directory
mount: mounting /sys on /root/sys failed: no such file or directory
mount: mounting /proc on /root/proc failed: no such file or directory

target filesystem doesn't have /sbin/init
No ini found try passing init= bootarg
0
TobiasHolmCommented:
Try this:

Boot LiveCD.

sudo fsck /dev/sda2

Checks file system for errors.
sudo mkdir /media/sda2sudo mount /dev/sda2 /media/sda2sudo grub-install --root-directory=/media/sda2 /dev/sda

Restart the system without the LiveCD. Select the normal (non-recovery mode) default linux from the bootmenu.

Start a terminal window and type:
sudo update-grub

Restart computer one last time to make sure all the changes were updated properly.
0
Atdhe NuhiuAuthor Commented:
after  boot without livecd I get same again

mount: mounting /sys on /root/sys failed: no such file or directory
mount:  mounting /dev on /root/dev failed: no such file or directory
mount:  mounting /sys on /root/sys failed: no such file or directory
mount:  mounting /proc on /root/proc failed: no such file or directory

target  filesystem doesn't have /sbin/init
No ini found try passing init=  bootarg
0
TobiasHolmCommented:
So you could do the first steps, but when you rebooted the computer you couldn't start Ubuntu from the hard drive to do the 'sudo update-grub' step?
0
Atdhe NuhiuAuthor Commented:
yeah that's correct
0
TobiasHolmCommented:
Then boot LiveCD and do:

sudo mkdir /media/sda2
sudo mount /dev/sda2 /media/sda2
sudo chroot /media/sda2
sudo update-grub
0
Atdhe NuhiuAuthor Commented:
after sudo chroot /media/sda2

i get

chroot: cannot run command `/bin/bash': No such file or directory
0
TobiasHolmCommented:
Hmm... Strange. Looks like there are more than one file that's missing from your partition.

Did you have important data on your Linux partition? Maybe you can backup the data to an USB disk and reinstall the whole Linux partition? Maybe that's gonna be the fastest way to fix your computer?
0
Atdhe NuhiuAuthor Commented:
nothing of importance on the linux partititon. all the important stuff is on the ntfs partition.

I did try to reinstall ubuntu earlier

"I did try to reinstall ubuntu but I wasn't sure what I was doing. I  opted to not format anything. I wasn't sure what to do with the windows  partition but it failed with a message, I think, saying that it couldn't  mount windows."

Is this what you meant? should I reformt the linux partitions.
0
Atdhe NuhiuAuthor Commented:
when I try to reinstall ubuntu at the partitioner I do the following

Device        Type   Mount        Format
/dev/sda1    ntfs     /windows   n
/dev/sda2    ext3   /                   y
/dev/sda3    ext3   /home         n
/dev/sda4   swap  -                   -

It carries on a bit then an error dialogue pops up

"The attempt to mount a file system with typ ntfs in SCSI 1(0,0,0), partition #1 sda at /windows failed.

the options are go back or continue. continue takes you back to the partioner.

and so does go back.

Am I doing something wrong?
0
TobiasHolmCommented:
I'd suggest you boot the LiveCD and delete the /dev/sda2 Linux partition with 'gparted'. Then try to install Ubuntu again.

If it still doesn't work, try to delete all Linux partitions including the swap with 'gparted'. To be able to delete the swap partition you first need to right click the swap in GParted and select "swapoff".
0
Atdhe NuhiuAuthor Commented:
good grief! :-)

reinstalled ubuntu. all seemed to go ok. rebooted following the grub loading message caught a brief glimpse of error no such device nnnnnn nnnnnnn nnnnnn (some long number)

the grub menu appears, with windows on it. I try ubuntu and I get error no such device nnnnnn nnnnnnn nnnnnn (some long number).

However! Windows does boot now. That's progress at least
0
TobiasHolmCommented:
lol! Yes, that's good at least one OS is working now!

Maybe the problem could be fixed by edit the file '/etc/default/grub' and uncomment the line:
GRUB_DISABLE_LINUX_UUID=true

and then run 'update-grub' to update '/boot/grub/grub.cfg'. Start the Live CD and check with 'sudo fdisk -l' first which partition Linux is installed in (in case it changed when you reinstalled). Then run the following commands:

sudo mount /dev/sda2 /mntsudo mount --bind /dev /mnt/devsudo chroot /mntsudo update-grub
0
Atdhe NuhiuAuthor Commented:
Sorry, been a bit busy.

The above didn't work. The result was the same only it had stripped the Windows XP from the grub menu again. I have since reinstalled Ubuntu and have windows back.
0
TobiasHolmCommented:
So the current status is:?
- Windows works
- Ubuntu doesn't work

You could try the "Super Grub Disk" and see if it can fix the Ubuntu boot:
http://www.supergrubdisk.org/index.php?pid=5
0
Atdhe NuhiuAuthor Commented:
I am out tonight so may try this Wednesday evening.

I am not sure I understand what I will need to do with this.
0
TobiasHolmCommented:
Do you get any error messages when booting? Can you send some pictures of those (if you have any error messages)?
0
Atdhe NuhiuAuthor Commented:
I'll check but it will be Wednesday at the earliest.
0
Atdhe NuhiuAuthor Commented:
Got the super grub disk and can now boot from this cd and then boot the installed ubuntu. I can do this in a number of ways, boot linux, find any OS then boot linux, find Grub2.cfg and so on.


I now don't know what I need to do to fix the grub in my MBR. I guess it is something you have posted already.


0
TobiasHolmCommented:
Boot Ubuntu LiveCD and start a terminal window:

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

Reboot!
0
Atdhe NuhiuAuthor Commented:
tried this. having booted to live cd

it seem sda2 should be sda5 now after reinstall

having done this I still get the same problem 'unknown device [long number    ]

Screenshot.png
0
Atdhe NuhiuAuthor Commented:
can this be fixed by booting to the installed linux by using the super grub disk ?
0
Atdhe NuhiuAuthor Commented:
windows is removed from the grub menu and I have used sgd to get into windows
0
TobiasHolmCommented:
Can you boot Ubuntu from your HD via the SGD? If you can, run this command:

$ sudo update-grub

Does the output look like mine? Is Windows found?

Can you list your UUID's and show them?

$ ls -l /dev/disk/by-uuid
1update-grubVIAhdboot.gif
1diskUUID.gif
0
Atdhe NuhiuAuthor Commented:
>Can you boot Ubuntu from your HD via the SGD? If you can, run this  command:

Yes, will try this tonight an post results
0
Atdhe NuhiuAuthor Commented:
output

i'll try and reboot now

Screenshot.png
0
Atdhe NuhiuAuthor Commented:
the grub menu comes up and contains windows and boots to windows

linux gives
error no such device: 7dbb5e76-7910-4088-8aa9-396d7f1139da

strange

0
TobiasHolmCommented:
ok! Now we're almost there! ;)

I've had that UUID error you gets, and I fixed it with the Ubuntu 9.10 Alternative CD. Maybe there are easier ways to fix it, but this is what I did to fix it:

1. Boot Ubuntu 9.10 Alternative CD
2. Repair
3. Start a shell
4. Edit the GRUB-file, uncomment UUID-search code, replace the code with echo "" instead
5. sudo dpkg-reconfigure grub-pc
Unfortunately I don't remember which grub file it was I edited (was a year back).

I'll set up a test system and try to get the UUID-error so that I can test the fix above and give you a better instruction.
0
TobiasHolmCommented:
I couldn't get that UUID error on my test machines, but I think I've found the cause of the error.

Do this:
1. Boot your computer and hold SHIFT to enter the GRUB-menu
2. Select a Linux entry and press 'e'
3. Remove the following line:
     search --no-floppy --fs-uuid --set 7dbb5e76-7910-4088-8aa9-396d7f1139da
4. Press Ctrl+X to boot

Start a terminal.

1. sudo nano /etc/grub.d/10_linux
2. Remove the line: prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
3. Crtl+X to quit Nano and save the file
4. sudo grub-mkconfig -o /boot/grub/grub.cfg
5. Reboot
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Atdhe NuhiuAuthor Commented:
I have downloaded the Ubuntu 9.10 Alternative CD iso but not burned a disc yet.

I have to say again that I am really grateful for your continuing patience and help with this problem. Thank you.
0
Atdhe NuhiuAuthor Commented:
Oh I hadn't seen that latest post.

I am about to turn in so I will give that a try tomorrow

Thanks
0
Atdhe NuhiuAuthor Commented:
Been a bit busy. May get to this tonight
0
Atdhe NuhiuAuthor Commented:
Whey hey! It works.

There is still an error message flashes up just before grub loads but both win and lin boot.

Thanks ever so much for your patience and perseverence
0
TobiasHolmCommented:
I'm glad I could help! ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.