lock screen fails with xscreensaver

Bug #528094 reported by Brian
62
This bug affects 12 people
Affects Status Importance Assigned to Milestone
Session Menu
Confirmed
Wishlist
Unassigned
xscreensaver (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

The session menu "Lock Screen" option does not work. I managed to get Ctrl-Alt-L to lock the screen with Compiz, but the session menu item will not work.

I tried:
making symlinks from gnome-screensaver to xscreensaver and from gnome-screensaver-command to xscreensaver-command
adding a .service file to /usr/share/dbus-1/services/ called org.gnome.ScreenSaver.service with the following content:
[D-BUS Service]
Name=org.gnome.ScreenSaver
Exec=/usr/bin/xscreensaver

I also tried that with
Exec=/usr/bin/gnome-screensaver
after creating the symlink.

I'm not too familiar with dbus so I'm not sure what else I should do. Using gnome-screensaver is an option that follows dumping Gnome and choosing another distro in desirability. In other words, no chance. If gnome won't work with a real screensaver app that's additional activation energy to move me to another distro.

Architecture: amd64
DistroRelease: Ubuntu 9.10
NonfreeKernelModules: nvidia
Package: xscreensaver 5.08-0ubuntu5
PackageArchitecture: amd64
ProcEnviron:
 SHELL=/bin/bash
 LANG=en_US.UTF-8
ProcVersionSignature: Ubuntu 2.6.31-19.56-generic
Uname: Linux 2.6.31-19-generic x86_64
UserGroups: adm admin cdrom dialout lpadmin plugdev pulse pulse-access sambashare video

Revision history for this message
Anzenketh (anzenketh) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Please attach your X server configuration file (/etc/X11/xorg.conf) and X server log file (/var/log/Xorg.0.log) to the bug report as individual uncompressed file attachments using the "Attachment:" box below. Could you please also try to run without any /etc/X11/xorg.conf and let Xorg autodetect your display and video card? When you do please also attach the /var/log/Xorg.0.log from this attempt. Thanks in advance.

affects: ubuntu → xscreensaver (Ubuntu)
Changed in xscreensaver (Ubuntu):
status: New → Incomplete
Revision history for this message
Brian (x-brian) wrote :
Revision history for this message
Brian (x-brian) wrote :
Revision history for this message
Brian (x-brian) wrote :

This is the log after deleting (renaming) xorg.conf then doing a cold reboot to allow autodetect.

Revision history for this message
Brian (x-brian) wrote :

I still cannot lock screen from the session menu when running with no xorg.conf.

Revision history for this message
Anzenketh (anzenketh) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Unfortunately we can't fix it without more information. Please include the information requested at https://wiki.ubuntu.com/DebuggingScreenLocking as separate attachments.

Changed in indicator-session:
status: New → Incomplete
Revision history for this message
Brian (x-brian) wrote : apport-collect data

Architecture: amd64
DistroRelease: Ubuntu 9.10
NonfreeKernelModules: nvidia
Package: xscreensaver 5.08-0ubuntu5
PackageArchitecture: amd64
ProcEnviron:
 SHELL=/bin/bash
 LANG=en_US.UTF-8
ProcVersionSignature: Ubuntu 2.6.31-19.56-generic
Uname: Linux 2.6.31-19-generic x86_64
UserGroups: adm admin cdrom dialout lpadmin plugdev pulse pulse-access sambashare video

Revision history for this message
Brian (x-brian) wrote : Dependencies.txt
Revision history for this message
Brian (x-brian) wrote : DisplayDevices.txt
Revision history for this message
Brian (x-brian) wrote : XorgLog.txt
Revision history for this message
Brian (x-brian) wrote : XorgLogOld.txt
Revision history for this message
Brian (x-brian) wrote : XsessionErrors.txt
Revision history for this message
Brian (x-brian) wrote : glxinfo.txt
Changed in indicator-session:
status: Incomplete → New
Changed in xscreensaver (Ubuntu):
status: Incomplete → New
tags: added: apport-collected
Revision history for this message
Brian (x-brian) wrote :

# What desktop environment does this problem occur in? (GNOME, XFCE, KDE, etc.)
GNOME

# Do you use visual effects? (System/Preferences/Appearance/Visual Effects)
Yes--Compiz with custom effects

# Does the problem still occur if you disable visual effects?
Yes

# Does the problem still occur if you use the "blank screen" screensaver?
Yes

# Is the "Lock screen when screensaver is active" setting checked in System/Preferences/Screensaver?
Yes and no--xscreensaver doesn't have that option. Instead the option "Lock screen after XX minutes" is checked with XX=32

# Is this a laptop or a desktop machine?
Laptop

# How many monitors do you use?
1 or 2

# If it is a laptop, do you use an external screen?
Sometimes

# Do you have the hamster-applet application installed? This applications has been known to cause screen locking issues.
No.

gnome-screensaver daemon is _not_ running, instead I use xscreensaver. I will use gnome-screensaver if/when GNOME fixes it or Ubuntu forks it and fixes it (the bug that upstream marked WONTFIX). I get correct behavior from xscreensaver (locks screen after 32 minutes). Also, if I run xscreensaver-command -lock it works correctly. Pressing <ctrl>-<alt>-L works but only because I added it in Compiz as a command, which runs xscreensaver-command -lock. Otherwise it did not work.

I am happy with the Compiz workaround to get <ctrl>-<alt>-L to work, and if there was some way to get the session menu to call xscreensaver-command -lock I'd be happy.

Thanks,

Brian

Revision history for this message
Anzenketh (anzenketh) wrote :

"(the bug that upstream marked WONTFIX)"
Do you have that upstream link.

"# How many monitors do you use?
1 or 2"

When does it happen with duel monitors or without duel monitors or does not matter.

"# If it is a laptop, do you use an external screen?
Sometimes"
Does it happen in one case but not the other.

Changed in xscreensaver (Ubuntu):
status: New → Incomplete
Changed in indicator-session:
status: New → Incomplete
description: updated
Revision history for this message
Brian (x-brian) wrote :

Upstream gnome-screensaver bug marked WONTFIX:
https://bugzilla.gnome.org/show_bug.cgi?id=316654

That's why I use xscreensaver. If they fix that bug (or Ubuntu forks and fixes it) I'll use gnome-screensaver. I actually would love to use gnome-screensaver, but only if it works. It's been almost half a decade so it seems they'll never fix it.

This happens when I have my external monitor attached via port replicator as well as without it. I can run dual cloned screens (known as TwinView by my proprietary Nvidia drivers) or a single screen on one or the other monitor and it still happens.

-Brian

Revision history for this message
Brian (x-brian) wrote :

Oh also the launchpad bug report for gnome-screensaver:
https://bugs.launchpad.net/ubuntu/+source/gnome-screensaver/+bug/22007

Anzenketh (anzenketh)
Changed in indicator-session:
status: Incomplete → Invalid
Revision history for this message
Anzenketh (anzenketh) wrote :

I have attempted to duplicate your issue on Lucid however the issue did not occur. I may have done something different then you though.

In attempt to recreate the bug but failed I did the following steps.

sudo apt-get install xscreensaver.
sudo apt-get remove gnome-screensaver.
Launched screen-saver preferences. System> Preferences Screen-saver.
Clicked on file Lock screen now.

I have not attempted to let it automatically lock. Is that the issue you are working with? What steps would I do to recreate your issue?

I have also removed the gnome-screen-saver bug report from the log as your issue is with xscreensaver.

Revision history for this message
Anzenketh (anzenketh) wrote :

I have also verified that the timer works on xscreensaver.

Revision history for this message
Brian (x-brian) wrote :

I think you may misunderstand the bug.

xscreensaver has no problem, it is the session menu that has a bug. I cannot get the screen to lock from the session menu when I have replaced gnome-screensaver with xscreensaver. The session menu only functions properly if gnome-screensaver is used. Since gnome-screensaver is garbage, I will not use it.

I made symlinks to xscreensaver, so if I type "gnome-screensaver-command -lock" at the command prompt, the screen is locked, using xscreensaver. However, the session menu doesn't seem to use this, instead something with DBUS which I don't fully understand.

I just want the session menu to work properly when xscreensaver is used instead of gnome-screensaver.

Changed in indicator-session:
status: Invalid → Incomplete
status: Incomplete → New
Changed in xscreensaver (Ubuntu):
status: Incomplete → Invalid
Ted Gould (ted)
Changed in indicator-session:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
vamped (robert-strahl) wrote :

Brian wrote in post #14: Also, if I run xscreensaver-command -lock it works correctly. Pressing <ctrl>-<alt>-L works but only because I added it in Compiz as a command, which runs xscreensaver-command -lock. Otherwise it did not work.

I believe that <control><alt><l> is Ubuntu's default lock-screen key-combination. It works for me (activates xscreensaver lock) and I have not added it as a custom command. Moreover, I'm using the default visual-effects.

I've just:
sudo apt-get install xscreensaver
sudo apt-get remove gnome-screensaver

Lucid x86-64

Revision history for this message
Brian (x-brian) wrote :

vamped wrote in post #21:
believe that <control><alt><l> is Ubuntu's default lock-screen key-combination. It works for me (activates xscreensaver lock) and I have not added it as a custom command. Moreover, I'm using the default visual-effects.

Yes, that is the default lock-screen combo. It didn't work in Jaunty, I don't think it works in Karmic without the Compiz command, but I haven't used Lucid. Good news that it works for you!

Now the question is: can you lock screen from the session menu using xscreensaver in Lucid?

I haven't upgraded yet but probably will soon (currently Karmic).

Revision history for this message
Nee700 (mfonsen) wrote :

[1] indicates that indicator-session calls gnome screen saver directly. It should do whatever ctrl+alt+l does so that it would work with xscreensaver.

Why I'm interested? Switch user does not lock current session so I can switch between users without entering a password as long as xscreensaver timeout for lock is not hit.

Why I'm using xscreensaver? Because there's a bug [2] in gnomescreensaver that forces me to use xscreensaver for now, fix has been done, but is not yet available in standard repositories.

[1] https://bugs.launchpad.net/ubuntu/+source/indicator-session/+bug/436724
[2] https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/546578

Revision history for this message
Nadim (nakhleh) wrote :

To answer your question, Brian, yes, it appears this bug is still present in Lucid. I stumbled on this bug report after noticing the problem (I also refuse to use the broken gnome-screensaver). It looks like ctrl-alt-l works correctly in Lucid, but the "Lock Screen" session menu command does not. I also tried your symlink approach (linking gnome-screensaver-command to xscreensaver-command), and while "gnome-screensaver-command -lock" now locks the screen, the session menu still does not. So, hopefully this info helps...in the meantime, I'll use the ctrl-alt-l hotkey combo.

Revision history for this message
Nadim (nakhleh) wrote :

Just looked at the code a little, though I'm not really familiar with the internal Gnome architecture at all. It looks like indicator-session is where things go down. session_service.c is where the Lock Screen item is actually provided for the menu, and lock-helper.c (function lock_screen()) is where it actually is making the call. It's making a dbus call, but again, as I really don't know anything about dbus, my ability to trace further ends without some actual knowledge / work on my part. :)

Revision history for this message
Brian (x-brian) wrote :

Thanks Nadim.

I have upgraded now to Lucid on a new machine, and the bug is still present. I did notice that Ctrl-Alt-L locks the screen with xscreensaver now :)

I tried to fix the DBus issue, but I am in the same boat as far as knowledge about what's happening there. In
https://bugs.launchpad.net/ubuntu/+source/indicator-session/+bug/436724
Ted Gould says that what the session menu does is:

$ dbus-send --print-reply --reply-timeout=100 \
--dest=org.gnome.ScreenSaver / org.gnome.ScreenSaver.Lock

so I tried that on my machine. It did not work and the response was:
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.ScreenSaver was not provided by any .service files

I made a file at /usr/share/dbus-1/services/org.gnome.ScreenSaver.service with the following contents:
[D-BUS Service]
Name=org.gnome.ScreenSaver
Exec=/usr/bin/xscreensaver

(The default has /usr/bin/gnome-screensaver instead, I changed that hoping it would call xscreensaver.)

Tried that again and it still didn't work:
$ dbus-send --print-reply --reply-timeout=100 \
--dest=org.gnome.ScreenSaver / org.gnome.ScreenSaver.Lock

Error org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1

I went through this on Karmic as well, same result. If there was someone who knows more about how DBus works, maybe we could get a workaround. It seems to me that there is something missing other than the .service file. The --dest now seems to be there since the .service file is created, but I don't think anything will understand the message name, which is "org.gnome.ScreenSaver.Lock"
("destination object path" = "/" and "message name" = "org.gnome.ScreenSaver.Lock" according to the dbus-send manpage.)

Revision history for this message
Carlos Manuel Pires (cmpsalvestrini-gmail) wrote :

In addition to Brian's comment dated 2010-06-17: I got the session menu to lock the screen with xscreensaver. In the file /usr/share/dbus-1/services/org.gnome.ScreenSaver.service I modified the Exec line to the following:

Exec=/usr/bin/xscreensaver-command -lock

and the dbus-send command worked. My screen now locks with the session menu. Being a complete dbus newbie, I have no idea whether this will cause all screen saver sessions to always lock the screen though.

Brian (x-brian)
Changed in xscreensaver (Ubuntu):
status: Invalid → New
Revision history for this message
Brian (x-brian) wrote :

Excellent Carlos!

I made a file called:
/usr/share/dbus-1/services/org.gnome.ScreenSaver.service
with the following contents:
[D-BUS Service]
Name=org.gnome.ScreenSaver
Exec=/usr/bin/xscreensaver-command -lock

And now the session menu works. It looks like this needs to be added to the xscreensaver package (i.e. the bug is in the xscreensaver package, not the session menu). I have attached the file as well.

If someone could fix the xscreensaver package to install this file this bug would be closed.

Revision history for this message
Carlos Manuel Pires (cmpsalvestrini-gmail) wrote :

One further detail about this that I didn't notice until now: When running the dbus-send command, I get a DBus error as follows:

Error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Since I'm not knowledgeable on DBus I wouldn't know how to repair this, but judging from other forum posts dealing with this same type of error it seems like it's more of an ignorable warning rather than a serious error -- as a matter of fact, the screen locks correctly. Maybe there is some other finer point to making this session lock tweak without error that I'm missing?

Revision history for this message
Brian (x-brian) wrote :

I expected something like that to happen--it seems like with the .service file you listed, the destination object now calls 'xscreensaver -lock' as the executable, which does what is expected, but the "message name" = "org.gnome.ScreenSaver.Lock" is not recognized and no reply is made via DBUS. So that error is probably ignorable, at least as a work-around.

Maybe the .service file should have
   Exec=/usr/bin/xscreensaver-command
and the -lock option should be controlled by DBUS somehow via the "message name."

In fact, it seems that whenever I get a notification (new mail or network connect/disconnect, etc), the screen locks. That (the notifications program) must also be communicating with org.gnome.ScreenSaver, but sending a different message name. I am assuming that is because it wants to put the notification on top of the screen saver if it is active, so it has to get access. Now, it just locks the screen, since that is what is done whenever DBUS calls the service.

Again, it would be great for someone with more knowledge of DBUS to look into this.

So, this is not a complete work-around or patch, since it results in undesired behavior. :( In fact, I may remove the .service file.

Revision history for this message
cpaul (chainpaul) wrote :

Since you have disabled the gnome-screensaver, the dbus object org.gnome.ScreenSaver is not created while the Gnome starts.

We need to create the dbus object org.gnome.ScreenSaver and implement the Lock method.

I use the below python script to create the org.gnome.ScreenSaver.

----------- myscreen-dbus.py --------
#!/usr/bin/python

import dbus
import dbus.service
import dbus.glib
import gobject
import os

class ScreenDbusObj(dbus.service.Object):
    def __init__(self):
        session_bus = dbus.SessionBus()
        bus_name=dbus.service.BusName("org.gnome.ScreenSaver",bus=session_bus)
        dbus.service.Object.__init__(self,bus_name, '/org/gnome/ScreenSaver')

    @dbus.service.method("org.gnome.ScreenSaver")
    def Lock(self):
        os.system( "xscreensaver-command -lock" )

if __name__ == '__main__':
    object=ScreenDbusObj()
    gobject.MainLoop().run()

You should keep this script running on the background. The 'Lock Screen' button will call the method Lock and the method Lock will execute the xscreensaver-command -lock.

To automatically start this script, you need to add the command, i.e. /path-to-the-script/myscreen-dbus.py & in the System/Preferences/Sessions.

P.S.
You don't need the ScreenSaver .service file

Revision history for this message
Brian (x-brian) wrote :

It looks like this should be part of the xscreensaver package, so that the lock screen menu item will work. Either that, or the Session Menu should look for xscreensaver vs gnome-screensaver, and enable the appropriate method. I am assuming the DBUS object is created by gnome-screensaver, so the easiest thing to integrate xscreensaver and Gnome would be to change the xscreensaver package, though really it's Gnome's Session Menu that fails here. From my point of view, the Session Menu should look for a way to lock the screen (gnome-screensaver, xscreensaver) and create the appropriate DBUS object. If no screensaver is present, then the screen can't be locked and the menu item shouldn't be available. Doing it right would require changing gnome-screensaver and the Session Menu.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xscreensaver (Ubuntu):
status: New → Confirmed
Revision history for this message
Scott T Rogers (scott-t-rogers) wrote :

I am using Ubuntu 11.10. Pressing the menu command for lock screen does nothing. Using the keyboard shortcut CTRL+ALT+L give the following error popup:

Couldn't execute command: gnome-screensaver-command --lock
Verify that this is a valid command.

Revision history for this message
Francewhoa (francewhoa) wrote :

Confirming this bug is still present in Ubuntu 12.04 LTS, 32bits, Unity

Revision history for this message
Francewhoa (francewhoa) wrote :

Here is a workaround. Works with Ubuntu 12.04 LTS, 32 bits.

Using Ubuntu Software Center or Terminal, install xscreensaver-gl-extra and xscreensaver-data-extra

Click OK to both prompts asking to turn-off Gnome Daemon and to start xscreensaver-daemon respectively.

If you want to manually lock the screen with the keyboard combination CTRL+ALT+L then you will need to run the following to repoint the old gnome-screensaver lock to xscreensaver:

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

Logout or restart for all changes to take effect. CTRL+ALT+L usually works without restart.

Enjoy

Source: http://askubuntu.com/questions/64086/how-can-i-change-or-install-screensavers

Revision history for this message
vgeloven (vgeloven) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.