Lockscreen not working after update to 21.10

hmm

have you got a file called /usr/share/gnome-shell/org.gnome.ScreenSaver ?

i.e. do you have both gnome-shell and budgie installed? I’m wondering if gnome-shell is interfering here.

I do have that file, this is its content:

imports.package.start({
    name: 'gnome-shell',
    prefix: '/usr',
    libdir: '/usr/lib',
});

right - so gnome-shell is screwing up budgie here.

Does this work?

pkill -9 -f /usr/bin/gjs /usr/share/gnome-shell/org.gnome.ScreenSaver

Wait a couple of seconds then try running

gnome-screensaver

That allowed me to lock the screen with WIN+L

right … so its question of crafting a bash script now that can be autostarted.

It will need to test if gnome-screensaver is running

if not - run that pkill command above, sleep 5, followed by gnome-screensaver.

1 Like

So this is what I came up with:

#!/bin/bash
if ps ax | grep -v grep | grep gnome-screensaver > /dev/null
	then
		echo "gnome-screensaver is not running"
		echo "starting gnome-screensaver ..."
		pkill -9 -f  '/usr/bin/gjs /usr/share/gnome-shell/org.gnome.ScreenSaver'
		sleep 3
		gnome-screensaver
	else
		echo "gnome-screensaver already running"
		exit
fi

Adding it to startup applications seems to be sufficient to get everything running the way it should.

Cheers for the help

2 Likes
pkill -9 -f /usr/bin/gjs /usr/share/gnome-shell/org.gnome.ScreenSaver

The two pkill commands should just be one as above.

Had to run them separately because your command returns this:

pkill: only one pattern can be provided
Try `pkill --help' for more information.

Ah … missing single quotes

pkill -9 -f  '/usr/bin/gjs /usr/share/gnome-shell/org.gnome.ScreenSaver'
1 Like

Will give this a try. I’m new to the Linux structure but should be capable of pasting this into terminal. again thanks! Will let you know if it also works on 20.04.

1 Like

Open gedit, copy the following and paste it into gedit, save it as screensaver-autorun.sh in a place where you’re not gonna move it. Then in the menu search for ‘Startup Applications’, click add, give it a name and in ‘Command’ click ‘Browse’ and select screensaver-autorun.sh.

That should do it

1 Like

Note to all … if you don’t use gnome-shell then this solution is easier and quicker to do

[UPDATED] I have been struggling with the same issue stemming from the same update. These instructions worked perfectly for me. Thank you all for this.

Cheers!

(the original post mentioned an issue with the ‘x’ key on my laptop which has since been determined to be unrelated)

Lockscreen broke for me too - but that script didn’t work for me so I modified it to work.

#!/bin/bash
if ! pgrep -f gnome-screensaver &> /dev/null 2>&1; then
  echo "gnome-screensaver is not running"
  echo "starting gnome-screensaver ..."
  pkill -9 -f  '/usr/bin/gjs /usr/share/gnome-shell/org.gnome.ScreenSaver'
  sleep 3
  gnome-screensaver
else
  echo "gnome-screensaver already running"
  exit
fi

Also when adding it to autostart I needed to delay it from running for like 5 seconds so or it’d fail.

/bin/bash -c "/usr/bin/sleep 5;/home/rreaves/lockfix.sh&"

I use this script to solve the same problem but it doesn’t work, any suggestions!

Make sure you are using slick-greeter not gdm3.

If you don’t want to use gnome-shell then removing this package will make the lock screen work

sudo apt purge gnome-shell-common

Many thanks! problem solved.

@fossfreedom Amazing hint for that apt purge gnome-shell-common trick, finally my lock shortcut (& lock command in general) is working again. Why does removing that package help with this specific problem?

gnome-shell installs an autostart file that also runs when you login. It is that autostart file that prevents gnome-screensaver working correctly. By uninstalling gnome-shell-common, that autostart file and the accompanying application (called gjs) is removed. Thus gnome-screensaver works correctly.

1 Like

But first what triggered here the installation of gnome-shell-common ?

×buntu are not made to use many DE on a same installation, furthermore if different DE get used by only one and same user.

Most DE being « forks » from Gnome components and using Gtk, they use same files for storing their different parameters, ending up in - no other word - mess.

That’s the purpose of each variant, each integrates one DE.