7

I'm running Ubuntu 13.10. I wanted to change the GRUB timeout by editing the /etc/default/grub file. But there was no such file in my system.

On startup the GRUB menu is displayed and I'm not experiencing any boot problems. If this file was so important for booting, why am I nit experiencing any boot problems?

Zanna
  • 70,465
Avinash Raj
  • 78,556
  • If you do not facing any problems... then may I ask; why is that you need to edit the grub file?? – AzkerM Jan 16 '14 at 06:22
  • to set the grub timeout. – Avinash Raj Jan 16 '14 at 06:24
  • The one I found is for 12.04 but still this may help you when you try with sudo .. http://askubuntu.com/a/148097/179042 – AzkerM Jan 16 '14 at 07:13
  • it won't works,there was no such file. – Avinash Raj Jan 16 '14 at 07:19
  • If I'm not mistaken 13.04 uses GRUB ver. 2... It was in /boot/grub/menu.lst and has been replaced by /boot/grub/grub.cfg.. you may have to try /boot/grub/grub.cfg – AzkerM Jan 16 '14 at 07:32
  • In 13.10 the files are in /etc/grub.d/ You can directly edit /boot/grub/grub.cfg but your edits can be overwritten by an update – user3121023 Jan 16 '14 at 14:20
  • i didn't see GRUB_TIMEOUT line on that file. – Avinash Raj Jan 18 '14 at 07:14
  • In my /boot/grub/grub.cfg I found the last occurrence of set timeout=10 and changed it to set timeout=-1 as i wanted the menu to wait for me to make a selection. Works for me but sometimes an update causes me to have to re-edit. – user3121023 Jan 18 '14 at 11:22
  • but there was no such line in my /boot/grub/grub.cfg file. – Avinash Raj Jan 18 '14 at 13:43
  • 2
    Do you have this line in /boot/grub/grub.cfg ### END /etc/grub.d/00_header ###? if so, you could try adding set timeout=-1 just ahead of that line. If you want a short time out use 2 or 5 instead of -1. That is where timeout is in my .cfg file – user3121023 Jan 18 '14 at 14:35

3 Answers3

11

Reinstall the package and hope for the best:

sudo apt-get --reinstall install grub-pc

Actually the file is not critical for the boot, just to configure the boot when you execute sudo update-grub. If the file doesn't exist, then all values are default ones, like you didn't set them up.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • We can also set the grub timeout like this? – Avinash Raj Jan 18 '14 at 15:04
  • "Do you have this line in /boot/grub/grub.cfg" he's presuming you have the file. If you don't have it (as your question suggest) it will do nothing. – Braiam Jan 18 '14 at 15:08
  • yes i have that file and also have the line set timeout=-1 within curly braces. – Avinash Raj Jan 18 '14 at 15:09
  • "I'm trying to change the grub timeout by editing the /etc/default/grub file.But there was no such file in my pc."???? You say in your question that you don't have the file, now you say that you have the file, please decide. – Braiam Jan 18 '14 at 15:10
  • i don't have /etc/default/grub file but i had /boot/grub/grub.cfg. – Avinash Raj Jan 18 '14 at 15:12
  • @AvinashRaj don't modify /boot/grub/grub.cfg by hand. There's a very big notice in the second line that read # DO NOT EDIT THIS FILE. – Braiam Jan 18 '14 at 15:18
  • @AvinashRaj How to get back to default modified /boot/grub/grub.cfg I don't know which lines I changed. – αғsнιη Jun 15 '14 at 18:12
  • @KasiyA grub-mkconfig file automatically re-creates that file so any changes made will be restored. – Ankit Singhaniya Oct 24 '14 at 15:35
5

just copy example from /usr/share/grub/default/grub:

sudo cp /usr/share/grub/default/grub /etc/default/
Zanna
  • 70,465
1

If you really only want to know "why this works", the answer is that LiveCD Ubuntu that you used for installation had this unimportant for boot file \etc\default\grub.cfg, so created yours important for boot /boot/grub/grub.cfg using it.