Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save charlyie/76ff7d288165c7d42e5ef7d304245916 to your computer and use it in GitHub Desktop.
Save charlyie/76ff7d288165c7d42e5ef7d304245916 to your computer and use it in GitHub Desktop.
# If Debian 11 is ran on a LXC container (Proxmox), SSH login and sudo actions can be slow
# Check if in /var/log/auth.log the following messages
Failed to activate service 'org.freedesktop.login1': timed out (service_start_timeout=25000ms)
-> Run systemctl mask systemd-logind
-> Run pam-auth-update (and deselect Register user sessions in the systemd control group hierarchy)
@L1Cafe
Copy link

L1Cafe commented Aug 15, 2022

From https://jrs-s.net/2017/07/01/slow-ssh-logins/ it seems this does the same thing. I would love if you could explain why that is.

@wopfel
Copy link

wopfel commented Feb 13, 2023

Still experiencing this issue. Thanks for your gist!

@cconstab
Copy link

Saved me some headaches thanks!

@thejohnha
Copy link

Thank you!

@Oddly
Copy link

Oddly commented Jul 20, 2023

Thanks! Solved my issue as well.

@rby-blackruby
Copy link

Solved for me as well

@guarnacciaa
Copy link

Thanks for this workaround, works like a charm!

@thejohnha
Copy link

This seems to be a much better solution: https://forum.proxmox.com/threads/lxc-container-upgrade-to-bullseye-slow-login-and-apparmor-errors.93064/

Basically there is no need to mask the systemd-logind service. Just turn on "nesting" in proxmox.

@renanwillian
Copy link

renanwillian commented Aug 18, 2023

I was having this issue with Debian 12, this solved the issue. Thanks!

Basically there is no need to mask the systemd-logind service. Just turn on "nesting" in proxmox.

It's not possible to enable nesting in privileged containers though.

@unix1984
Copy link

unix1984 commented Sep 6, 2023

Thanks! It also helps with LXD containers!

@poka-IT
Copy link

poka-IT commented Sep 9, 2023

Thank you my lord

@Quicksync
Copy link

Thanks! Its helped me.

@XeJames
Copy link

XeJames commented Oct 7, 2023

This seems to be a much better solution: https://forum.proxmox.com/threads/lxc-container-upgrade-to-bullseye-slow-login-and-apparmor-errors.93064/

Basically there is no need to mask the systemd-logind service. Just turn on "nesting" in proxmox.

100% correct. However sometimes you do not want nesting on so this is not a "better" solution - just another one. I use both.

@Jaigos
Copy link

Jaigos commented Nov 8, 2023

Good, Thans!

@supertin
Copy link

supertin commented Dec 3, 2023

So glad I stumbled on this... During my upgrades, I had let dpkg replace my custom sshd_config with the stock one, so get fooled into thinking it was related to that. This fixed it.

Edit:
For anyone looking to do the pam-auth-update in a non-interactive way.... Use this:
"pam-auth-update --remove systemd"

@Termuellinator
Copy link

I've now encountered this because i have to use a privileged container with debian 12. Unfortunately, this solution here prevents things like systemctl poweroff from working.

Fortunately, L1Cafe's link offers a better solution:

Comment out session optional pam_systemd.so in /etc/pam.d/common-session

This seems to solve the issue while keeping systemd-logind intact (haven't done much testing though!)

@maqdan
Copy link

maqdan commented Feb 15, 2024

it works, thank you

@dsbrown
Copy link

dsbrown commented Feb 28, 2024

This fixed my problem, thank you.

@umiddelb
Copy link

It's not possible to enable nesting in privileged containers though.

It's possible to turn on nesting after container creation: CT |-> Options |-> Features |-> Edit

@meulie
Copy link

meulie commented Apr 17, 2024

Thanks! 🤗

@EcurbNosneb
Copy link

Basically there is no need to mask the systemd-logind service. Just turn on "nesting" in proxmox.

This worked. I had forgotten to turn this on when I created the LXC.

@kkursor
Copy link

kkursor commented Sep 15, 2024

Thank you, man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment