1

I installed grub2 to dual boot another OS alongside my Ubuntu 12.04 LTS, but decided against it at the last second.

So I just did sudo apt-get purge grub, and it said it had purged all grub files, so I rebooted and guess what appears? Grub.

How do I get rid of it?. I'm worried that the only way to get rid of it is to format my hard drive, or worse, even that won't help.

EDIT:

Basically I am only running Ubuntu 12.04 LTS and would like it to go back to doing what it used to do, which was booting itself with no annoying grub UI, just the quick F12 boot menu BIOS stuff then boot.

Hans
  • 1,281
  • 1
  • 20
  • 44
user241132
  • 11
  • 3
  • 1
    grub is what ubuntu uses to boot, do you want to disable Ubuntu as well? or do you just want to hide the boot selection screen? – Mateo Jan 28 '14 at 21:11
  • Removing Grub means that your system won't boot, unless you have another bootloader - what other OS are you using? You can hide the boot selection screen easily. – Wilf Jan 28 '14 at 21:11
  • 1
    @wilf To me it looks like the OP wants just to hide the selection, like you said. You might want to write up the steps in an answer :) – Travis G. Jan 28 '14 at 21:23
  • 1
    @TravisG. If indeed Ubuntu already uses grub to boot then I suppose that hiding the selection screen is probably what I have to do. If you could tell me how to do that or at least refer me to a post that would be great! Also my GRUB_HIDDEN-TIMEOUT is already 0 – user241132 Jan 28 '14 at 21:26
  • Use GRUB_TIMEOUT=0. I may have just answered it for you :-) – Wilf Jan 28 '14 at 21:28

2 Answers2

1

You can use get Grub to boot straight into Ubuntu without waiting by setting the value

GRUB_HIDDEN_TIMEOUT=0

In your /etc/default/grub file. This will select the default option on the list (I assume this is Ubuntu for you) and go straight in.

Mendhak
  • 4,440
  • That may be the wrong option - http://www.gnu.org/software/grub/manual/grub.html#Simple-configuration – Wilf Jan 28 '14 at 21:28
0

To repair the bootloader:

To restore Grub to your system, if you have removed, or part-done another installatiob, installed Windows, etc:

sudo grub-install /dev/sdX

Where sdX gives your hard disk entry under /dev. Usually this is /dev/sda, but it can vary if it is on an external drive or something. You can find the disk entry in:

sudo fdisk -l

After, that run this (May not be required, but it should not hurt:)

sudo update-grub

You can check with:

sudo grub-install --recheck /dev/sdX 

To make Grub nor show on boot:

Edit/etc/default/grub:

sudo nano /etc/default/grub

and add/change this line:

GRUB_TIMEOUT=0

then run this to update the changes:

sudo update-grub

When it is runnning you will get something like this:

USERNAME@HOSTNAME:~$ sudo update-grub
[sudo] password for USERNAME:
Generating grub.cfg ... Found linux image:
/boot/vmlinuz-3.11.0-15-generic Found initrd image:
/boot/initrd.img-3.11.0-15-generic Found linux image:
/boot/vmlinuz-3.11.0-12-generic Found initrd image:
/boot/initrd.img-3.11.0-12-generic Found memtest86+ image:
/boot/memtest86+.bin
Found Fedora release 20 (Heisenbug) on /dev/sda2
done USERNAME@HOSTNAME:~$

The Ubuntu kernels would likely be the linux and and initrd entries, other Operating Systems should appear after Found ...

Manual on configuring grub here


Other useful stuff:

You can also set this in /etc/default/grub:

GRUB_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT=3

Which would mean that it would not display the selection menu for 3 seconds, allowing you to use it if you need to by pressing Any Key, and then it would boot.

If you want the kernel that is selected in the menu to always be the default selection, add/change these lines:

GRUB_SAVEDEFAULT=true
GRUB_DEFAULT=saved

Remember to run sudo update-grub to update the changes (or it won't do anything), and there is the manual for more options.

For easier and more advancded configuration of Grub, you may want to use Grub Customizer

If you did remove grub, you may need to reinstall it with apt-get. Grub is the bootloader for most Linux systems, this problem likely would of been caused by the Debian Grub overwriting the Ubuntu Grub.

Wilf
  • 30,194
  • 17
  • 108
  • 164
  • I have set my grub file to those settings and when I rebooted it still went to the line bash terminal thing, so it hasn't worked :( Any other ideas – user241132 Jan 28 '14 at 21:33
  • If you get a flashing underscore _ after GRUB, that is filling the time after Grub boots the kernel, and before the splash screen (plymouth) appears. You can't really remove that, just ignore it. It is there to show it is working and doing something - it is better than staring at a blank screen. – Wilf Jan 28 '14 at 21:36
  • I can't quite remember but when I did it I had to do all the set root=(hd0,1) stuff and /vmlinuz and all that to get into Ubuntu. Is it possible I haven't set a default kernel and if so how do I set it to Ubuntu? – user241132 Jan 28 '14 at 21:37
  • You shouldn't need to select it... It is just showing what it has found. – Wilf Jan 28 '14 at 21:39
  • I will try again and see what happens and I will look out for the flashing underscore then report back – user241132 Jan 28 '14 at 21:40
  • Ok it came up with a flashing underscore but nothing happened so I had to boot it myself again, I really can't think what it is doing, but if there is a way to restore to a previous Ubuntu (I haven't backed anything up) that would be helpful... Any suggestions? – user241132 Jan 28 '14 at 21:43
  • If you need to select the kernel to boot from in GRUB, you need select that, and boot. Then add the lines GRUB_SAVEDEFAULT=true and GRUB_DEFAULT=saved. Then update the changes. This will mean that upon selecting the kernel on the next boot, it will from then onwards boot that by default. – Wilf Jan 28 '14 at 22:11
  • how do I choose the default kernel to boot, I'm a bit of a newbie so I'm not really sure what to do :/ – user241132 Jan 28 '14 at 22:16
  • Go to the Grub selection menu you were so desperate to remove, and select the entry Ubuntu, with kernel whatever. It may be under Advanced Options for Ubuntu. When you mean 'restore the previous Ubuntu' what did you do exactly to stop it booting - did you try installing another Ubuntu as well, but cancel it? And are you able to use a graphical interface? Normally you don't need to enter BIOS to boot Ubuntu... – Wilf Jan 28 '14 at 22:20
  • Ok basically I wanted to dual boot Ubuntu with Debian (long story dw) and decided against it at the last second. So, I simply did sudo apt-get remove grub, which it said i had done, but then when I rebooted my computer it came up with a strange text-based grub bash terminal. I can get into Ubuntu and use the GUI but it takes a load of code that I don't want to have to type in. – user241132 Jan 28 '14 at 22:24
  • So the title to the question should be 'How to repair Ubuntu bootloader after installing Debian?' ? :-S – Wilf Jan 28 '14 at 22:28
  • Ok I didn't know that Grub was the original bootloader sorry, but is there a way to get it to auto boot again? – user241132 Jan 28 '14 at 22:32
  • Edited answer - you may want to edit your question :-) – Wilf Jan 28 '14 at 22:33