HOWTO: Auto login and startx at boot on Coal

Forum rules
Share your brain ;)
pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

HOWTO: Auto login and startx at boot on Coal

Unread post by pidsley » Thu Aug 01, 2013 9:29 pm

Coal does not use a login manager, instead booting to a login prompt and requiring the user to log in, and then enter "startx" to get into LXDE. I like this functionality, because I often want to do something in the console before starting X. It is, however, easy to modify Coal to automatically log your user in and/or startx automatically at login. If you enable both features, Coal will boot directly into X.

1. Autologin


Because Coal uses systemd, the old "inittab edit" autologin method does not work. Instead, you must create the directory "/etc/systemd/system/[email protected]" and place a file in this directory. The following steps assume you are running as root.

Code: Select all

mkdir /etc/systemd/system/[email protected]
cd /etc/systemd/system/[email protected]
nano autologin.conf
Place the following code in autologin.conf

Code: Select all

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin <username> --noclear %I 38400 linux
Replace <username> with your user name. Save the file. At reboot, your user should now be logged in automatically on tty1.

2. StartX at login

To do this, simply add the following code to the end of your ~/.bashrc file (if you are using zsh, modify ~/.zshrc).

Code: Select all

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
You can add only this feature if you do not want your user to be logged in automatically (you do not have to enable step 1). You can also still switch to another tty and log in normally (without starting X) if necessary, even after enabling automatic startx on tty1.

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: HOWTO: Auto login and startx at boot on Coal

Unread post by rhowaldt » Thu Aug 01, 2013 9:37 pm

awesome. thanks for this Pidsley, you're a great help in explaining the nifty details, as always!
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: HOWTO: Auto login and startx at boot on Coal

Unread post by machinebacon » Fri Aug 02, 2013 3:28 am

Thank you!
..gnutella..

User avatar
swftech
Sobe
Posts: 160
Joined: Wed Oct 17, 2012 12:40 pm
Location: S Florida

Re: HOWTO: Auto login and startx at boot on Coal

Unread post by swftech » Fri Aug 02, 2013 4:08 am

Nice pidsley, was looking for a thank you/thumbs up button :P So you just get another Thanks :)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: HOWTO: Auto login and startx at boot on Coal

Unread post by machinebacon » Fri Aug 02, 2013 4:12 am

Offtopic: I tried to implement a Thanks button - it broke the forums. So, don't search for it, and don't even dare to ask for it :D
..gnutella..

User avatar
swftech
Sobe
Posts: 160
Joined: Wed Oct 17, 2012 12:40 pm
Location: S Florida

Re: HOWTO: Auto login and startx at boot on Coal

Unread post by swftech » Fri Aug 02, 2013 4:16 am

Haha, I wasn't about to ask. If it's not here by now I know there must be a reason :D

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: HOWTO: Auto login and startx at boot on Coal

Unread post by GekkoP » Tue Sep 17, 2013 11:27 am

Thanks for this one, now I got autologin and startx at boot on Elektra too.

User avatar
wuxmedia
Grasshopper
Posts: 6454
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: HOWTO: Auto login and startx at boot on Coal

Unread post by wuxmedia » Sun Sep 29, 2013 10:58 am

yeah, thanks Pids.
"Seek, and Ye shall find"
"Github | Chooons | Site"

Post Reply