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?

3

4 Answers 4

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
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, 2016 at 12:01
  • this definitely works for the newest Raspberry 9 Stretch
    – user960914
    Dec 20, 2018 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/[email protected]
# nano /etc/systemd/system/[email protected]/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
2
  • 3
    This solution doesn't work, it interrupts raspberry boot.
    – carlol
    Dec 8, 2016 at 16:45
  • Raspbian works a little differently, please see my answer and its link to the Raspberry Pi SE
    – Hack-R
    Feb 12, 2018 at 2:03
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 
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

1
  • 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 4, 2018 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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