Tuesday, May 31, 2022

Suspend won't work when screen locked in XFCE


If you set the screen to lock after a certain period in XFCE, and the computer to suspend after a further period, you may encounter the above message when you come back to the computer: the screen has blanked but the computer hasn't suspended. The message is (for search engines):

Authentication is required to suspend the sytem. Action: org.freedesktop.login1.suspend. Vendor: The systemd Project.

The XFCE settings for this are:

Power Manager > System > System Power Saving > Suspend / When inactive for 30 minutes.

and

Power Manager > Display > Display Power Management > Blank after 15 minutes

and

Power Manager > Security > Light Locker > Automatically lock the session / When the screensaver is activated

This does not happen if the screen is set to blank but not lock, and to lock when the system suspends, with the settings:

Power Manager > Security > Light Locker > Automatically lock the session / Never

and

Power Manager > Security > Light Locker > Lock screen when system is going to sleep

A solution (if you would like to lock the screen when it blanks and have the system suspend at a later time) is

Add a file 

/etc/polkit-1/rules.d/85-suspend.rules

(NB this involves creating a directory and a file in it - read to the end if you need instructions for this.)

with: 

polkit.addRule(function(action, subject) { 

 if (action.id == "org.freedesktop.login1.suspend" && 

 subject.isInGroup("<your user name>")) { 

 return polkit.Result.YES; 

}); 

And in Terminal, type: 

# chmod 755 /etc/polkit-1/rules.d 

# chmod 644 /etc/polkit-1/rules.d/85-suspend.rules 

Then reboot.

This is a slightly modified version of a solution posted by mja at askubuntu.com. Why? Because the solution there uses:

subject.isInGroup("users")) {

But the group "users" does not exist by default, and its use in not recommended according to the Arch Wiki. Using my user name (which is also a group by default) worked for me.

So if your user name is fred, use

subject.isInGroup("fred")) {

Note that mja also points out that the first solution on the Ask Ubuntu site involving the 

org.freedesktop.login1.policy

file is not recommended according to the Arch Wiki site because the file could be overwritten at a later date.

The Debian Wiki has a solution to the same problem which involves the rules file and the policy file, but does not mention the need to create the group users.

For me, using the rules file was enough to solve the issues.

The Debian Wiki does give instructions for creating the rules.d directory:

# mkdir /etc/polkit-1/rules.d

so check it out if the process is unclear.



Friday, May 6, 2022

(M)utter Madness - application is not responding

I am running Gnome on Debian Testing, and after a recent update to Gnome 42, I started getting the

Application is not responding

dialogue box every few seconds with any application that carries out any processing operations, forcing me to click the "Wait" button to continue. The main culprit was Synaptic, which has to update and check package lists to identify updates: a process which quite normally takes a few seconds. I was getting the "not responding message three times during this process.

I don't know what changed recently to cause this annoyance, but here is how to fix it.

Open dconf Editor and go to /org/gnome/mutter.

Look for check-alive-timeout and edit the period if necessary. Mine was set to 5000 which is 5 seconds in milliseconds. I changed to to 60000, which is 1 minute in milliseconds - a more reasonable period.

Update:

I did a bit more research and found that it may actually be the application at fault,and the issue may be limited to Wayland.

The check-alive feature is there for the user to be able to terminate frozen applications more easily. However, sometimes applications are implemented in a way where they fail to be reply to ping requests in a timely manner, resulting in that, to the compositor, they are indistinguishable from clients that have frozen indefinitely. 

When using an application that has these issues, the GUI showed in response to the failure to respond to ping requests can become annoying, as it disrupts the visual presentation of the application. 

To allow users to work-around these issues, add a setting allowing them to configure the timeout waited until an application is considered frozen, or disabling the check completely.

Gnome has added this setting, which is good.

 gitlab.nome.org

Wayland compositors can send a ping to apps that they are supposed to respond to with a pong. However, if an app caught itself in an infinite loop or other computation that takes a long time, it might not send that pong.

reddit.com

Requests provided by wl_shell_surface 

wl_shell_surface::pong - respond to a ping event 

serial 

uint - serial number of the ping event 

A client must respond to a ping event with a pong request or the client may be deemed unresponsive. 

wayland.freedesktop.org