Please allow me to disable suspend in 11.04

Asked by David Graves

I have been using linux as my primary desktop since the late 90s. I've been using Ubuntu since version 9.

One of the first things I ALWAYS do on my desktop is change the XF86Sleep button to "Lock Screen".

My reasons for doing this are really irrelevant, but since you have recently disallowed this I feel like I need to justify this behavior. Some reasons include:

1.) Suspend is buggy. Better than ever, yes. but buggy still.
2.) On my favorite keyboard, the sleep button is right next to the Mute button, and all-too-easily pressed by accident.
3.) For reason 1, but also in case I am running an important job in a ssh terminal session connecting to another box, an unexpected suspend can cause hours of work to be lost.
4.) I treat my desktop as a server, running server processes, doing important computing and stuff, and I do not ever, ever, ever want it to suspend.
5.) I like a quick lock screen button. I work in an office with many merry pranksters, and I never leave my desk without locking the desktop. Ctrl+Alt+L is not 100% depending on which window has focus (looks at VirtualBox)

Before everyone chimes in with the obvious solutions, let me tell you what I have done so far.

Disabled sleep in /etc/default/apci-support
Disabled suspend buttons/actions in gconf, and made this permanent with a .pkla file in /etc/polkit-1/localauthority/50-local.d

So now I never suspend, All that's left to do is change the keyboard shortcut and map XF86Sleep to Lock Screen.

Hey it worked. Then I rebooted. That last step, changing the keyboard shortcut for Lock Screen to XF86Sleep? I have to do it every time. EVERY FSCKING TIME!

I don't know what kind of big discussion was had at the end of 10.10, but whatever reasoning you had for breaking all this is not acceptable. Nobody needs suspend so badly that it cannot be disable-able. I don't care what "simplicity of user interface" reasoning you use to justify this, it is JUST PLAIN STUPID.

It's one thing to make me discover how to get beneath the covers to disable the "ruin my life for an hour button", but what about the other 99.999999 percent of users? They don't want to make local polkit files. They just want to change the behavior of one simple little button on their keyboard. Why do you make this so hard?

It's my keyboard, let me configure it the way I want. You have a beautiful Keyboard Shortcuts editor GUI, why did you break it!?

I realize that changes like this are not taken lightly, and that most likely someone's pride is at stake. But that someone needs to swallow it and let things revert back the way they were. There is no reason good enough to justify this madness.

Very Sincerely,

-Dave

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu acpi Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
marcus aurelius (adbiz) said :
#1

system>preferences>keyboard shortcuts

you can look for suspend then deactivate the key assigned to it

Revision history for this message
David Graves (dgraves) said :
#2

Thanks you Marcus.

If I was using 10.10 I would find the Keyboard Shortcuts under System > Preferences, and after I disabled suspend using gconf-editor, I would be able to use the Keyboard Shortcuts to assign XF86Sleep to "Lock Screen" and it would stick.

Since 11.04, I have to go to Control Center > Personal > Keyboard Shortcuts and click on "Lock Screen" then press the XF86Sleep key to reset the shortcut every time I boot. This is half of my complaint.

The other half is how hard it is to disable suspend. And by "disable suspend" I mean completely lock out the ability to suspend by any means. Disabling a hardware suspend button, if one exists. Removing the option from the Ctrl+Alt+Delete popup dialog, removing it from the power-button menu, etc.

Revision history for this message
mycae (mycae) said :
#3

If you really want to stuff suspend good and proper, replace the pm-suspend binary with an "exit 0" script. Its brute force, but it should work (until an update updates the binary).

Revision history for this message
marcus (harrismh777) said :
#4

hi Dave,

   You have most of what you need correct. There are two pieces you still require:
  1) disable suspend and higernate in /etc/default/acpi-support
        to do this, set SUSPEND_METHODS="none" also comment out the suspend and hibernate line.

  2) to get your sleep button to lock the screen you need to redefine your sleep button with xmodmap

    Once you are logged in to a desktop session, open a terminal and get root (sudo su -)

   cd /etc
   xmodmap -pke > xmodmap.conf

   now edit /etc/xmodmap.conf

   change the key that says XF86Sleep (in all three places) to be XF86ScreenSaver

   save the file

   cd /etc/gdm/PostLogin
   mv Default.sample Default

   now edit /etc/gdm/PostLogin/Default

      add the following line:

      xmodmap /etc/xmodmap.conf

     Reboot

After you reboot (at the gdm screen) press your sleep botton... it should do nothing, or else, it should give an error indicating that suspend failed... because you disabled suspend... this is good. Now logon... at the PostLogin of gdm your Default script will run the xmodmap command redefining the XF86Sleep key to XF86ScreenSaver keysym. Your sleep key will now activate your screen saver (you should have it setup to lock).

Also, I put the key combination ctl-alt-L in my key shortcuts for Lock Screen. So, you will have two ways to lock the screen with the screen saver (sleep bottun) and with the gnome shortcut clt-alt-L.

The reason you're having all this difficulty is that the XF86Sleep key is sucked up by the power management routines before it ever gets to your desktop. In power management if you indicate that you want the keysym ignored, it will. So when you set the XF86Sleep keysym to LockScreen, it will only work until reboot... then the power management stuff starts ignoring it again.

The solution I provided (is the one I use too on 10.04 by the way) works because the redefinition of the sleep key code to the keysym XF86ScreenSaver *does not* get sucked up by the power management routines. Also, you don't have to set the keysym up in the short cuts because it is already setup to activate the Screen Saver. All you need to make sure is that the screen saver is setup the way you want... which one, and whether it locks.

Hope this helps.

Let me know if you have questions.

PS I agree with all of your comments and frustrations. This is one area that the ubuntu team just didn't think through very well. They're so busy trying to make suspend / hibernate work for laptop folks, that they forgot that desktop machines don't need it, nor want it. suspend and hibernate on my system cause the machine to crash usually damaging disk/ not good.

Revision history for this message
ggallozz (ggallozz-gmail) said :
#5

among all considerations, Dave's right for me.
Though I would strongly underline these words:
<<It's my keyboard, let me configure it the way I want. You have a beautiful Keyboard Shortcuts editor GUI, why did you break it!?

I realize that changes like this are not taken lightly, and that most likely someone's pride is at stake. But that someone needs to swallow it and let things revert back the way they were. There is no reason good enough to justify this madness.>>

who ever should, considers taking big care of that.

Aside I've to stress, once again, that whenever a solution or workaround begins with "open a terminal and... ", that pushes Ubuntu one bit farer from simple users and from spreading Linux around.

Can you help with this problem?

Provide an answer of your own, or ask David Graves for more information if necessary.

To post a message you must log in.