0

I am looking for a way to add another entry in the grub configuration, so that the kernel stops at runlevel 3.

I dont want to change the /etc/default/grub, but want to add another entry, so that I can choose if I want to boot in the graphical or the console mode.

3 Answers3

2

Editing grub will change all boots. You can add boot entries in 40_custom and edit boot parameters. Copy current boot stanza and edit to change quiet splash to desired parameters.

sudo nano /etc/grub.d/40_custom

After edits:

sudo update-grub

https://help.ubuntu.com/community/Grub2/CustomMenus

How to update grub on a dual boot machine?

oldfred
  • 12,100
1

I had a similar problem which I eventually solved. Maybe it also helps you. Maybe interesting to note is that Ubuntu and its variants do not use the normal runlevels. Whatever you read about working with runlevels, be prepared nothing works. Note that this only works if your desktop is using the LightDM display manager. I am using Xubuntu, but I think Ubunutus Unity is the same.

1) In order to prevernt the login to appear, the responsible DM (LightDM must be modified:

sudo nano /etc/init/lightdm.conf
start on ((filesystem
           and runlevel [!06]
           and runlevel [!03]
           and started dbus
           and plymouth-ready)
          or runlevel PREVLEVEL=S)

2) Change grub:

sudo nano /etc/default/grub
 GRUB_DEFAULT=0
 #GRUB_HIDDEN_TIMEOUT=0
 GRUB_HIDDEN_TIMEOUT_QUIET=true
 GRUB_TIMEOUT=2
 GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian
 #GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
 GRUB_CMDLINE_LINUX="3"
 # comment the next line to disable boot to graphical terminal
 GRUB_TERMINAL=console 
sudo update-grub

That should do it. I did not care to create a new grub menu entry, because its really quick to start the x window desktop. I guess you are aware that startx does not work in Ubuntu.

sudo service lightdm start

If you need that often I would put an alias

alias startx = sudo service lightdm start

Hope it works for you.

CatMan
  • 1,399
0

I am elaborating the hint given by @oldfred.

Assuming you can boot into graphical mode using GRUB, copy the first entry from grub.cfg into 40_custom under /etc/grub.d.

Beware not to overwrite the file 40_custom, because exec tail in the beginning of the file is a MUST.

Look for quiet splash in the entry and delete them. replace them with 'text' ( without quotes ).

Change the menu entry descrition to something like

menuentry 'Ubuntu Command Line' {
.
.
.
.
}

When you reboot, the entry you just created with the description Ubuntu Command line will be shown at the end of your Grub List.

As suggested by @CatMan, login and

sudo service lightdm start

to login into X.