You are not logged in.

#1 2022-12-03 12:20:15

tithom
Member
Registered: 2022-11-14
Posts: 4

[SOLVED] Sudo hangs (Arch install on SSD, Sway wm, Alacritty)

Hello all,

I don't think that I could find much info on it online as seems that most info I could find were relating to SSH login - which is not my case.

I installed Arch on an external SSD to use as personal laptop "on the go" when I travel with my work laptop and it works well well overall apart from this issue which is the 2nd time that I notice, so not very frequent. The OS is fully up to date, I use Sway & Alacritty and have not installed anything "exotic", my only AUR install is nordvpn.

What happened then, twice, is that when I'm logged in and with Sway graphical session, I cannot use sudo. It asks for password, I give it, it then "hangs" and I have to ctrl + C in order to regain the prompt. However, if I log in to a tty (ctrl + alt + F2), I can log in and use sudo without problem.

I have just locked my account temporarily after providing 3 false passwords and the tty login displayed "the account is locked due to 3 failed logins. X minutes left to unlock". So when the issue happens, I am positive that account is not locked due to the use of wrong passwords.

Going through the logs (journalctl | grep sudo), I have these lines 3 times (I tried 3 times before trying to log in on a second tty):

sudo [PID#]: pam_systemd_home(sudo:auth): systemd-homed is not available: Unit dbus-org.freedesktop.home1.service not found.
sudo [PID#]: pam_unix(sudo:auth): conversation failed 
sudo [PID#]: pam_unix(sudo:auth): auth could not identify password for [username]

There is about 10s (when I used ctrl-c between the activation of sudo & "conversation failed"). Exiting sway and re-login got sudo working again. It's possible that it does not log "authentification failure" as I use ctrl-c before the prompt returns. When entering, say, 2 wrong passwords out of 3 attempts + killing sudo, log does not show "authentification failure", as oppose to the below. However, it it the account is really locked because I entered 3x the same password in the last 15" without remembering it, it should display that it's locked when I fire up another tty and manage to log in.

Compare to when I supply a false password:

sudo [PID#]: pam_systemd_home(sudo:auth): systemd-homed is not available: Unit dbus-org.freedesktop.home1.service not found.
sudo [PID#]: pam_unix(sudo:auth): authentification failure; logname= uid=1000 euid=0 tty=/dev/pts/0 ruser=username rhost user=username
sudo [PID#]: pam_unix(sudo:auth): conversation failed 
sudo [PID#]: pam_unix(sudo:auth): auth could not identify password for [username]
sudo [PID#]: username: 1 incorrect password attempt ; TTY=pts/0 ; PWD=/home/username ; USER=root ; COMMAND=validate

Because the issue seems random and I don't run any particular stuff, hard to relate to other thing. Just to say that I've had I/O errors before with the SSD but mostly after hibernation (and I think it's to do with motherboard of my test laptop since my work laptop handles hibernation when I'm booted on the SSD). Just to say that perhaps something is timing out?

Have not tested on another terminal within the same Sway session.

Thanks in advance

PS: Found 2 similar-ish issues:
https://access.redhat.com/solutions/625163 - I cannot access the page but the log looks the same
https://www.reddit.com/r/linux4noobs/co … _password/ - OP never said whether or not he was locked out for some time

Last edited by tithom (2023-03-24 13:27:41)

Offline

#2 2022-12-03 15:16:57

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,088

Re: [SOLVED] Sudo hangs (Arch install on SSD, Sway wm, Alacritty)

hostnamectl

And please also post a complete journal, covering the problem - not some randomly edited grep out of context.

Offline

#3 2022-12-03 16:35:12

tithom
Member
Registered: 2022-11-14
Posts: 4

Re: [SOLVED] Sudo hangs (Arch install on SSD, Sway wm, Alacritty)

Well, thought these were the most relevant sections, but sure can post a more complete section, please see there: https://bpa.st/IYVQ

This is the boot where sudo hangs. On /dev/pts/0 it keeps on failing, I tried on tty2, logged in and so exited Sway & re-launched.

For output of hostnamectl, please see there: https://bpa.st/7Q7A

In the meantime, I've continued looking for possible lead and found some success in looking for possible reasons for sudo to timeout:
1. Reinstall pambase (on the forum here), which I've just done
2. Add hostname to /etc/hosts, which I've also just done
3. Some other solutions have included restarting systemd-logind which was a temporary fix for the person (maybe that's what I did when exiting / restarting Sway), so presumably that also works for me
4. Some other posts mentioned pambase having a hard dependency on systemd-homed. I don't think so because /etc/pam.d/system-auth is

-auth [success=2 default=ignore] pam_systemd_home.so

and man page for pam.conf:

If the type value from the list above is prepended with a - character the PAM library will not log to the system log if it is not possible to load the module because it is missing in the system.

But then perhaps sudo waits for systemd-homed to time out in some situations. Some folks also reported that it took 2-3 min for sudo to return and I waited max 20s. So I've done 1 & 2 above and if it happens again I'll try show some patience. I also added audit option in /etc/pam.d/system-auth to try get more info in case it happens again.

auth [success=1 default=bad] pam_unix.so try_first_pass nullok audit

Thanks

Last edited by tithom (2022-12-03 16:36:17)

Offline

#4 2022-12-03 17:40:12

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,088

Re: [SOLVED] Sudo hangs (Arch install on SSD, Sway wm, Alacritty)

It's not a hard dependency, but has caused trouble in the past (though not limited to sudo) - and you do have the module available (just homed isn't running)

If adding the static hostname doesn't fix it (doesn't look like), you could comment *every* line in /etc/pam.d/system-auth that has pam_systemd_home.so in it.
When doing this, MAKE SURE YOU'VE AN OPEN ROOT SHELL and after editing the file first ensure you can still login and login as root. (If not, that's why you've an open root shell wink)

Finally, take sway out of the equation and test the behavior in a PTS in eg. an openbox X11 session.

Offline

#5 2022-12-03 17:49:44

tithom
Member
Registered: 2022-11-14
Posts: 4

Re: [SOLVED] Sudo hangs (Arch install on SSD, Sway wm, Alacritty)

Thanks, will look at these if the current set-up does not sort out the issue. Thanks for the help!

Offline

#6 2023-03-24 13:26:46

tithom
Member
Registered: 2022-11-14
Posts: 4

Re: [SOLVED] Sudo hangs (Arch install on SSD, Sway wm, Alacritty)

Hi, for what it's worth, the issue did no occur again. I guess that this is the step that sorted it out for me:

2. Add hostname to /etc/hosts

Offline

Board footer

Powered by FluxBB