[karmic] gnome-power-preferences not storing settings

Bug #407491 reported by A. Bram Neijt
66
This bug affects 8 people
Affects Status Importance Assigned to Milestone
gnome-power
Fix Released
Critical
gnome-power-manager (Ubuntu)
Fix Released
Critical
Canonical Desktop Team
Karmic
Fix Released
Critical
Canonical Desktop Team

Bug Description

Binary package hint: gnome-power-manager

Actions:
Open gnome-power-preferences
Change settings
Close gnome-power-preferences

Result:
Power management does not follow the set options. Opening the preference window again, shows the settings according to some default and do not reflect the choices I made earlier.

Expected result:
The settings should have been stored in the configuration.

The attached log shows the output of:
gnome-power-preferences --verbose > attached_file.log
gnome-power-preferences --verbose >> attached_file.log

It seems like the settings are not properly stored and/or reset on opening the application.

ProblemType: Bug
Architecture: amd64
Date: Fri Jul 31 22:29:36 2009
DistroRelease: Ubuntu 9.10
Package: gnome-power-manager 2.27.2+git20090729-0ubuntu2
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, user)
 LANG=en_US.UTF-8
ProcVersionSignature: Ubuntu 2.6.31-4.23-generic
SourcePackage: gnome-power-manager
Uname: Linux 2.6.31-4-generic x86_64

Revision history for this message
A. Bram Neijt (bneijt) wrote :
Revision history for this message
Scott Howard (showard314) wrote :

Thanks for your report and helping make Ubuntu better. Since you have attached all the relevant logs, I'm marking as confirmed. Since this will affect a large population of users, the status is high (especially since there is potential data loss from unwanted shutdowns, suspends, etc.)

There is another release of GPM coming out next week. Let's test that version (2.27.3-0ubuntu1) and see if the bug still exists. If it does, we should report this bug upstream. Forwarding instructions please have a look to http://wiki.ubuntu.com/Bugs/Upstream/GNOME. If you forward the bug, please post a link to the upstream bug report here.

Changed in gnome-power-manager (Ubuntu):
importance: Undecided → High
status: New → Confirmed
tags: added: ping-2.27.3
Revision history for this message
A. Bram Neijt (bneijt) wrote :

Upon futher investigation, settings are stored. The problem was specific to which option I choose, the problem is an off by one thing. For "On Battery Power", "Wehn laptop lid is closed" the options are:
Blank Screen
Suspend
Hibernate
Shutdown

If I choose Hibernate, --verbose shows
 - Changing /apps/gnome-power-manager/buttons/lid_battery to suspend
choosing shutdown shows hibernate, suspend shows blank, blank shows "nothing".

So the option choices are just off-by one and my choice seemed to be ignored but was really stored as the option above it. Soo, choosing Hibernate sets it to suspend. This choice is reflected the next time I open gnome-power-preferences, so it is actually stored. The option box is just off-by-one. Every time I open the application, it loads the options, showing what I chooce -1, saving it on close as shown -1 again, so opening closing, opening will -1 the option also. For some reason hibernate seems to be a default becuase opening and closing a few times seems to have it end up with hibernate.

If I set it to hibernate, verifying with --verbose that it actually sets it to suspend, everything works normaly. So the option is stored and acted upon correctly. This bug is merely an interface problem.

Revision history for this message
Scott Howard (showard314) wrote : Re: [Bug 407491] Re: [karmic] gnome-power-preferences not storing settings

This may just be that your gconf got buggy some how.
You can try resetting the gconf settings by following the instructions here:
https://wiki.ubuntu.com/DebuggingGNOMEPowerManager#Getting%20GConf%20values

I'll close this since it seems to be a configuration problem. If you'd
like additional help with this, see the "answers" section of
launchpad. Thanks for the report, and please post any additional bugs
you find!

On Sat, Aug 1, 2009 at 6:56 AM, A. Bram Neijt<email address hidden> wrote:
> Upon futher investigation, settings are stored. The problem was specific to which option I choose, the problem is an off by one thing. For "On Battery Power", "Wehn laptop lid is closed" the options are:
> Blank Screen
> Suspend
> Hibernate
> Shutdown
>
> If I choose Hibernate, --verbose shows
>  - Changing /apps/gnome-power-manager/buttons/lid_battery to suspend
> choosing shutdown shows hibernate, suspend shows blank, blank shows "nothing".
>
> So the option choices are just off-by one and my choice seemed to be
> ignored but was really stored as the option above it. Soo, choosing
> Hibernate sets it to suspend. This choice is reflected the next time I
> open gnome-power-preferences, so it is actually stored. The option box
> is just off-by-one. Every time I open the application, it loads the
> options, showing what I chooce -1, saving it on close as shown -1 again,
> so opening closing, opening will -1 the option also. For some reason
> hibernate seems to be a default becuase opening and closing a few times
> seems to have it end up with hibernate.
>
> If I set it to hibernate, verifying with --verbose that it actually sets
> it to suspend, everything works normaly. So the option is stored and
> acted upon correctly. This bug is merely an interface problem.
>
> --
> [karmic] gnome-power-preferences not storing settings
> https://bugs.launchpad.net/bugs/407491
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “gnome-power-manager” package in Ubuntu: Confirmed
>
> Bug description:
> Binary package hint: gnome-power-manager
>
> Actions:
> Open gnome-power-preferences
> Change settings
> Close gnome-power-preferences
>
> Result:
> Power management does not follow the set options. Opening the preference window again, shows the settings according to some default and do not reflect the choices I made earlier.
>
> Expected result:
> The settings should have been stored in the configuration.
>
> The attached log shows the output of:
> gnome-power-preferences --verbose > attached_file.log
> gnome-power-preferences --verbose >> attached_file.log
>
> It seems like the settings are not properly stored and/or reset on opening the application.
>
> ProblemType: Bug
> Architecture: amd64
> Date: Fri Jul 31 22:29:36 2009
> DistroRelease: Ubuntu 9.10
> Package: gnome-power-manager 2.27.2+git20090729-0ubuntu2
> ProcEnviron:
>  SHELL=/bin/bash
>  PATH=(custom, user)
>  LANG=en_US.UTF-8
> ProcVersionSignature: Ubuntu 2.6.31-4.23-generic
> SourcePackage: gnome-power-manager
> Uname: Linux 2.6.31-4-generic x86_64
>

Changed in gnome-power-manager (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Arnaud Faucher (arnaud-faucher) wrote :

I can confirm too that this bug still exists, even after resetting the gconf settings to default (and reopening the session).

Please find attached the diff between default and my pre-reset g-p-m gconf settings.

Changed in gnome-power-manager (Ubuntu):
status: Invalid → Confirmed
Revision history for this message
Arnaud Faucher (arnaud-faucher) wrote :

Attached is a screenshot of a faulty "gnome-power-preferences --verbose" session.

"Shutdown" was selected in the "When laptop lid is closed" combo setting on AC, but as we see this in the log:

- Changing /apps/gnome-power-manager/buttons/lid_ac to hibernate

The same faulty behabior happens when gnome-power-preferences starts and fills the combos, overriding the gconf values even when nothing is changed in the dialog.

Revision history for this message
Arnaud Faucher (arnaud-faucher) wrote :

Fixed for me as of gnome-power-manager 2.27.5-0ubuntu1.

Revision history for this message
max (mikhmv) wrote :

for me not fixed. Same bug...

Revision history for this message
Scott Howard (showard314) wrote :

Max, could you try resetting the gconf settings by following the instructions here:
https://wiki.ubuntu.com/DebuggingGNOMEPowerManager#Getting%20GConf%20values

Although Arnaud's diff didn't show much (besides a different history section), it could be worth "updating" to the new defaults. Max, just to confirm, you're using gnome-power-manager 2.27.5-0ubuntu1, correct?

Revision history for this message
Phil Sung (psung) wrote :

Scott, I can confirm that this still happens on g-p-m 2.27.5-0ubuntu1, and with a completely fresh gconf and profile (new user account).

Revision history for this message
Scott Howard (showard314) wrote :

Great, thanks for checking.

On Tue, Aug 4, 2009 at 12:42 AM, Phil Sung<email address hidden> wrote:
> Scott, I can confirm that this still happens on g-p-m 2.27.5-0ubuntu1,
> and with a completely fresh gconf and profile (new user account).
>
> --
> [karmic] gnome-power-preferences not storing settings
> https://bugs.launchpad.net/bugs/407491
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “gnome-power-manager” package in Ubuntu: Confirmed
>
> Bug description:
> Binary package hint: gnome-power-manager
>
> Actions:
> Open gnome-power-preferences
> Change settings
> Close gnome-power-preferences
>
> Result:
> Power management does not follow the set options. Opening the preference window again, shows the settings according to some default and do not reflect the choices I made earlier.
>
> Expected result:
> The settings should have been stored in the configuration.
>
> The attached log shows the output of:
> gnome-power-preferences --verbose > attached_file.log
> gnome-power-preferences --verbose >> attached_file.log
>
> It seems like the settings are not properly stored and/or reset on opening the application.
>
> ProblemType: Bug
> Architecture: amd64
> Date: Fri Jul 31 22:29:36 2009
> DistroRelease: Ubuntu 9.10
> Package: gnome-power-manager 2.27.2+git20090729-0ubuntu2
> ProcEnviron:
>  SHELL=/bin/bash
>  PATH=(custom, user)
>  LANG=en_US.UTF-8
> ProcVersionSignature: Ubuntu 2.6.31-4.23-generic
> SourcePackage: gnome-power-manager
> Uname: Linux 2.6.31-4-generic x86_64
>

Revision history for this message
max (mikhmv) wrote :

Sorry for delay.
I was out of my computer with Karmic....
I checked it and it is still not working.

In manual exist one error:
it is use line:
gconftool --recursive-unset /apps/gnome-power-manager
Now it is
gconftool-2 --recursive-unset /apps/gnome-power-manager

Thanks for trying fix this problem

Revision history for this message
max (mikhmv) wrote :

I forgot.
I have gpm 2.27.5

Revision history for this message
Robbie Williamson (robbiew) wrote :

The "When laptop lid is closed:" settings do not retain their setting for me. I've attached the --verbose output from running gnome-power-preferences command.

Revision history for this message
A. Bram Neijt (bneijt) wrote :

The settings are off-by-one for me, and it looks like storing the settings work. And the settings take effect as soon as they are set. Your log showed:
TI:17:26:54 TH:0x207f070 FI:gpm-prefs-core.c FN:gpm_prefs_action_combo_changed_cb,267
 - Changing /apps/gnome-power-manager/buttons/lid_battery to blank

Which means that you have set the lid closed when on battery to "blank". Start gnome-power-preferences with --verbose again and try every entry in the pull-down list. If your bug is the same as mine, the verbose output will show that the preferences manager will set the option just above the one you choose. Just to make this clear, my findings are:
1) What --verbose output is set, and stored/retained. If you then close the preferences manager it will work properly according to what the output told you (not what the GUI shows).
2) As soon as you open gnome-power-preferences, it resets the options (shown in verbose) to new values which are again wrongly shown in the GUI. Closing it after that will have changed your settings even if you didn't do anything.

I'm using 64bit with the latest updates (2.27.5-0ubuntu1). I tried installing 64bit karmic alpha 3 in KVM and this did not confirm the bug. However, KVM did not have suspend and hibernate options, so it may be a problem with the insertion of the extra options, or a wrong enumeration value??

Revision history for this message
max (mikhmv) wrote :

Thanks A. Bram Neijt.
At least I setup good values...

Revision history for this message
Scott Howard (showard314) wrote :
Download full text (4.0 KiB)

Notes to developers (or me if I can get around to it...):
in src/gpm-prefs-core.c
function "gpm_prefs_setup_action_combo"
has the order:
shutdown
suspend
hibernate
blank
ask
nothing

but the enumeration is:

typedef enum {
GPM_ACTION_POLICY_BLANK,
GPM_ACTION_POLICY_SUSPEND,
GPM_ACTION_POLICY_SHUTDOWN,
GPM_ACTION_POLICY_HIBERNATE,
GPM_ACTION_POLICY_INTERACTIVE,
GPM_ACTION_POLICY_NOTHING
} GpmActionPolicy;

this causes a problem in:

gpm_prefs_action_combo_changed_cb (GtkWidget *widget, GpmPrefs *prefs)

because:
 actions = (const GpmActionPolicy *) g_object_get_data (G_OBJECT
(widget), "actions");

 active = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
 policy = actions[active];

policy calls the "active" value of the "actions" array, which does not
correspond to the checkbox order!

Fix: re-enumerate the actions order or re-write the "append" to
checkbox list to be the correct order

bug possibly originated here:
http://git.gnome.org/cgit/gnome-power-manager/commit/?id=8bf6879f00e17d7feb39cecb820ad0ad33e2e827

I have two other bugs I'm working on before I can get a change for
this one, if someone wants to take a stab at it please go ahead - I
won't be able to get to this for maybe 3 weeks (i'll be away).

On Thu, Aug 6, 2009 at 2:00 PM, A. Bram Neijt<email address hidden> wrote:
> The settings are off-by-one for me, and it looks like storing the settings work. And the settings take effect as soon as they are set. Your log showed:
> TI:17:26:54     TH:0x207f070    FI:gpm-prefs-core.c     FN:gpm_prefs_action_combo_changed_cb,267
>  - Changing /apps/gnome-power-manager/buttons/lid_battery to blank
>
> Which means that you have set the lid closed when on battery to "blank". Start gnome-power-preferences with --verbose again and try every entry in the pull-down list. If your bug is the same as mine, the verbose output will show that the preferences manager will set the option just above the one you choose. Just to make this clear, my findings are:
> 1) What --verbose output is set, and stored/retained. If you then close the preferences manager it will work properly according to what the output told you (not what the GUI shows).
> 2) As soon as you open gnome-power-preferences, it resets the options (shown in verbose) to new values which are again wrongly shown in the GUI. Closing it after that will have changed your settings even if you didn't do anything.
>
> I'm using 64bit with the latest updates (2.27.5-0ubuntu1). I tried
> installing 64bit karmic alpha 3 in KVM and this did not confirm the bug.
> However, KVM did not have suspend and hibernate options, so it may be a
> problem with the insertion of the extra options, or a wrong enumeration
> value??
>
> --
> [karmic] gnome-power-preferences not storing settings
> https://bugs.launchpad.net/bugs/407491
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “gnome-power-manager” package in Ubuntu: Confirmed
> Status in gnome-power-manager in Ubuntu Karmic: Confirmed
>
> Bug description:
> Binary package hint: gnome-power-manager
>
> Actions:
> Open gnome-power-preferences
> Change settings
> Close gnome-power-preferences
>
> Result:
> Power man...

Read more...

Changed in gnome-power-manager (Ubuntu Karmic):
status: Confirmed → Triaged
Changed in gnome-power:
status: Unknown → New
Revision history for this message
Scott Howard (showard314) wrote :

Hello all, could you please test the GPM in this PPA to see if it is working properly, I just added the fix:
https://launchpad.net/~showard314/+archive/ppa

Thanks.

Changed in gnome-power-manager (Ubuntu Karmic):
assignee: nobody → Scott Howard (showard314)
status: Triaged → In Progress
Revision history for this message
A. Bram Neijt (bneijt) wrote :

2.27.5-0ubuntu2~ppa4 did not solve the problem for me. Here is what I have for On Battery Power, When battery power is critically low.
From Combobox to verbose result
Suspend -> suspend
Hibernate -> blank
Shutdown -> hibernate

This was just after an "gconftool-2 --recursive-unset /apps/gnome-power-manager", which does seem to effect everything in the listing, but does not solve anything. Also, please let me know if you think having pushed "Make default" before Karmic started, could be of any influence in this.

Thanks for the quick uptake!

Revision history for this message
Scott Howard (showard314) wrote :

Upstream wants to know if this exists using their current git master. Would anyone be able to test that today?

Revision history for this message
max (mikhmv) wrote :

Hi,
It is not working for me...

Revision history for this message
Scott Howard (showard314) wrote :

The author of GPM has all the info. I'll be away for a few weeks, if you'd like to help with this bug, please add yourself to the CC list at:
http://bugzilla.gnome.org/show_bug.cgi?id=590991
Work on fixing this bug will occur there.

Changed in gnome-power-manager (Ubuntu Karmic):
assignee: Scott Howard (showard314) → nobody
importance: High → Critical
status: In Progress → Triaged
Revision history for this message
Scott Howard (showard314) wrote :

(critical because if you select "shutdown" on lid close, and you blank screen instead, your laptop might overheat and crash, causing data loss. I have not found a computer using Karmic that does not have this bug, so I believe it is quite wide spread)

Revision history for this message
Oded Arbel (oded-geek) wrote :

Seconded - my laptop died of heat yesterday as I've put it in my bug without verifying that it indeed suspended, which it didn't because I chose "suspend" in "When lid is closed". (it came back to life after I cooled it and it doesn't seem there was any permanent damage, but still).

Revision history for this message
Scott Howard (showard314) wrote :

All reporters have 64 bit architectures, and every computer I tested had 64 bit
architectures - and they all had this bug. I purged Ubuntu's GPM and have only
been using my own compiled git master. I added egg_debug calls to follow the
data and found something funky going on with the pointers (specifically on line
397 actions_added does not resemble the array of policies in "array").
Unfortunately, my day job prevents me from working on it as much as I'd like,
so I'll present what I have and possibly work on a patch later today - but if
the fix is obvious and easy to someone, please go ahead and do it.

This is possibly a typsetting problem on 64 bit architectures in
gpm-prefs-core.c:

lines 356-390 use:

g_ptr_array_add (array, GINT_TO_POINTER (policy));

which adds the value of "policy" (an int) into an array of pointers to longs
(GINT_TO_POINTER actually does ((gpointer) (long) (int)).

"array" is now an array of pointers to longs. The long value of each pointer is
32 bits (instead of the full 64 bits) of the value of the int "policy".

line 397:

actions_added = (GpmActionPolicy *) g_ptr_array_free (array, FALSE);

"g_ptr_array_free" returns an array of pointers to longs, which are typecasted
into an array of pointers to "GpmActionPolicy"s, which are ints. ***Therefore,
we are typecasting an array of pointers to longs to an array of pointers to
ints.*** This could be the problem.

This will only be seen in 64 bit systems since 32 bit systems have 32 bit ints
and longs while 64 bit systems have 32 bit longs and 64 bit ints.

line 399:
g_object_set_data_full (G_OBJECT (widget), "actions", (gpointer) actions_added,
(GDestroyNotify) gpm_prefs_actions_destroy_cb);

Here is where we pass actions_added to set the "actions" for each of the combo
box choices. actions added could be an array of pointers to longs typecasted to
an array of pointers to ints.

Revision history for this message
Scott Howard (showard314) wrote :

Upstream committed the fix:
http://git.gnome.org/cgit/gnome-power-manager/commit/?id=8ae9438e8bfbcf2aca3ae787185b2200eb4f59d2

You can get the updated package here:
https://launchpad.net/~showard314/+archive/ppa

main-sponsors (pitti), could you merge the linked branch with the gnome-power team's? The patch is included in that branch and attached here.

Revision history for this message
Phil Sung (psung) wrote :

2.27.5-0ubuntu2~ppa5 seems to be working perfectly and properly saving settings.

Scott, thanks for your attention and time in debugging this issue.

Changed in gnome-power-manager (Ubuntu Karmic):
assignee: nobody → Canonical Desktop Team (canonical-desktop-team)
Revision history for this message
Oded Arbel (oded-geek) wrote :

2.27.5-0ubuntu2~ppa5 does store the settings properly, but it no longer actually suspends the laptop when the lid is closed. The current Karmic version has the settings dialog messed up but at least if gconf has /apps/gnome-power-manager/buttons/lid_battery set to "suspend" it would have suspended when the lid is closed, but with the PPA version it does not.

Revision history for this message
Oded Arbel (oded-geek) wrote :

NM - it does work. I think the problem was with the inhibit applet - once I removed it from the panel, it started sleeping again.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your work there

Changed in gnome-power-manager (Ubuntu Karmic):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-power-manager - 2.27.5-0ubuntu2

---------------
gnome-power-manager (2.27.5-0ubuntu2) karmic; urgency=low

  * debian/patches/22-git-change-fix-enum-64-issue.patch:
    - git change to fix a preference storing issue,
      thanks Scott Howard for getting and testing the change (lp: #407491)

 -- Sebastien Bacher <email address hidden> Thu, 13 Aug 2009 22:19:24 +0200

Changed in gnome-power-manager (Ubuntu Karmic):
status: Fix Committed → Fix Released
Changed in gnome-power:
importance: Unknown → Critical
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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