Discussion:
[systemd-devel] permanent autologin
Emanuel Berg
2021-05-01 05:17:06 UTC
Permalink
I do autologin like this:

ExecStart=-/sbin/agetty -a incal --noclear %I $TERM

/etc/systemd/system/getty.target.wants/***@tty1.service # line ~39

$ sudo systemctl daemon-reload

However, it seems to disappear after a while, maybe when
systemd gets updated?

So my question is how do I make the autologin
change permanent?
--
underground experts united
https://dataswamp.org/~incal
Silvio Knizek
2021-05-01 15:05:59 UTC
Permalink
   ExecStart=-/sbin/agetty -a incal --noclear %I $TERM
   $ sudo systemctl daemon-reload
However, it seems to disappear after a while, maybe when
systemd gets updated?
So my question is how do I make the autologin
change permanent?
Hi Emanuel,

your path is wrong. You want the following:

--- /etc/systemd/system/***@tty1.service.d/10-autologin.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty -a incal --noclear %I $TERM
---

This creates a single overwrite for only this one instanciated unit.
The first empty ExecStart= is for technical reasons.

Do you need this auto login for debug reasons (than maybe debug-
shell.service is better suited), do you want to start a terminal
1application (than maybe use a normal .service with TTYPath), or do you
start graphical applications (use a login manager with auto login
instead)?

BR
Silvio
Emanuel Berg
2021-05-02 17:14:13 UTC
Permalink
I don't have that file or even directory, but I can put it
there manually, of course.
Post by Silvio Knizek
Do you need this auto login for debug reasons (than maybe
debug- shell.service is better suited), do you want to start
a terminal 1application (than maybe use a normal .service
with TTYPath), or do you start graphical applications (use
a login manager with auto login instead)?
I have it setupt like this [1] so that

Linux VT 1 -> Emacs
2-4 -> tmux
5 -> (do nothing)
6 -> X

I don't really "need" auto login, it is more like I want it :)

[1] https://dataswamp.org/~incal/conf/.zprofile
--
underground experts united
https://dataswamp.org/~incal
Emanuel Berg
2021-05-02 17:23:20 UTC
Permalink
My other message doesn't seem to have come yet, but to answer
that message, yes, it does work on tty!

I need one such directory and file for each tty?
--
underground experts united
https://dataswamp.org/~incal
Silvio Knizek
2021-05-02 20:19:59 UTC
Permalink
Post by Emanuel Berg
I don't have that file or even directory, but I can put it
there manually, of course.
It's expected that you don't have this directories and files. You can
just create them. In man:systemd.unit you find how templates and drop-
ins work.
After touching those files you need to run »systemd deamon-reload« to
tell systemd, that you touched them.
Post by Emanuel Berg
Post by Silvio Knizek
Do you need this auto login for debug reasons (than maybe
debug- shell.service is better suited), do you want to start
a terminal 1application (than maybe use a normal .service
with TTYPath), or do you start graphical applications (use
a login manager with auto login instead)?
I have it setupt like this [1] so that
Linux VT 1 -> Emacs
         2-4 -> tmux
           5 -> (do nothing)
           6 -> X
I don't really "need" auto login, it is more like I want it :)
[1] https://dataswamp.org/~incal/conf/.zprofile
So, if you have this setup, I really suggest that you use specialised
units for every terminal and a graphical login manager for the X stuff.
So instead of starting agetty you can directly start emacs or tmux as
the User= you want.
And again for X, you want a graphical login manager, beacuse than your
session has proper access rights and is in fact tagged as graphical by
loginctl.
Or you drop the ttys completely and work only in X, like everybody else
and use some window manager with multiple desktops.
Emanuel Berg
2021-05-02 23:51:49 UTC
Permalink
Post by Silvio Knizek
So, if you have this setup, I really suggest that you use
specialised units
Hm... what "units" do you refer to here?
Post by Silvio Knizek
for every terminal and a graphical login manager for the
X stuff. So instead of starting agetty you can directly
start emacs or tmux as the User= you want.
That already works fine, zsh starts everything automatically
when I'm logged in, which happens automatically now as well,
well, at least in tty1 but now that I got reminded about this,
I'll do such folders/files for all the ttys.
Post by Silvio Knizek
And again for X, you want a graphical login manager
?
Post by Silvio Knizek
beacuse than your session has proper access rights and is in
fact tagged as graphical by loginctl. Or you drop the ttys
completely and work only in X, like everybody else and use
some window manager with multiple desktops.
Hahaha, what are you talking about?
--
underground experts united
https://dataswamp.org/~incal
Emanuel Berg
2021-05-02 23:58:07 UTC
Permalink
Post by Silvio Knizek
After touching those files you need to run »systemd
deamon-reload« to tell systemd, that you touched them.
This worked

$ sudo systemctl daemon-reload

and after copying the tty1 directory and renaming it, there is
autologin everywhere!

:)
--
underground experts united
https://dataswamp.org/~incal
Emanuel Berg
2021-05-03 00:12:21 UTC
Permalink
Post by Emanuel Berg
Post by Silvio Knizek
After touching those files you need to run »systemd
deamon-reload« to tell systemd, that you touched them.
This worked
$ sudo systemctl daemon-reload
and after copying the tty1 directory and renaming it, there is
autologin everywhere!
:)
How to do it,

https://dataswamp.org/~incal/conf/.zsh/vt

lines 7-19.
--
underground experts united
https://dataswamp.org/~incal
Emanuel Berg
2021-05-02 17:18:25 UTC
Permalink
Post by Silvio Knizek
[Service]
ExecStart=
ExecStart=-/sbin/agetty -a incal --noclear %I $TERM
I tried it in tty2 and it didn't work. Is it because it only
works for tty1 as is mentioned, of for some other reason,
I don't know. I'll restart Emacs now, and see if it works
for tty. If it doesn't work, I'll reboot and see what happens.
If it still doesn't work then yeah, something's up :)
--
underground experts united
https://dataswamp.org/~incal
Loading...