5

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/09/14/enable-automatic-login-and-startx-in-ubuntu/ https://wiki.ubuntuusers.de/autologin

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

7
  • So you're saying /etc/init/tty1.conf is empty for you ? that's weird . . . It's not a difference between Debian or Ubuntu. By default there always should be init files. And autologin is simple just alter the line exec /sbin/getty -8 38400 tty1 to exec /sbin/getty -a username -8 38400 tty1 Sep 28, 2015 at 19:26
  • Yup, read that german wiki a little. The step is correct. Perhaps you are doing something wrong. Also , in Automatischer Oberflächenstart nach Login part I think it should be changed to startx xfce4 not startxfce4, cuz that last command is non-existent Sep 28, 2015 at 19:29
  • By minimal installation, I should have specified that I am in fact using ubuntu mini.iso (MinimalCD). Yes, I am sure tty.conf was empty, and inittab empty too.
    – tom_len
    Sep 28, 2015 at 19:37
  • Serg: I tried what you suggest but it doesn't work, I find myself in tty1 but I have to write my username and password. I re-tried the german wiki, but nothing. I have to write name and password
    – tom_len
    Sep 28, 2015 at 20:00
  • Ok. So another possibility is that Ubuntu uses different system to start processes as of 15.04 . Init files belong to Upstart system but 15.04 uses systemd. Try this wiki.archlinux.org/index.php/Automatic_login_to_virtual_console Sep 28, 2015 at 20:12

1 Answer 1

7

It seems you were right Serg, 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-systemd-autologin-sans-display-manager/

This is what I did:

sudo mkdir -pv /etc/systemd/system/[email protected]/
sudo nano /etc/systemd/system/[email protected]/autologin.conf

and edited the file as follows:

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

Change "username" with yours.

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

Now:

systemctl enable [email protected]

Write your password (I was asked twice)

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

sudo nano ~/.bash_profile

and edit that file so it reads:

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx

Save and close (CTRL+O, CTRL+X) (Source: wiki archlinux Autostart_X_at_login)

At this point I found another possibility for that file here: https://unix.stackexchange.com/questions/42359/how-can-i-autologin-to-desktop-with-systemd

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:

sudo nano ~/.xinitrc

and added this line

exec i3

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

Last thing to do:

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. Feel free to comment and improve it.

2
  • why is there ExecStart twice? I've tested it with only one ExecStart and it did not work. I'm curious Feb 27, 2019 at 8:53
  • 1
    To tell you the truth, no idea. My answer was a compilation of the info I gathered when I was having this problem. I described what I tried and worked for me at the time. Maybe you can contact the creator of this blog here: link
    – tom_len
    Feb 28, 2019 at 9:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .