Stuff that has not yet gone into the official build.
Post a reply

systemd and autologin

Wed Jul 09, 2014 11:49 am

I'm putting these links here for later reference. I did get autologin to console working in sid with systemd. At this point, I don't know what we need to do about it. Have to see how live-* handles it.

http://forums.debian.net/viewtopic.php? ... 59c925312e
https://wiki.archlinux.org/index.php/au ... al_console
an-experiment-t48.html#p327
systemd-t376.html#p3553

Re: systemd and autologin

Sat Jul 19, 2014 11:55 am

i can confirm the information provided in the second link (archwiki) works in VT on sid with systemd (built today). AFAIK also works with all the live-* stuff without issues.

Re: systemd and autologin

Thu Sep 25, 2014 7:08 pm

Right now in sid, live-* seems to not be handling autologin. I tried a bunch of combinations of "components=" and "nocomponents=" on the command line (booting a snapshot iso in vbox that was created August 31), and nothing seemed to work. I tried with lightdm, login, openssh-server, sudo, user-setup and I think a couple of other configs, in various combinations, with no effect whatsoever. No sudo with "components=sudo", no ssh host keys with "components=openssh-server", and no autologin with any of it.

To get autologin to the desktop, edit etc/lightdm/lightdm.conf -
- Uncomment the second instance of "#autologin-user=" and add the user name. (It's the one in the section labeled [SeatDefaults], not the one in "# Seat Defaults")
- Restart lightdm. (systemctl stop|start|restart lightdm)

To get autologin on the console, here are the directions copied from the archwiki page linked above.
NOTE: Replace "(*slash*)" with "/" wherever it appears below. And replace "username" with your user's login name.
Create the following file (and leading directories):

(*slash*)[email protected]/autologin.conf


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


To get more than one virtual console with autologin, here are instructions modified from the archwiki's systemd FAQ. (changed /usr/lib/systemd/system to /lib/systemd/system)
https://wiki.archlinux.org/index.php/Sy ... _gettys.3F

How do I change the default number of gettys?

Currently, only one getty is launched by default. If you switch to another tty, a getty will be launched there (socket-activation style). In other words, [Ctl] [Alt] [F2] will launch a new getty on tty2.

By default, the number of auto-activated gettys is capped at six. Thus [F7] through [F12] won't launch a getty.

If you want to change this behavior, then edit (*slash*)etc/systemd/logind.conf and change the value of NAutoVTs. If you want all [Fx] keys to start a getty, increase the value of NAutoVTs to 12. If you are forwarding journald to tty12, increase the value of NAutoVTs to 11 (thus leaving tty12 free).

You can also pre-activate gettys which will be running from boot.

To add another pre-activated getty, simply place another symlink for instantiating another getty in the (*slash*)etc/systemd/system/getty.target.wants/ directory:

Code:
# ln -sf /lib/systemd/system/getty@.service (*slash*)[email protected]
# systemctl start [email protected]


To remove a getty, simply remove the getty symlinks you want to get rid of in the etc/systemd/system/getty.target.wants/ directory:


Code:
# rm (*slash*)etc/systemd/system/getty.target.wants/getty@{tty5,tty6}.service
# systemctl stop [email protected] [email protected]


Edit: changed path to agetty (/sbin/agetty)
Last edited by fsmithred on Fri Sep 26, 2014 8:20 pm, edited 2 times in total.

Re: systemd and autologin

Thu Sep 25, 2014 7:35 pm

Well, creating additional gettys works, but getting autologin to work on them isn't working for me. I made two additional virtual consoles (tty2 and tty3) and set autologin on tty1 and tty2. Only tty3 gives me a login prompt, and the others just give me a blinking cursor.

Re: systemd and autologin

Fri Sep 26, 2014 7:49 pm

Got it!

Couple of things -

- I. disabled autologin on tty1, because systemd reserves tty1 for the graphical system, if you boot into graphical mode. (deleted the [email protected]e.d directory and the autologin.conf it contained)

- 2. Changed the path for agetty in autologin.conf
Code:
    [Service]
    Type=simple
    ExecStart=
    ExecStart=-/sbin/agetty --autologin username --noclear %I 38400 linux

Once again, replace username with your user's login name.


Edit: So, this presents a problem if someone wants to boot into an autologin console, but only wants to do that sometimes. Right now, we have runlevel 3 set for no display manager (and no graphical desktop), which drops you to a text login on tty1. But tty1 is reserved for when you want to boot into graphical mode, so we shouldn't set it to autologin.

There's probably a simple way to deal with it, but I don't know what that is. Maybe a script that detects you're booting into console and then creates the autologin.conf for tty1 or a way to get dropped to tty2 instead of tty1 when you boot.

Or maybe live-config can do it, and I just don't know how.
Post a reply