Announcement

Collapse
No announcement yet.

<SOLVED> reinstalling grub to dual boot machine - encountering small problem

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    <SOLVED> reinstalling grub to dual boot machine - encountering small problem

    I have a box with WinXP in partition 1, Linux swap in 2, Kubuntu root in 3, and /home in 4. I got in trouble with gparted, and have been working my way back to a functioning system. I'm now at the point where I simply need to reinstall grub.

    I'm working on an HP mini netbook. I have a USB optical drive attached, with my Kubuntu live CD in it.

    Code:
    df -h
    tells me that the USB optical drive is /dev/sr0

    I was told to use this two commands to reload grub:
    Code:
    sudo mount /dev/sda3 /mnt
    sudo grub-install --root-directory=/mnt/boot /dev/sda
    The result of this was [1] no errors reported, and [2] when I try to boot, I get a black and white screen with "GNU GRUB version 1.98-1ubuntu5" at the top, a 3-sentence brief instruction paragraph (of general rather than specific helpfulness, to me), then a "grub>" command line prompt.

    I don't know what to do next. I'm guessing I have to construct some file containing some commands Just a guess. Going off to research this. Meanwhile, if anyone can direct me, I'd be grateful.

    #2
    Re: reinstalling grub to dual boot machine - encountering small problem

    Your mount command doesn't look quite right to me. You need a filesystem type, for one thing, and your root filesystem would appear from your description to be on /dev/sda3. You can confirm it with
    Code:
    sudo fdisk -lu
    Assuming your root filesystem is ext4, and located on /dev/sda3:

    Code:
    sudo mount -t ext4 /dev/sda3 /mnt
    then

    Code:
    sudo grub-install --root-directory=/mnt /dev/sda
    should do it. Here's Qqmike's guide: http://kubuntuforums.net/forums/inde...opic=3106368.0

    Comment


      #3
      Re: reinstalling grub to dual boot machine - encountering small problem

      OK, I'll admit I'm avoiding plowing through Qqmike's document, as I hope not to be spending all day on this project (possible foolish hope...).

      My linux root filesystem is ext3, not 4; it is indeed located on /dev/sda3

      So I issued this command:
      Code:
      sudo mount -t ext3 /dev/sda3 /mnt
      Then this:
      Code:
      ubuntu@ubuntu:~$ sudo grub-install --root-directory=mnt /dev/sda
      mkdir: cannot create directory `mnt/boot': No such file or directory
      ubuntu@ubuntu:~$ df -h
      Filesystem      Size Used Avail Use% Mounted on
      aufs         498M  15M 483M  3% /
      none         493M 276K 493M  1% /dev
      /dev/sr0       695M 695M   0 100% /cdrom
      /dev/loop0      647M 647M   0 100% /rofs
      none         498M   0 498M  0% /dev/shm
      tmpfs         498M 8.0K 498M  1% /tmp
      none         498M  80K 498M  1% /var/run
      none         498M   0 498M  0% /var/lock
      none         498M   0 498M  0% /lib/init/rw
      /dev/sda3       13G 5.8G 6.4G 48% /mnt
      I don't see the problem, much less the solution...any ideas?

      Comment


        #4
        Re: reinstalling grub to dual boot machine - encountering small problem

        Hmmm. The error message suggests that either the mount command failed to mount it, or we've still not found the root filesystem.

        From a fresh boot of your Live CD, can you post the output of
        Code:
        sudo fdisk -lu
        please?

        Comment


          #5
          Re: reinstalling grub to dual boot machine - encountering small problem

          Thanks for quick response. Here it is:
          Code:
          ubuntu@ubuntu:~$ sudo fdisk -lu
          
          Disk /dev/sda: 160.0 GB, 160041885696 bytes
          255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
          Units = sectors of 1 * 512 = 512 bytes
          Sector size (logical/physical): 512 bytes / 512 bytes
          I/O size (minimum/optimal): 512 bytes / 512 bytes
          Disk identifier: 0x00080531
          
            Device Boot   Start     End   Blocks  Id System
          /dev/sda1  *    2048  78140159  39069056  7 HPFS/NTFS
          /dev/sda2    78140160  82043954   1951897+ 82 Linux swap / Solaris
          /dev/sda3    82043955  109386584  13671315  83 Linux
          /dev/sda4    109386585  312576704  101595060  83 Linux
          ubuntu@ubuntu:~$

          Comment


            #6
            Re: reinstalling grub to dual boot machine - encountering small problem

            Yep, /dev/sda3 does appear to be the correct partition for the root filesystem.

            Hmmm. Let's try making a directory under /mnt on your running Live CD:

            Code:
            sudo mkdir -p /mnt/sda3
            now

            Code:
            sudo mount -t ext3 /dev/sda3 /mnt/sda3
            Check that we did what we meant to do, with

            Code:
            ls /mnt/sda3
            and hopefully you will see the top level contents of your Kubuntu filesystem. If that looks right, then again:

            Code:
            sudo grub-install --root-directory=mnt/sda3 /dev/sda
            and perhaps we'll have better luck. If there are no errors, shutdown the Live CD and try booting the computer.

            Comment


              #7
              Re: reinstalling grub to dual boot machine - encountering small problem

              Sorry for the delay...phone calls.

              It went well but ended badly...
              Code:
              ubuntu@ubuntu:~$ sudo mkdir -p /mnt/sda3
              ubuntu@ubuntu:~$ sudo mount -t ext3 /dev/sda3 /mnt/sda3
              ubuntu@ubuntu:~$ ls /mnt/sda3
              bin  cdrom dev home    initrd.img.old lost+found mnt proc sbin selinux sys usr vmlinuz
              boot data  etc initrd.img lib       media    opt root sda3 srv   tmp var vmlinuz.old
              ubuntu@ubuntu:~$ sudo grub-install --root-directory=mnt/sda3 /dev/sda
              mkdir: cannot create directory `mnt/sda3/boot': No such file or directory
              ubuntu@ubuntu:~$

              Comment


                #8
                Re: reinstalling grub to dual boot machine - encountering small problem

                Huh -- something wrong with that Grub command format, I guess -- everything else seems to be right. Here's a notion -- can you try it like this:

                sudo grub-install --root-directory=/mnt/sda3 /dev/sda
                ?

                Comment


                  #9
                  Re: reinstalling grub to dual boot machine - encountering small problem

                  Well...
                  Code:
                  ubuntu@ubuntu:~$ sudo grub-install --root-directory=mnt/sda3 /dev/sda
                  mkdir: cannot create directory `mnt/sda3/boot': No such file or directory
                  ubuntu@ubuntu:~$ sudo grub-install --root-directory= / mnt/sda3 /dev/sda
                  More than one install_devices?
                  Usage: grub-install [OPTION] install_device
                  Install GRUB on your drive.
                  
                   -h, --help       print this message and exit
                   -v, --version      print the version information and exit
                   --modules=MODULES    pre-load specified modules MODULES
                   --root-directory=DIR  install GRUB images under the directory DIR
                               instead of the root directory
                   --grub-setup=FILE    use FILE as grub-setup
                   --grub-mkimage=FILE   use FILE as grub-mkimage
                   --grub-probe=FILE    use FILE as grub-probe
                   --no-floppy       do not probe any floppy drive
                   --recheck        probe a device map even if it already exists
                   --force         install even if problems are detected
                   --disk-module=MODULE  disk module to use
                  
                  INSTALL_DEVICE can be a GRUB device name or a system device filename.
                  
                  grub-install copies GRUB images into /boot/grub (or /grub on NetBSD and
                  OpenBSD), and uses grub-setup to install grub into the boot sector.
                  
                  If the --root-directory option is used, then grub-install will copy
                  images into the operating system installation rooted at that directory.
                  
                  Report bugs to <bug-grub@gnu.org>.
                  ubuntu@ubuntu:~$

                  Comment


                    #10
                    Re: reinstalling grub to dual boot machine - encountering small problem

                    It's hard for me to see for certain, but it appears (in the command) that there is a space between the "/" and "mnt", which is NOT supposed to be there.

                    Comment


                      #11
                      Re: reinstalling grub to dual boot machine - encountering small problem

                      Yes, there was. It looked to me like you'd put one there - I think now that was an illusion created by the fact that the "/" you inserted was bolded. Just guessing. In any case, a retry...

                      Code:
                      ubuntu@ubuntu:~$ sudo mkdir -p /mnt/sda3
                      ubuntu@ubuntu:~$ sudo mount -t ext3 /dev/sda3 /mnt/sda3
                      ubuntu@ubuntu:~$ ls /mnt/sda3
                      bin  cdrom dev home    initrd.img.old lost+found mnt proc sbin selinux sys usr vmlinuz
                      boot data  etc initrd.img lib       media    opt root sda3 srv   tmp var vmlinuz.old
                      ubuntu@ubuntu:~$ sudo grub-install --root-directory=/mnt/sda3 /dev/sda
                      Installation finished. No error reported.
                      ubuntu@ubuntu:~$
                      Trying boot...

                      Comment


                        #12
                        Re: &lt;SOLVED&gt; reinstalling grub to dual boot machine - encountering small problem

                        Dibl - thanks for sticking with me. It boots just fine now. All's well.

                        My WinXP won't boot, of course. I'll need to acquire the sys-restore disks from HP (available only by request - I wonder how much they save by that little tactic), then I can repair THAT. Definitely not my major concern, thought. Getting my KB install back with everything intact was the goal, and that's now been done. It's good to be back on solid ground!

                        Thanks again for shepherding me the final 10 miles, and to Oshynluvr for getting me well on my way to begin with.

                        Comment


                          #13
                          Re: &lt;SOLVED&gt; reinstalling grub to dual boot machine - encountering small problem

                          Heh -- we made that look easy, huh?

                          Comment


                            #14
                            Re: &lt;SOLVED&gt; reinstalling grub to dual boot machine - encountering small problem

                            A "Twelve step program" as based on dibl's last post.
                            Windows no longer obstructs my view.
                            Using Kubuntu Linux since March 23, 2007.
                            "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                            Comment

                            Working...
                            X