Double password request after suspend

When my laptop goes into standby mode due to inactivity, I have to authenticate myself twice and enter my password twice: First at the login screen, and immediately afterwards another window pops up with the following content "Authentication is required to suspend the system".
How can I set it so that the second pop-up window is no longer displayed? I would like to use a password prompt after standby mode, but not two.
My settings in the power management are as follows:
Automatically lock the session when the screen saver is activated
Lock the screen when the system goes into sleep mode
Should I only enable one function here? I could imagine that this causes the problem. One password is for unlocking the session and one for the screen, or not?

Are you an Adminstrator or Standard user? Open a terminal and enter:

groups

If sudo is not in the list you don't have admin rights.

Alternatively, use this what I found using Brave A.I. search engine via Mojeek search engine:

"#

Ubuntu 22.04 Suspend Authentication

If you are encountering an issue where Ubuntu 22.04 requires a password upon waking from suspend, you can disable the lock screen on suspend through the settings. Navigate to Settings > Privacy > Screen > Lock Screen on Suspend and disable this option. This will prevent the system from locking immediately after suspending, thus eliminating the need to enter a password upon waking up.

Alternatively, if you want to keep the lock screen functionality but only require a password after a certain period of time, you can use a script placed in /lib/systemd/system-sleep/ . This script can unlock the session if the system was suspended for a short duration. However, this method involves more technical steps and might require adjustments based on your specific setup.

If you are experiencing login issues or a black screen after suspending, reinstalling GNOME Display Manager and the desktop environment might resolve the problem. Run the following commands:

sudo apt install --reinstall gdm3 ubuntu-desktop gnome-shell
sudo systemctl reboot 

After reinstalling these packages and rebooting, try logging in again.

If the issue persists, consider checking if your system has NVIDIA graphics and if recent updates might be causing the login issues. Reinstalling the NVIDIA drivers could also help in resolving the problem."

I used Ubuntu 22.04 for my search criteria as that is what Zorin 17 is based on.

I am also administrator and can give me sudo rights but use a normal user account at login.

Are any Programs open when this happens?

Yes, e.g. Thunar (normal, not as admin) and settings. I noticed, it's enough to close the window with the legitimation, I don't have to enter anything there.
When there are no programs opened, there appears twice the login screen, where I have to enter two times my password. It is not unlocked after the first time.
I am not sure whether I may have picked up malware. Last week there were suddenly two unknown launchers (without a specific icon, just starters) and Firefox to the right of the clock in the taskbar, which I didn't put there. When this happened I only was downloading themes no programs. I then deleted all partitions with gparted and reinstalled Linux Mint. However, since I didn't overwrite the SSD with random numbers or zeros, I don't know if there might still be malware there.
Perhaps the second login also causes me to be logged in as an administrator, because I can recently paste files that I copied from usr/share/themes into /.themes without logging in as an administrator and without changing the access rights. This never worked before.

sudo touch /etc/polkit-1/localauthority/50-local.d/10-no-auth-suspend.pkla

sudo nano /etc/polkit-1/localauthority/50-local.d/10-no-auth-suspend.pkla

Paste in, replacing $USER with your actual user name:

[No authentication for suspend]
Identity=unix-user:$USER
Action=org.freedesktop.upower.suspend;org.freedesktop.login1.suspend
ResultActive=yes

Tap ctl+o to overwrite, then enter to save current configuration. Tap ctl+x to exit the editor.

@Ponce-De-Leon @swarfendor437 @Aravisian
Thank you very much for your help. I tested various settings in the power management, and if I set the "Automatically lock session" function to "never", I only have to enter my password once after suspend.

2 Likes

The commands did not work, probably because I am using LinuxMint XFCE and the file locations are different from Zorin. In the polkit-1 folder there are two subfolders named "localalauthority.conf.d" and "rules.d" (this one is locked). Both are empty.
When I enter the touch command for localalauthority (using your path or mine), I get the message, file or directory not found. Only rules.d works. However, Nano then displays "rules.d is a directory." Can I anyway enter here what you have written down, or is this the wrong place?

I am not sure without looking over a copy of Mint.

That suggestion is based on the concept that two authentication requests are being sent.
If you are on Linux Mint - it is possible that there is another source asking for authentication that is not polkit

Do you have screensaver enabled?
Do you have Lockscreen set?

If yes to the above - the Screensaver lockscreen may be asking to authenticate alongside the Log In authentication.

So you might check your Screensaver settings from the settings menu; you can disable the screensaver and lock screen entirely for testing, to try to narrow this down. Check your steps as you go to ensure you are not misled.

Yes, I had activated both the screen lock and the screen saver and therefore suspected that this was the reason for the double password request. I have therefore now deactivated the automatic screen lock.
I can't understand that it is not recognized by the system that authentication has already taken place. It should apply to both services, screensaver and screenlocker.

1 Like

Did disabling it halt the double authentication?

Yes, it only appears when I lock the screen manually and go then into suspend manually.

1 Like

Well, at least we are headed in the right direction.

You are correct that these should behave better than to double up. Let me look into this further...

@Aravisian There are two services which manage screen locking and screen saving: light-locker (part of light-dm) and xfce4-screensaver. Both are independent from each other and seem not to know what the other does.

The brave search resulted in the following:
"Mint Xfce Screen Locker
In Linux Mint XFCE, you can use either light-locker or xfce4-screensaver as a screen locker. If xfce4-screensaver is not running, you can start it manually by running xfce4-screensaver & in the terminal. Additionally, you can configure xflock4 to use light-locker-command -l by editing the /usr/bin/xflock4 script and appending the command to the list of lock commands.

For users who prefer light-locker, it can be installed and configured to work with XFCE. If xflock4 does not work as expected, you can manually run light-locker-command -l to lock the screen.

Lightdm Screensaver Lock

In XFCE, the screen locking mechanism can be managed by either xfce4-screensaver or light-locker, both of which can be used with LightDM. If you encounter issues with the lock screen not working, you can try disabling one of the screen savers and ensuring only the desired one is active.

To disable xfce4-screensaver and use light-locker exclusively, you can uninstall xfce4-screensaver or uncheck it in the "Session and Startup" settings under "Application Autostart." Conversely, to use xfce4-screensaver, you can disable light-locker in the same settings menu. After making these changes, log out and log in again to apply the changes.13

If you are using xfce4-screensaver and encounter issues where the lock screen does not appear, you may need to ensure that the xflock4 script is updated to include the xfce4-screensaver-command --lock command.4

LightDM itself does not handle screen locking; it relies on the screen saver or locker application to manage the locking process. To ensure the screen locks automatically, you can configure the DPMS settings using the xset command to enable screen blanking and set a timeout.4

For troubleshooting, you can check if the screensaver daemon is running and if DPMS is enabled. If DPMS is disabled, you can enable it with xset +dpms .4

If you are using LightDM with XFCE and experience issues with the lock screen, ensure that LightDM is running and that the correct locker command is being used by xflock4. If xflock4 does not work, you may need to manually lock the screen using light-locker-command --lock or xfce4-screensaver-command --lock .7

Additionally, you can configure Power Manager to lock the screen when the system goes to sleep, which can be done by opening Power Manager, navigating to the Security tab, and ticking the box to lock when going to sleep.7

If you still face issues, you may need to check the environment variables and ensure LightDM is properly configured and running.7

Xfconf Screen Locker
To configure the screen locker in XFCE, you can use xfconf-query to set the LockCommand property. This command tells XFCE which locker to use when the screen is locked. For example, you can set it to use light-locker-command or xfce4-screensaver-command:

xfconf-query --channel xfce4-session --property /general/LockCommand --set "light-locker-command -l"
This command sets the locker to light-locker-command -l, which is the command for light-locker to lock the screen.
If the property does not exist, you can create it with:

xfconf-query --channel xfce4-session --property /general/LockCommand --set "light-locker-command -l" --create -t string
Additionally, ensure that xscreensaver is not set to lock the screen or manage the display, as it might interfere with the locker you are configuring.

If you are using xflock4, it is a script that checks the LockCommand property and tries to run the configured locker. If xflock4 is not working, you can override it by creating a custom /usr/local/bin/xflock4 file with the locker command you want to use.

To verify the current LockCommand setting, you can use:

xfconf-query --channel xfce4-session --property /general/LockCommand
This command will display the current locker command configured in XFCE.

If you encounter issues with light-locker, ensure that lightdm is running, as light-locker requires lightdm to function properly.

KI-generated answer. Verify the facts"

This is the xflock4 script:

I couldn´t find it in the automatically started programs, so I don´t know if the script is used.

In addition to lightdm, which is included in the autostart and controls the login window, there is also the PolicykitAuthenticationAgent in the autostart, which can be found under the path usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1. This is probably the file you wanted to edit yesterday. It cannot be opened with a text editor (strange characters appear).

I am not well versed in Mint's inner workings, so I am not sure if Mint uses Light-locker or Xscreensaver as default.

What I would do: I would enter the settings application and fully disable both xscreensaverandLight-locker`.

With both disabled, that should reduce confusion. It also narrows your testing - if both are disabled and you no longer get the double password, we can ignore polkit as the least likely culprit.

To be honest, I don't quite understand what to do now. What should I test after I have deactivated both? I definitely want to use a screen saver. The question I have is: Is it possible to use only one service for locking the screen and the screensaver - either only lightdm with lightlocker or only xfce4-screensaver? Xscreensaver is not installed in Mint.

You are only checking if you get a double prompt for password. If not, we can ignore polkit.

I believe Mint uses xfce4-screensaver not xscreensaver.

LightLocker only manages lockscreen.
xfce4-screensaver, however can manage both.
So, you want to use only xfce4-screensaver.

You can safely just remove light-locker:

sudo apt remove light-locker

...check for dependencies it will take with it first, just in case... and relay any you have doubts about.

Launch the xfce4-screensaver settings and configure how you want your screensaver to operate.
then click the Lock Screen tab.
Enable the slider for "Enable Lock screen"
That is it.

You can slide the "Lockscreen with screensaver" option if you want the lockscreen to use the screensaver insteadof the default login screen.

You can slide for "Lockscreen with sleep" if you use the Sleep function.
and "logout" can be set if you want to be automatically logged out after a period of time passes unattended. You do not need to enable this for the LockScreen to be managed by the screensaver.

On mine, I only have it enabled for the Lock Screen. All the rest is disabled.

Thank you very much for your answer. I have read that lightlocker can also display a black screen as a screen saver. Therefore it would be suitable for
for me, especially because the normal login window at system startup is also managed by lightdm.
I don't want to uninstall xfce4-screensaver or lightlocker because I can't tell whether everything will still work afterwards.
It should also work to just deactivate it.
What is not yet clear to me is whether the authentication windows after standby are also controlled by the autostart and whether it makes sense to deactivate the services in the autostart.

Yes, you do not have to remove a software - you can do that for the additional peace of mind of inhibiting its ability to interfere.
But you are correct that deactivating it is enough.

It makes sense to deactivate autostart on any services that you do not want to start at login. In this case, you should not have both lightlocker or screensaver active in autostart.

If that suits you, you can. You are free to choose. As long as you do not run both services at once, you will avoid the double prompt.

This is what the settings windows in Autostart and Power Management look like. I took the screenshot on my other computer in Distrosea, so everything is in English.
Can you please show me what I should set in these windows,
a) to use only lightlocker/lightdm
b) to use only xfce4-screensaver.
I am not clear what to set where. I removed screen locker from autostart, but after that I could no longer lock my computer manually when I clicked on the lock icon.