LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-02-2015, 10:07 AM   #1
Higgsboson
Member
 
Registered: Dec 2014
Location: UK
Distribution: Debian 8 Cinnamon/Xfce/gnome classic Debian live usb
Posts: 508

Rep: Reputation: 49
Grub directory has disappeared - can't reinstall grub


I have tried installing a Ubuntu OS onto a partition (sda3).
When I had difficulties with the install, I decided to delete everything from the partition.

But now when I boot the computer, I get taken to the 'grub rescue' prompt.
I have tried to find grub in my other partitions (sda1 and sda2).
However, the command 'ls (hd0,msdos1)/' for example, does not show a grub directory.
It must've transferred grub to sda3 somehow and now I've deleted it.

I have debian live USB and am trying to install grub with:
Code:
apt-get install-grub /dev/sda
But I get the error message:
Code:
bash: grub-install: command not found
So now I don't know what's going on. Can anyone please help?
 
Old 02-02-2015, 10:23 AM   #2
colorpurple21859
Senior Member
 
Registered: Jan 2008
Location: florida
Distribution: slackware64-current, puppy, ubuntu
Posts: 1,906

Rep: Reputation: 262Reputation: 262Reputation: 262
This should help http://karuppuswamy.com/wordpress/20...-cd-for-grub2/
 
1 members found this post helpful.
Old 02-02-2015, 01:25 PM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,872

Rep: Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249
What is on sda1 and sda2? Do you have other operating systems there? Did you actually install Ubuntu and its Grub bootloader and have problems after the installation? Did you not complete the installation? Unless you had a separate /boot partition, almost all the files needed to boot Grub were on the Ubuntu partition you deleted.
 
Old 02-02-2015, 02:02 PM   #4
Higgsboson
Member
 
Registered: Dec 2014
Location: UK
Distribution: Debian 8 Cinnamon/Xfce/gnome classic Debian live usb
Posts: 508

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by colorpurple21859 View Post
I came across this link a couple of times but found it a little difficult.
But I eventually decided to use its 'live cd' method and it sorted out the problem. http://karuppuswamy.com/wordpress/20...rescue-prompt/

For debian, the commands were as follows - I lifted them from replica9000's debootstrap tutorial.
Code:
root@debian:/# mkdir mnt/deboot
root@debian:/# mount /dev/sda1 /mnt/deboot
root@debian:/# mount -o bind /dev /mnt/deboot/dev
root@debian:/# mount -o bind /proc /mnt/deboot/proc
root@debian:/# mount -o bind /sys /mnt/deboot/sys
root@debian:/# chroot /mnt/deboot
root@debian:/# grub-install /dev/sda
Installation finished. No error reported.
root@debian:/# update-grub
Thanks for your reply.
 
Old 02-02-2015, 02:20 PM   #5
Higgsboson
Member
 
Registered: Dec 2014
Location: UK
Distribution: Debian 8 Cinnamon/Xfce/gnome classic Debian live usb
Posts: 508

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by yancek View Post
What is on sda1 and sda2? Do you have other operating systems there? Did you actually install Ubuntu and its Grub bootloader and have problems after the installation? Did you not complete the installation? Unless you had a separate /boot partition, almost all the files needed to boot Grub were on the Ubuntu partition you deleted.
I have two seperate debian OSs on sda1 and sda2.
Ubuntu and grub were installed on sda3 - but there was a problem when booting. I just got a black screen.

When I used my debian live USB, it gave me an option to do an install.
When I selected the GUI install, I think it said there was a network problem. I'll have to refine my method of doing the install using debootstrap.

I didn't realise grub actually transfers to the partition with the new install. But I know it now! Thank you.
 
Old 02-02-2015, 03:26 PM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,872

Rep: Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249
Quote:
ls (hd0,msdos1)/
If you changed the command above to the one below, you should see the grub directory because it is in the /boot directory.

Quote:
ls (hd0,msdos1)/boot
Any system using Grub (Legacy or Grub2) has almost all the boot files on the partition and just a small part of the code in the MBR. If you use a separate /boot partition, then the majority of the Grub files are there so it does this as part of the installation of the bootloader. This is with MBR BIOS setups.
 
Old 02-02-2015, 04:20 PM   #7
Higgsboson
Member
 
Registered: Dec 2014
Location: UK
Distribution: Debian 8 Cinnamon/Xfce/gnome classic Debian live usb
Posts: 508

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by yancek View Post
If you changed the command above to the one below, you should see the grub directory because it is in the /boot directory.
Oh man, really?
When I couldn't find the grub directory, I wanted to do the following commands:
Code:
set prefix="(hd0,msdos1)/boot/grub"
set root="(hd0,msdos1)"
insmod normal
normal
But when I input 'insmod normal' - I got an error message.
I can't remember the message, but are the above commands ok to get grub back from the grub rescue prompt?

The grub rescue prompt is encouraging to see.
But there appears to be no tutorials on how to use it simply to get grub working again.

Quote:
Any system using Grub (Legacy or Grub2) has almost all the boot files on the partition and just a small part of the code in the MBR.
This makes sense.
But why was grub not able to boot after I deleted my failed install on sda3?
I thought grub must've transferred to sda3, and so when I cleared sda3 I had also cleared the grub bootloader.

Quote:
If you use a separate /boot partition, then the majority of the Grub files are there so it does this as part of the installation of the bootloader. This is with MBR BIOS setups.
I don't have a seperate boot partition yet. I also have BIOS.
With grub now re-installed, I can access all my partitions.
But the grub page has now changed.
It's saying Win7 is now sda1. But it is actually sdb1.
A simple 'lsblk' on the terminal shows that all my partitions are unchanged and correct.

How can I get grub to refer to the partitions by their correct names on the bootloader page?
I ran os-prober and then did 'update-grub' but it hasn't worked.
Also come to think of it, there are a bunch of 'memtest' options and now a 'multiboot' option.
I don't know what they mean and why they're there.
Sorry for all the questions.
 
Old 02-02-2015, 07:26 PM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,872

Rep: Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249
Quote:
I can't remember the message, but are the above commands ok to get grub back from the grub rescue prompt?
No, you need a line for the kernel and almost always initrd. The site below gives an example, scroll down to booting from Grub. It also has a lot of useful information on Grub2 in general.

http://www.linux.com/learn/tutorials...ub-2-on-linux/

Quote:
I thought grub must've transferred to sda3, and so when I cleared sda3 I had also cleared the grub bootloader.
If you install Debian on sda1, it will have grub files on that partition. If you install Ubuntu on sda2, it will have Grub files there. Any partition with a Linux install will have Grub files unless you have a separate boot or grub partition. The only thing that makes sense in your situation is you got to the part of the Ubuntu install which installed the bootloader to the mbr pointing to the Ubuntu partition and if you delete it, the results you had would be expected.

Wouldn't be able to tell you why sda1 shows as windows, this is the first mention that you windows anywhere. If everything boots, I wouldn't worry about it. Windows is usually on the first drive. The memtest is to do a memory test and it is a file in the boot partition. On my current system, it shows as 176KB in size so unless you have a 10GB or smaller hard drive, don't worry about it.

If you want more specific answers, you could download and run the bootinfoscript and review the output, a results.txt file, or post it here and someone should be able to help. Not sure what the 'multiboot' option would be. Did you not put it there? What happens when you select it from the boot menu?
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 11:56 PM
[SOLVED] Grub failure and problems with grub or ubuntu reinstall. bboy2448 Linux - General 9 05-12-2011 07:18 AM
Grub error 17, and wont reinstall using grub-install! chiefreborn Linux - General 6 06-06-2007 11:29 AM
/grub/menu.lst file disappeared but computer still boots (grub) rrrssssss Linux - General 5 04-08-2007 10:02 AM
Grub has disappeared Hit3k Linux - General 4 12-05-2005 05:33 PM


All times are GMT -5. The time now is 05:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration