6

I am using a desktop with dual boot options Windows XP and Ubuntu 12.04 and I'm able to use both the systems very well.

Is there any option/method so that instead of logging in to GUI directly, Ubuntu will ask me to boot either GUI or CLI? Is there a setting for this this?

2
  • 1
    By CUI , do you mean CLI ? Command line interface ?
    – Mazal
    Dec 27, 2012 at 9:36
  • @Mazal Probably, yes, I've edited the question. The OP could revert this if he means something different.
    – gertvdijk
    Dec 27, 2012 at 10:38

1 Answer 1

1

You can add a menu option to the GRUB boot menu which specifies that you want to boot into "text" mode. While in the boot menu, select the ubuntu item and hit 'e', then add "text" to the end of the line that begins with "kernel" (it should span across 2 lines in the emacs like editor GRUB2 has.) Press CTRL+X to boot and you should see it boot without starting an X server or desktop manager. However this is a one off solution, below is the solution to add an option in the menu which does this for you.

Adding a menu item with these options:

1) Edit the linux entry to boot to text mode:

Open the entry (should be 10_linux in the grub.d menu entries directory) in your preferred text editor as root (mine is gedit as you see here):

sudo gedit /etc/grub.d/10_linux

And search for the definition of this function "linux_entry ()", this is the first thing that needs changing. Edit the start of this to look like so:

...
linux_entry ()
{
  os="$1"
  version="$2"
  recovery="$3"
  args="$4"
  if [ "${recovery}" = "text" ]; then
    title="$(gettext_quoted "%s, with Linux %s (text mode)")"
  elif ${recovery} ; then
    title="$(gettext_quoted "%s, with Linux %s (recovery mode)")"
  else
    title="$(gettext_quoted "%s, with Linux %s")"
  fi
  printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
  cat << EOF
        recordfail
EOF
  if [ "${recovery}" != "text" -a ! ${recovery} ] ; then
      save_default_entry | sed -e "s/^/\t/"

      cat << EOF
    gfxmode \$linux_gfx_mode
EOF
  fi

Then scroll down to the first call of this function (search for "linux_entry") and add the following line:

#Add this line
linux_entry "${OS}" "${version}" "text" \
    "text ${GRUB_CMDLINE_LINUX}"


#Above/below this
linux_entry "${OS}" "${version}" false \
    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
    quiet

(Which should be near the end of the file.)

Adding it will add it to the menu in the order it is shown in the script, here it goes before, just move it to after the preexisting lines and it wont be the default choice.

2) Update GRUB:

sudo update-grub

3) Reboot and you should see the new text entry in your menu!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .