LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   How to make auto login work in Ubuntu? (no display manager) (https://www.linuxquestions.org/questions/ubuntu-63/how-to-make-auto-login-work-in-ubuntu-no-display-manager-4175554730/)

tom_len 09-28-2015 02:20 PM

How to make auto login work in Ubuntu? (no display manager)
 
I am trying to autologin and auto startx on my ubuntu minimal installation (15.04 Vivid Velvet 32bits; mini.iso) I am following several guides that I found but none of them work (the startx part works, but not the autologin)
For example:
https://rowen121.wordpress.com/2011/...rtx-in-ubuntu/
https://wiki.ubuntuusers.de/autologin
http://www.shellperson.net/autostart-x-without-gdm/
http://www.debianadmin.com/how-to-au...in-debian.html

One of the problems is everytime I go and look for the file they tell me to edit, it's not there. When I do sudo nano whatever the file, it is empty (tty1.conf for example, or inittab) In all the guides they say to uncomment a line and add another, but all those files are empty for me. Maybe it is because they refer to Debian and things change.
I have managed to make it work installing nodm. Then I don't need to write my username nor password, and then, it auto startx (I added startx in .bash_profile), and finally takes me to i3-wm. I haven't installed a display manager (well, just nodm as the last option to try) nor desktop environment.
I would like to get it working without the need of installing a display manager (rungetty/mingetty/getty/whatever works and it's easy on resources) Please if you know the steps that work for you and ubuntu, or a guide that I can follow I would appreciate it.

Thanks in advance
Note: nothing is encrypted

pan64 09-28-2015 03:14 PM

so just take https://wiki.ubuntuusers.de/autologin
Have you installed rungetty?

Do you want graphical login or command line interface?
Do not put startx into .bash_profile, that is definitely not the right way.

tom_len 09-28-2015 03:16 PM

Yes, I installed rungetty.
As I said, I want to be presented directly with i3-wm, no display manager.
I don't need a desktop environment for now either, just plain simple i3

What do you suggest about startx then? I didn't research more because it worked!
Thanks

tom_len 09-28-2015 05:13 PM

It seems Ubuntu 15.04 now uses systemd, and apparently things have changed.
So I kept on searching now for systemd autologin and got it working.
I found this guide that served me well:
http://memo-linux.com/debian-8-syste...splay-manager/

So I did:
Code:

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

and edited the file as follows:
Code:

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

Change "username" with yours.

Save and close (CTRL+O, CTRL+X)

Now:
Code:

systemctl enable getty@tty1.service
Write your password (I was asked twice)

That would be for the autologin part.
Next, to start X automatically, continue with this:
Code:

sudo nano ~/.bash_profile
and edit that file so it reads:
Code:

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
Save and close (CTRL+O, CTRL+X)
(Source: https://wiki.archlinux.org/index.php...art_X_at_login)

At this point I found another possibility for that file here:
http://unix.stackexchange.com/questi...p-with-systemd
Code:

if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
 exec startx
fi

But I haven't tested it and I don't really know the difference, sorry

In this last link they advised to do a last step
"You will have to modify your ~/.xinitrc to start your desktop environment, how to do that depends on the DE"
So I did:
Code:

sudo nano ~/.xinitrc
and added this line
Code:

exec i3
Save and close (CTRL+O, CTRL+X)

Last thing to do:
Code:

sudo reboot
Now it auto logins and auto starts X, and no display manager was needed.
I think I read if you already have a display manager you have to remove it first.
I hope this can be useful for you. Please comment and improve it.


All times are GMT -5. The time now is 02:42 PM.