8

I would like to settup my Raspberry Pi to auto login in a specific user. I googled this and the solutions that i found were about editing the /etc/inittab file. My problem is now i dont have that file, it appears to be missing in my version of Raspbian. Is there another way to do this?

ADTank
  • 85
  • 1
  • 2
  • 6

4 Answers4

6

My autologin.conf file appears as below. Note the %I, my pi hangs otherwise:

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux
muru
  • 4,723
  • 1
  • 34
  • 78
Steve
  • 61
  • 2
  • 3
    Not sure why this was downvoted. The solution @TomMekken 's solution didn't work for me, but @Steve 's did. For me the "extra" `ExecStart=` was critical. – Aaron Aug 23 '16 at 12:01
  • this definitely works for the newest Raspberry 9 Stretch – user960914 Dec 20 '18 at 15:23
5

I assume you're using the latest Raspian-Image (jessie). This one is based on Debian 8 (jessie) where the init-system changed from sysvinit to systemd. I think that it could have something to do with your problem. If you google: raspbian jessie auto login you should find a solution for your problem.

p.e. this link provides a possible solution:

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

insert the following text:

[Service]
ExecStart=-/sbin/agetty --autologin $username --noclear I 38400 linux

make sure that $username is your username

Then reboot.

optional:

If you want to start the X-Server automatically, just add the following line at the end of your ~/.profile

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
Tom Mekken
  • 1,019
  • 1
  • 12
  • 27
2

I found this, which is the only thing that worked for me.

Automatic Login for LightDM

Open the terminal and make first a backup of the file we are going to edit:

su - 
gedit /etc/lightdm/lightdm.gedit /etc/lightdm/lightdm.conf.back

Edit now this file:

gedit /etc/lightdm/lightdm.conf

or

nano /etc/lightdm/lightdm.conf

Uncomment these two lines:

autologin-user=USERNAME
autologin-user-timeout=0

Replace USERNAME with your own username. Save the file and exit. Run now this command so that changes are taken into effect:

dpkg-reconfigure lightdm 
Nico
  • 21
  • 1
2

I use raspi-config:

pi@raspberrypi:~ $ sudo raspi-config
Created symlink /etc/systemd/system/default.target → /lib/systemd/system/graphical.target.

There's a menu that comes up wherein you select Boot Options then something along the lines of B1 Boot Desktop Options and finally you select among several auto login options.

See: https://raspberrypi.stackexchange.com/questions/48241/auto-login-in-jessie-how

Hack-R
  • 22,422
  • 14
  • 75
  • 131
  • 1
    This is by far the easiest option. Boot Options > Desktop / CLI > Console Autologin. The symlink wasn't necessary -- just launch raspi-config and select the option. – itnAAnti Jun 04 '18 at 15:49