19

I recently upgraded to 14.04 and since then my lock screen is not working.I read online that gnome-screensaver is not supported in Trusty and it was suggested that I install xscreensaver instead. The latter worked fine for only a few days. Moreover even when I log out, I'm not prompted for a password while logging back in. I read a bit more and found that in Trusty Unity has its own lock screen. So instead of the old lightdm/gnome-screensaver we can use Unity. I found this and tried to check if enabling the lightdm lock screen helped in any way. As it turns out I don't have the Lockscreen option as mentioned in the link. What could be a possible way to solve the issue?

fts
  • 213
  • 1
  • 3
  • 6
  • Nobody has answered the question yet. And it's weird because it doesn't work on all my computers anymore, so it should be like that for everybody. – erikbstack May 01 '15 at 20:59

5 Answers5

14

Try these:

sudo apt-get remove gnome-screensaver
sudo apt-get install xscreensaver xscreensaver-gl-extra xscreensaver-data-extra

Then search for "Screensaver" in the menu and tweak its settings to your needs.

To add Xscreensaver to startup, open Startup Applications and add "xscreensaver -nosplash".

To get CTRL + ALT + L to lock the screen and start the screensaver, go to System Settings > Keyboard and on the "Shortcuts" tab, under "System", change the "Lock screen" keyboard shortcut from CTRL + ALT + L to something else, then under "Custom Shortcuts", click the "+" button to add a new custom shortcut, under "Name" enter "Xscreensaver" and under "Command" enter "/usr/bin/xscreensaver-command -lock", then click "Apply".

And finally, click next to the newly created shortcut and press CTRL + ALT + L to assign it to it (or use any other keyboard shortcut you want, but make sure it's not already assign to something else). Alternatively, you can run the following command instead of assigning a new keyboard shortcut for the old screensaver:

sudo ln -s /usr/bin/xscreensaver-command /usr/bin/gnome-screensaver-command

To revert the changes (go back to the black GNOME Screensaver screen), use the commands below:

sudo apt-get remove xscreensaver xscreensaver-gl-extra xscreensaver-data-extra
sudo rm /usr/bin/gnome-screensaver-command
sudo apt-get install gnome-screensaver

If you've used the alternative method to assign CTRL + ALT + L to Xscreensaver lock screen, open System Settings > Keyboard again, remove the custom Xscreensaver command and assign CTRL + ALT + L back to "Lock screen" (under "System").

A J
  • 11,367
  • 17
  • 44
  • 59
CR2
  • 434
  • 1
  • 3
  • 7
  • I tried adding a custom shortcut with the xscreensaver command, but the shortcut is disabled by default. Whenever I click it the popup with the name and the command pops up. I am unable to assign any shortcut to it – fts May 03 '14 at 06:17
  • When I do sudo apt-get remove gnome-screensaver -s it suggests to remove the whole gnome desktop, so I wouldn't try this... see my answer below. – domih Feb 08 '16 at 13:00
3

I'm using Gnome and I had the same issue that after the update to 14.04 the screen wasn't locked after the timeout. Interestingly it did work after I locked the screen using "Ctrl + Alt + L". I found that the problem was that gnome-screensaver wasn't started after booting, but was started when unlocking the screen.

So my solution was to add the gnome-screensaver command to the startup applications which solved the issue.

matthias
  • 676
1

As suggested here it is possible to trigger lock screen from command line. To enable the keyboard shortcut you have to create a custom keyboard shortcut and link it to your lock screen script. Here is how I fixed it:

  1. Create a folder ~/scripts and in folder create script lockme.sh

    \#!/bin/bash
    DISPLAY=:0 gnome-screensaver-command -l
    
  2. Create custom keyboard shortcut for lock screen:
    Go to "System Settings" > Keyboard > Keyboard Shortcuts, and add a custom keyboard shortcut by clicking on the [+]. Give it a funky name and the command is in my case: /home/username/scripts/lockme.sh Then click OK

  3. Set the keyboard shortcut:
    Click on the new created row and press [Super]+L on your keyboard to assign this keyboard combination to start the script.

domih
  • 265
0

well, here I switch window managers quite often, a way to grant any key binding will work for them all is to use
xbindkeys and xbindkeys-config

tip: if the grab key crashes on the config application, the config file ~/.xbindkeys has instructions how to set it manually or at least how to skip the grabbing and type the keys identifiers directly, here became:

#Screen Lock
"gnome-screensaver-command --lock"
   Control+Alt+l

Obs.: this works on ubuntu 16.04 but is available for 14.04 too https://launchpad.net/ubuntu/+source/xbindkeys

-1

To manually lock, use the "Ctrl + Alt + L" key combo. For automated locking use the "Brightness and Lock" applet in "System Settings"

lidex
  • 17
  • 1