Mate-screensaver crash revisited ( Ubuntu-MATE 20.04 LTS )

Since the mate-screensaver had a bugfix, it does not crash anymore, but stops working without crashing after a few days. Luckily it utters an errormessage when it stops working:

** (mate-screensaver:2060): CRITICAL **: 01:29:39.354: matemenu_tree_get_root_directory: assertion 'tree->loaded' failed

Since it doesn't crash anymore, this makes the workaround slightly different than it was but still reasonably straightforward because we can detect the moment that it writes an errormessage.

The workaround:

sudo apt-get install inotify-tools && mkdir -p "$HOME/bin" || exit
cat<<\EOF >"$HOME/bin/screensaverfix"
#!/bin/bash

# to be the only instance, kill all the others, but not yourself
kill -SIGKILL $( pgrep "${0##*/}" |grep -v "$$" )

# logfile, name it whatever you like
logfile="$HOME/screensavercrash.log"

# create and/or empty logfile
:>"$logfile"

# kill the running version of screensaver
# and start the screensaver, and if it logs anything, kill & restart again
while :
do
	killall -SIGKILL mate-screensaver
	sleep 1
	( mate-screensaver --no-daemon --display=:0 &>>"$logfile" ) &
	sleep 1
	pgrep mate-screensav && inotifywait --event modify "$logfile"
done &>/dev/null
EOF
chmod a+x "$HOME/bin/screensaverfix"

Make a new autostart-entry:
screensaverfix

This works for now, I will probably optimize this a bit within a few weeks.

1 Like

Why do we need this homebrew script on stable LTS system?
Could you please add links to relevant bug-reports (to upstream and to launchpad)? Also please file a bug using apport-bug mate-screensaver if you can't find existing bug-reports.
Which problem do you solve?

Why do we need this homebrew script on stable LTS system?

Hi Norbert, thanks for your input. :slight_smile:

First, let me apologise. I was not completely clear about this bug.
The bug is not only in 20.04 but also in later versions.
But 20.04 is at the moment the only supported version with that bug that I know of.
I have 22.04 on my other computer but that computer is never running longer than a few hours contiguously so I haven't been able to check that yet.

Let's go back a bit in history:
mate-screensaver stops working after a certain amount of time.
It used to crash and resulted in questions like:

and

While the bug was reported here:
mate-screensaver crashed with SIGSEGV in matemenu_tree_item_ref()

I knew it would be a lot of time and patience to debug this because the bug only presented itself after many hours of running.

Therefore I made a workaround for myself, (including catching the error if it crashed) and also shared it:

You also referenced it in another case:

Some time ago the crashing seems to be fixed.
It no longer crashes but just stops working.

Bugreport is here:

Since the old workaround reacted on the crash by restarting mate-screensaver, I created a new workaround, tested it for about 150 hours and shared it here.

It waits for the errormessage, kills mate-screensaver and starts it again.

The problem that I solve is that mate-screensaver keeps on working, even after erroring out.

I ran apport just now, but besides the usual information it did not contained the error-output of mate-screensaver so I hesitate.

Would you like me to run apport nevertheless ?

Oh, b.t.w. , In this story, for clearness sake, I ignored the fact that mate-screensaver is started several times at boot by default. That is something I will address when I find out where that comes from
( systemd | /etc/xdg-autostart | .config/autostart )

If I broke some houserules with this, please accept my sincere apologies.

2 Likes