I've installed Ubuntu 12.04 & and edited the /etc/default/grub file to auto boot into text mode. but every time I turn on the computer it asks for username and password (in text mode), I wanted it to automatically login without asking for username and password, so in graphical mode I went to "System Setting->User Accounts" and checked the "Automatic login", but it didn't work. so what should I do to automatically log in even in text mode?

up vote 8 down vote accepted

To boot into text mode

sudo vim /etc/default/grub

and change the following line:

GRUB_CMDLINE_LINUX_DEFAULT="text"

exit and enter:

 sudo update-grub

Automatically login in text mode without specifying userid or password

Upstart Versions of Ubuntu

Add -a <your-user-name> to the line:

exec /sbin/getty -8 38400 tty1

in file /etc/init/tty1.conf

like so:

exec /sbin/getty -8 38400 tty6 -a gruber

/etc/init/tty1.conf is the upstart job that runs at the appropriate time to start the terminal session on tty1. Adding the -a option tells getty to call the login program with the -f option to sign that user in, bypassing the user prompt from getty and the password prompt from login.

Upstart is the Ubuntu system that operates as the kernel init process (process 1).

I tested this on my tty6 and it worked great. Because of the upstart respawn line if you exit the shell it will start back up again automatically.

Systemd Versions of Ubuntu

Newer versions of Ubuntu use mostly systemd to manage system processes. Therefore there are new ways of doing things.

systemd tty usage is also a little different with graphics terminals possibly running on the first few virtual terminals. tty6 is reserved to be a text virtual terminal with systemd and there will probably be others as well.

To have tty6 come up signed on as you enter:

sudo systemctl edit getty@tty6

A nano editor will come up in a temporary file. Enter the following into that editor:

 [Service]
 ExecStart=
 ExecStart=-/sbin/agetty -o '-p -f gruber' -a gruber --noclear %I $TERM

Exit the editor.

Putting in the extra ExecStart= line is not a typo. it's very important as it tells systemd to forget about the original ExecStart parameter it already knows about (from /lib/systemd/system/getty@.service) so you can replace ExecStart.

You can check the results with the following command:

 systemd-analyze verify getty@tty6.service

I see some warnings there when I try this, but not about what we are doing here.

If there is already a tty process going on tty6 you'll have to restart it to see the results.


To figure this out I referred to the excellent answer at https://askubuntu.com/a/659268/63886. There Muru happened to use the same goal as an example on how to tailor systemd. His ExecStart line is:

 ExecStart=-/sbin/agetty -a muru --noclear %I $TERM

The difference appears to be a couple more systemd related environmental variables appear in my version.

The end result of the above edit is the creation of a file called override.conf in /etc/systemd/system/getty@tty6.service.d/ containing just what you typed above. If you were to create such a file yourself you would need to run the systemctl daemon-reload command to get systemd to recognize it, and again then possibly restarting any existing agetty process on that virtual console. systemctl --edit takes care of the daemon-reload for you.

  • 1
    tty1 worked fine for me. – razzak Mar 26 '16 at 17:28
  • 1
    There are no /etc/init/tty* files on my system – ka3ak Sep 29 at 8:05
  • @ka3ak Thanks for bringing that up. Newer Ubuntu's use systemd and the startup config files are different in content and location. I've updated the answer with a systemd section. If you decide to try it please read Muru's answer too. – John S Gruber Oct 3 at 1:36

open terminal and do as

sudo kate /etc/default/grub

then find this line and change as shown below

GRUB_CMDLINE_LINUX_DEFAULT="text"

now close the editor and do as

sudo update-grub 

and do restart now

  • I like this answer, but you may want to add a from: to: section for the find this line and change part – RobotHumans May 26 '12 at 7:31
  • I've followed the instructions but it still boots to the GUI. Could it be because I'm using virtual box? – errorhandler May 26 '12 at 7:37

sudo gedit etc/default/grub

and replace

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="text"

Also comment GRUB_HIDDEN_TIMEOUT=0 This line is for unhiding the GRUB menu (comment is to put "#" in the line )

sudo update-grub

and to start the x just type startx

  • 1
    No, I've done this before, I just want that the text mode doesn't ask for username and password – Navid777 Aug 13 '12 at 10:15
sudo update-rc.d -f gdm remove

If you use Kubuntu, replace gdm with kdm in the command above.

if it still does the graphical boot/shutdown, but it will drop you at the command line after boot. You should probably check the grub configuration. For that Click Here

  • I tried that but it still boots into the GUI – errorhandler May 26 '12 at 7:18
  • Then you may want to try GRUB configuration. – Mitch May 26 '12 at 7:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.