Lock Screen not working. 14.04

38,826

Solution 1

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").

Solution 2

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.

Solution 3

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.

Share:
38,826

Related videos on Youtube

fts
Author by

fts

Updated on September 18, 2022

Comments

  • fts
    fts over 1 year

    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
    fts about 10 years
    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
  • domih
    domih over 8 years
    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.