13

How can I make the RPi auto-login when booted, when the GUI is disabled?

You don't have to type a password, when logging in when GUI enabled, so there is probably an easy way of disabling the password prompt in the console.

  • Very dangerous, I missed the bit about not having a password and seemed to have screwed up the SD card. Be warned! – user7670 May 28 '13 at 17:08
17

For Raspbian Wheezy:

You should be able to edit the /etc/inittab file to enable autologin.

Find a line like this in /etc/inittab

1:2345:respawn:/sbin/getty --noclear 38400 tty1

This starts the getty process on tty1. You can add the getty --autologin option to that line:

1:2345:respawn:/sbin/getty --autologin {USERNAME} --noclear 38400 tty1

Replace {USERNAME} with the user you want to login.

Note I have not tested this, check the manpage for getty for more details.

Update: Raspbian Jessie uses systemd so inittab is not used. Here is a FAQ that may help for Jessie: https://fedoraproject.org/wiki/Systemd#How_do_I_set_automatic_login_on_a_virtual_console_terminal.3F

The FAQ is for Fedora but it should be very similar on Raspbian Jessie.

  • 1
    I have tested it; it works fine. Also, put something in ~/.bash_profile and that will get run automatically after you are logged in. – greggo Jan 18 '13 at 18:28
  • 2
    Please update the answer! There is no /etc/inittab file in raspbian jessie. – Oki Erie Rinaldi Dec 1 '15 at 15:39
  • @OkiErieRinaldi I have added a link that may help with Jessie. – Craig Dec 1 '15 at 16:35
  • No, I still get the login prompt upon boot. – IgorGanapolsky Jul 18 '16 at 2:04
  • The Raspbian Jessie solution doesn't work. – piepi Jan 1 '17 at 3:22
4

there is an easier way to do this using raspi-config this article explains it http://www.opentechguides.com/how-to/article/raspberry-pi/5/raspberry-pi-auto-start.html

showing :

  1. how to auto login to the shell prompt (using a method similar to above)
  2. Run scripts at startup
  3. Auto start the desktop using raspi-config
  • 1
    this article shows how to auto login to the desktop using raspi-config, but the question is asking how to auto login when there is no GUI or Desktop (so bringing up the shell prompt). However this article also shows how to auto login to the shell as well. – kolin May 15 '13 at 8:57
2

This worked for me with Jessie Lite:

sudo -i
mkdir -pv /etc/systemd/system/getty@tty1.service.d
nano /etc/systemd/system/getty@tty1.service.d/autologin.conf

contents:

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux

only catch is that I can't logon using SSH anymore - access denied. :-(

  • 1
    A good answer should give an indication as to why it works. What do the those two steps do? Can you really say it works if it breaks SSH? – Jacobm001 Mar 4 '16 at 15:51
  • This doesn't work! Still forces me to login at command line. – IgorGanapolsky Jul 18 '16 at 2:16
  • does using $TERM work for you? ExecStart=-/usr/bin/agetty --autologin username --noclear %I $TERM – esharp Aug 1 '16 at 8:54
0

If you want auto-login to Raspberry Pi on Serial line, you need to edit the /etc/inittab file on pi with sudo permissions.

Find a line like this in /etc/inittab

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Add the getty --autologin option to that line.

T0:23:respawn:/sbin/getty --autologin {username} -L ttyAMA0 115200 vt100

Save and Reboot.

  • What is T0:23?? I thought it should be 1:2345. – IgorGanapolsky Jul 18 '16 at 2:18
0

I'm running NOOBS and had a slightly different inittab file. Here's what I changed that combined both the "--autologin" on the T0 line and the 1:2345 line:

#1:2345:respawn:/sbin/getty --noclear 38400 tty1"
1:2345:respawn:/bin/login -f pi tty1 <dev/tty1 >/dev/tty1 2>&1
T0:23:respawn:/sbin/getty --autologin pi - L ttyAMA0 115200 vt100
0

so lightdm.conf method didnt work for me, after a bit of playing around the easiest method I found was below.

cd /etc/systemd/system/

from there type: ls

you will see autologin@.service

just sudo nano autologin@.service

and change line ExecStart=-/sbin/agetty --autologin pi --noclear % I $TERM

to

ExecStart=-/sbin/agetty --autologin [Username] --noclear % I $TERM

where [Username] is put the user you wish to login without the brackets.

now I did have pi auto login working using the raspi-config setup, but used the above method to change the autologin for a new user.

hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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