Thursday, July 12, 2012

Raspberry Pi -- go straight to Desktop without login

I don't live on the top of a remote mountain or in a desert, but although I have a lot of computers, nobody, absolutely nobody else uses them. Just me.
So I hate having to waste time on the login page typing my password.

I have made the appropriate changes to all of the OSes (Debian, Raspbian, Arch and Fedora) I've tried on the Raspberry Pi (henceforth RPi) to skip over the login page and go straight to my Desktop where I can continue my investigation of this amazing little device.

Actually it's very easy.
In both Debian and Raspbian, I modified the /etc/inittab file and changed this line

1:2345:respawn:/sbin/getty 115200 tty1
to this
1:2345:respawn:/bin/login -f paul tty1 </dev/tty1 >/dev/tty1 2<&1

where "paul" is my username. As I'm sure most of you will have a different user, a change is required.
Now save the file.
Note that no password is required to make this change, so it is potentially dangerous.

Next open your ~/.bash_profile file and simply add one line
startx
and nothing more.
Note that your ~/.bash_profile may not exist. If not, just create it.
Now reboot and you should get straight through to your Desktop without and fiddling around on the login page.
The above works for both Debian and Raspbian.

In Arch, the changes I made were just slightly different:

1. In /etc/inittab change from

 # Boot to consoleid:3:initdefault:
# Boot to X11
#id:5:initdefault:
to

# Boot to console
#id:3:initdefault:
# Boot to X11
id:5:initdefault:

2. Still in /etc/inittab, modify this line

1:2345:respawn:/sbin/agetty -8 -s 115200 tty1
to
c1:2345:respawn:/sbin/mingetty --autologin paul tty1 linux
where, again, "paul" is my user. Make sure you use your own.

3. Finally, in /etc/inittab change this line
 x:5:respawn:/usr/bin/xdm -nodaemon
to
x:5:once:/bin/su - -- paul -l -c '/usr/bin/startx >/dev/null >/dev/null 2<&1'
4. Now, in ~/.xinitrc add this line
 exec ck-launch-session startlxde
Reboot and enjoy.




2 comments:

  1. Simpler:
    In /etc/lightdm/lightdm.conf
    change
    autologin-user=pi
    to
    autologin-user=paul

    ReplyDelete
    Replies
    1. Thankyou!! Looked for this everywhere, but nowhere mentioned lightdm, and thats how its set by default on the pi!

      Delete