0

Whenever I boot my laptop, the grub terminal comes up and I have to input the following three lines to boot into my OS:

linux (hd0,msdos1)/vmlinuz root=/dev/sda1
initrd (hd0,msdos1)/initrd.img
boot

What options should I add to /etc/default/grub so that grub wouldn't need manual input at boot?

  • http://askubuntu.com/questions/265010/how-do-i-edit-grub-menu – sk29910 Sep 11 '14 at 23:42
  • @sebastian_k I've already looked at many guides like the one you posted, but none of them tell me what parameters at the grub file match the commands I'm entering at the grub shell. For example where in the file do I put the path to the kernel image? – Ikram Hawramani Sep 11 '14 at 23:46
  • I see, sorry. Have you tried the graphical editors, like http://askubuntu.com/questions/365760/graphical-grub-editor-for-ubuntu-13-10 ? – sk29910 Sep 11 '14 at 23:53

1 Answers1

1

This is not something you can change in /etc/default/grub, you need to add a new entry to the GRUB menu. Create a file /etc/grub.d/09_custom with these contents:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry 'Ubuntu' {
    linux (hd0,msdos1)/vmlinuz root=/dev/sda1
    initrd (hd0,msdos1)/initrd.img
}

Make it executable

sudo chmod +x /etc/grub.d/09_custom

and run sudo update-grub. This should add a new entry at the top of the GRUB config file, so when you reboot it should be booted automatically by default.

To reverse the changes, delete 09_custom and re-run sudo update-grub.

fkraiem
  • 12,555
  • 4
  • 35
  • 40
  • Cute! However, the generated grub.cfg is on the current partition. If the system doesn't find the correct grub.cfg, from the grub.cfg in the efi partition, it is the latter the one to correct. – Ale May 31 '23 at 16:53