You are not logged in.

#1 2024-01-20 21:00:52

musbur
Member
Registered: 2022-01-14
Posts: 46

[SOLVED] How did I mess up console login on tty1?

I tried to set up auto login on tty1 (because I have to unlock LUKS anyway). Probably the best way to do that is greetd, but before I try that I want to fix what I did wrong before. I tried to follow these instructions, but all that got me was a tty1 that didn't let me log in any more. I tried to revert whatever damage I migt have done, ending at a reinstall of systemd, many reboots in between, but nothing doing. Any clues what else I might try?

There are no residues of any files that treat tty1 specially:

/# find /lib -name "*tty1*"
/# find /etc -name "*tty1*"
/# find /lib/systemd -type f | xargs grep tty1
/lib/systemd/system/greetd.service:After=getty@tty1.service
/lib/systemd/system/greetd.service:Conflicts=getty@tty1.service
/lib/systemd/system/getty@.service:DefaultInstance=tty1
/# find /etc/systemd -type f | xargs grep tty1

OK, there's one file that refers to tty1, but that is the original file installed by systemd:

...
[Service]
# the VT is cleared by TTYVTDisallocate
# The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then
# the entered username.
ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear - $TERM
...

Last edited by musbur (2024-01-21 17:34:57)

Offline

#2 2024-01-20 21:48:36

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] How did I mess up console login on tty1?

musbur wrote:

I tried to follow these instructions

You should post exactly what you tried rather than linking to instructions. For example, those instructions include username in the suggested configuration file but that is a placeholder — did you replace that with the relevant username or did you actually enter "username"?

musbur wrote:

I tried to revert whatever damage I migt have done, ending at a reinstall of systemd

Why have you only posted the last thing you tried? Do you not think it would be appropriate to post _everything_ you tried? Please do so and be exact. Thanks.

musbur wrote:

There are no residues of any files that treat tty1 specially:

[...]
/# find /etc -name "*tty1*"
[...]

Looks like you've managed to disable the TTYs entirely.

This is from my system (the second line is from my autologin override):

~$ doas find /etc -name "*tty1*"
/etc/systemd/system/getty.target.wants/getty@tty1.service
/etc/systemd/system/getty@tty1.service.d
~$

So try

# systemctl enable getty@

I think that's the preset:

~$ grep getty /usr/lib/systemd/system-preset/90-systemd.preset                                          <
enable getty@.service
disable console-getty.service
~$

Offline

#3 2024-01-21 13:25:53

musbur
Member
Registered: 2022-01-14
Posts: 46

Re: [SOLVED] How did I mess up console login on tty1?

Head_on_a_Stick wrote:

You should post exactly what you tried rather than linking to instructions. For example, those instructions include username in the suggested configuration file but that is a placeholder — did you replace that with the relevant username or did you actually enter "username"?

Thanks for getting back so quickly. Yes I have put in my own username.

Why have you only posted the last thing you tried?

Because I can only type what I remember doing, and that is -- to my knowledge -- exactly what was in the Wiki.

Do you not think it would be appropriate to post _everything_ you tried? Please do so and be exact. Thanks.

I absolutely think it would be appropriate. Except I can't because I don't remember exactly.

Looks like you've managed to disable the TTYs entirely.

No. Only tty1 doesn't work any more. I just noticed that I had installed (but not enabled) greetd, which led to a couple of unit files related to tty1. I removed all of that, but it didn't change anything. To my knowledge, my system is now absolutely clean with respect to anything regarding tty1 with the exception  of the default instance of the template unit. There is some stuff in /etc/security and securetty, but it is either commented out or applies to all ttys.

 
# find /usr/lib/systemd -type f | xargs grep -Is tty1
/usr/lib/systemd/system/getty@.service:DefaultInstance=tty1
# find /etc -type f | xargs grep -Is tty1
/etc/security/access.conf:# "/dev" (e.g. tty1 or vc/1)
/etc/security/access.conf:# Disallow non-root logins on tty1
/etc/security/access.conf:#-:ALL EXCEPT root:tty1
/etc/security/access.conf:#+:root:cron crond :0 tty1 tty2 tty3 tty4 tty5 tty6
/etc/securetty:tty1

I'm getting hung up on tty1 not working because before I try to set up auto login again I want to understand how this works and what went wrong.

Is there any entity besides systemd that handles ttys? Because my systemd installation is pristine out of the box. Which leaves only the possibility of some override file of which I have none (any more).

Using a line from "Pacman tips and tricks":

# find /etc/systemd /usr/lib/systemd  | LC_ALL=C pacman -Qqo - 2>&1 >&- >/dev/null | cut -d ' ' -f 5-
/etc/systemd/user/sockets.target.wants
/etc/systemd/user/sockets.target.wants/pipewire.socket
/etc/systemd/user/sockets.target.wants/p11-kit-server.socket
/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service
/etc/systemd/system/network-online.target.wants
/etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service
/etc/systemd/system/multi-user.target.wants
/etc/systemd/system/multi-user.target.wants/remote-fs.target
/etc/systemd/system/multi-user.target.wants/ntpd.service
/etc/systemd/system/multi-user.target.wants/NetworkManager.service
/etc/systemd/system/default.target.wants
/etc/systemd/system/sysinit.target.wants
/etc/systemd/system/sysinit.target.wants/systemd-resolved.service
/etc/systemd/system/dbus-org.freedesktop.resolve1.service
#

Last edited by musbur (2024-01-21 13:31:28)

Offline

#4 2024-01-21 14:03:11

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] How did I mess up console login on tty1?

Did you try the systemctl command I suggested?

If it doesn't help please post the output of

ls -lR /etc/systemd/system

Offline

#5 2024-01-21 14:35:42

seth
Member
Registered: 2012-09-03
Posts: 51,553

Re: [SOLVED] How did I mess up console login on tty1?

Also

systemctl show getty@tty1.service

Offline

#6 2024-01-21 14:41:26

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,548
Website

Re: [SOLVED] How did I mess up console login on tty1?

Also please describe the actual symptoms.  You've said tty1 doesn't let you log in anymore.  What, precisely, does this mean?  What do you see when you go to tty1?  Is there no login prompt?  Is there a prompt, but you can't type?  Or can you type but logins fail? Or is there just a blinking text cursor in the upper left corner?  Or ...

Also note that I have never seen a greater non-sequitur than this:

musbur wrote:

I tried to set up auto login on tty1 ... Probably the best way to do that is greetd

If you like greetd and want to use it, so be it; we can help.  But don't for a moment think that this is the best way to configure auto login.  Display managers primary purpose is simply to break things.  Sometimes they add a bit of eye candy too ... but they typically break things in confusing ways.

Last edited by Trilby (2024-01-21 14:44:58)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2024-01-21 17:03:38

musbur
Member
Registered: 2022-01-14
Posts: 46

Re: [SOLVED] How did I mess up console login on tty1?

Flollowing Head's suggestion:

# systemctl enable getty\@
Created symlink /etc/systemd/system/getty.target.wants/getty@tty1.service → /usr/lib/systemd/system/getty@.service.

Now that is interesting. Starting the unit brings a prompt to tty1. This seems to have been the problem. I don't understand why tty1 needs this special service while agetty on tty2 et al come up by themselves

Last edited by musbur (2024-01-21 17:18:28)

Offline

#8 2024-01-21 17:08:03

musbur
Member
Registered: 2022-01-14
Posts: 46

Re: [SOLVED] How did I mess up console login on tty1?

Trilby wrote:

Also please describe the actual symptoms.  You've said tty1 doesn't let you log in anymore.  What, precisely, does this mean?  What do you see when you go to tty1?  Is there no login prompt?  Is there a prompt, but you can't type?  Or can you type but logins fail? Or is there just a blinking text cursor in the upper left corner?  Or ...

Just all the normal boot up messages but no login prompt.

Also note that I have never seen a greater non-sequitur than this:

musbur wrote:

I tried to set up auto login on tty1 ... Probably the best way to do that is greetd

If you like greetd and want to use it, so be it; we can help.  But don't for a moment think that this is the best way to configure auto login. Display managers primary purpose is simply to break things.  Sometimes they add a bit of eye candy too ... but they typically break things in confusing ways.

I don't want a DM. I wasn't aware that greetd was one.

Offline

#9 2024-01-21 17:48:37

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] How did I mess up console login on tty1?

musbur wrote:

I don't understand why tty1 needs this special service while agetty on tty2 et al come up by themselves

TTY1 is a special case because it's reserved for display managers or logins. All the other TTYs are started on demand by systemd-getty-generator(8).

For more on this see https://0pointer.de/blog/projects/serial-console.html.

Offline

#10 2024-01-21 17:48:44

musbur
Member
Registered: 2022-01-14
Posts: 46

Re: [SOLVED] How did I mess up console login on tty1?

OK, it works now. What was the problem?

1) I somehow messed up the drop-in file

2) In an attempt to rectify the situation, I deleted not only the freshly created /etc/systemd/system/getty@tty1.service.d, but also the system default getty.target.wants/getty@tty1.service, thereby disabling the service on tty1. All it took was to re-enable the service.

Why did it take so long? Because there is a (to me) secret mechanism that starts all the gettys except on tty1. I keppt looking for some additional thing that kept tty1 from starting but wasn't aware that tty requires a special thing that was missing.

Thanks for your help everybody!

Things to find out:

1) How to auto login only after boot. As things stand now it is impossible to have the machine not logged into a session (because after exiting the session, of course it logs right back in).

2) How to make it compatible with pam_mount. My default user doesn't need pam_mount, but another (that I don't want to auto login) does. For some reason, pam_mount crashes the session, allegedly due to missing config files (which doesn't stop it from otherwise working as intended). With pam_mount disabled the autologin works fine. You'll probably hear back from me about this.

Last edited by musbur (2024-01-21 17:49:49)

Offline

#11 2024-01-22 06:55:41

musbur
Member
Registered: 2022-01-14
Posts: 46

Re: [SOLVED] How did I mess up console login on tty1?

Head_on_a_Stick wrote:
musbur wrote:

I don't understand why tty1 needs this special service while agetty on tty2 et al come up by themselves

TTY1 is a special case because it's reserved for display managers or logins. All the other TTYs are started on demand by systemd-getty-generator(8).

For more on this see https://0pointer.de/blog/projects/serial-console.html.

See? This is what I love about Arch. It's why I came to Arch. You just keep learning all the time. I mean that without any sarcasm. Thanks a lot!

Last edited by musbur (2024-01-22 09:47:22)

Offline

Board footer

Powered by FluxBB