*GUIDE* Debian Auto Login & StartX


11 posts
by Helpme1986 » Thu Apr 26, 2012 8:17 am
My first guide so be gentle!

Can imagine alot of people wanting to auto login and/or startx (I originally looked into this to launch Liam's XBMC automatically, instead of startx just use xbmc) so did a guide, might stop a few questions on the forums (or if it doesnt its something easy to link to)

http://elinux.org/RPi_Debian_Auto_Login
Posts: 121
Joined: Tue Jan 03, 2012 3:48 pm
by naicheben » Thu Apr 26, 2012 8:40 am
Thank you. German translation here
Posts: 344
Joined: Sat Jan 28, 2012 12:28 pm
by asb » Thu Apr 26, 2012 8:54 am
A nicer way to do it is to modify /home/pi/.bash_profile with e.g.:

if [ -z "$DISPLAY" ] && [ $(tty) = /dev/tty1 ]; then
  startx
fi
 
Then you can log in to your other ttys fine.
Forum Moderator
Forum Moderator
Posts: 853
Joined: Fri Sep 16, 2011 7:16 pm
by Helpme1986 » Thu Apr 26, 2012 9:07 am
asb said:


A nicer way to do it is to modify /home/pi/.bash_profile with e.g.:

if [ -z "$DISPLAY" ] && [ $(tty) = /dev/tty1 ]; then
  startx
fi
 
Then you can log in to your other ttys fine.


I originally tried this but .bash_profile didnt exist (using nano it created a new file)
Posts: 121
Joined: Tue Jan 03, 2012 3:48 pm
by naicheben » Thu Apr 26, 2012 9:07 am
asb said:


A nicer way to do it is to modify /home/pi/.bash_profile with e.g.:

if [ -z "$DISPLAY" ] && [ $(tty) = /dev/tty1 ]; then
  startx
fi
 
Then you can log in to your other ttys fine.



Is this known to work on the RPi?
Posts: 344
Joined: Sat Jan 28, 2012 12:28 pm
by asb » Thu Apr 26, 2012 9:22 am
Helpme1986: yep, just create the file.

naicheben: Yes, I've used it a lot on the Pi
Forum Moderator
Forum Moderator
Posts: 853
Joined: Fri Sep 16, 2011 7:16 pm
by frying_fish » Thu Apr 26, 2012 9:26 am
Helpme1986 said:


asb said:


A nicer way to do it is to modify /home/pi/.bash_profile with e.g.:

if [ -z "$DISPLAY" ] && [ $(tty) = /dev/tty1 ]; then
  startx
fi
 
Then you can log in to your other ttys fine.


I originally tried this but .bash_profile didnt exist (using nano it created a new file)


No harm with adding a new bash_profile if it doesn't exist. It doesn't have to exist, but if it is there then when starting a bash shell it will check through it and see if any settings need to be set through it.

I assume this has worked fine for everyone so far?
User avatar
Posts: 80
Joined: Mon Jan 23, 2012 3:26 pm
by Chris.Rowland » Thu Apr 26, 2012 9:37 am
That's really nice, thank you.

Can I make a suggestion, could you add a few lines of explanation to say what you are doing. It would help people to understand what's going on.

I guess that you are editing the inittab file and replacing the getty command with a login command of some sort. Are the angle brackets some sort of redirection? I guess that -f pi is specifying the user, it now doesn't seem to need a password.

The second change seems to be to add the startx command to the end of the profile file so that LXDE is run automatically.
Posts: 239
Joined: Thu Jan 12, 2012 5:45 pm
by poing » Thu Apr 26, 2012 9:44 am
Googling 'LXDE' and looking at the images a thought struck me. On Windows if the desktop background is a bitmap it will use more RAM then when it's just a solid color. If that's the same with LXDE it would probably be better to use a solid color (and set it in this script) considering the limited amount of RAM on the Pi.
Posts: 1129
Joined: Thu Mar 08, 2012 3:32 pm
by drbob » Mon Jan 21, 2013 10:53 am
Awesome - pulled my hair out for awhile on this topic -- seems there is much conflicting information that spins a person in circles. This worked...

Now, a small additional question:

Want to run the command

x11vnc -forever -display :0

after startx is executed. Thought I'd be slick and try to pop it in after the startx command, but that doesn't fly... advice?
Posts: 1
Joined: Mon Jan 21, 2013 10:49 am
by FixedCoil » Wed Feb 13, 2013 11:27 pm
@dfbob

Try ending startx with & e.g. 'startx &', this will launch startx in the background and return the shell command prompt to accept the next command.

HTH
Posts: 5
Joined: Mon May 14, 2012 6:31 pm