Install libpam-systemd by entering the following commands in the terminal:
sudo apt update sudo apt install libpam-systemd
system and service manager - PAM module
This package contains the PAM module which registers user sessions in the systemd control group hierarchy for logind. . If in doubt, do install this package. . Packages that depend on logind functionality need to depend on libpam-systemd.