bit-team / backintime

Back In Time - An easy-to-use backup tool for GNU Linux using rsync in the back
https://backintime.readthedocs.io
GNU General Public License v2.0
2.01k stars 197 forks source link

Backintime disables screen power management #714

Open RRPollack opened 7 years ago

RRPollack commented 7 years ago

I've discovered that running Backintime causes my monitors to stay active despite the screen saver placing them in power-down mode.

Every morning I found my monitors fully powered up, although the displays were blank. This happened despite having verified that the screen saver had put them in their lowest power mode at the end of the day. Turning off the scheduled Backintime backup restores normal operation.

Kernel: Linux host 4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Distro: Linux Mint 18.1 Serena KDE Screen Saver: Default KDE or xscreensaver Video driver: radeon

An excerpt from the lspci output:

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Redwood XT [Radeon HD 5670/5690/5730]

Here's an excerpt from the syslog when backintime was running. I don't use Kwallet, thus the warnings re communcation with it.

Mar  7 01:00:01 host CRON[16746]: (user) CMD (/usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /usr/bin/backintime backup-job >/dev/null 2>&1)
Mar  7 01:00:01 host backintime (user/1): INFO: Lock
Mar  7 01:00:01 host backintime (user/1): INFO: Inhibit Suspend started. Reason: take snapshot
Mar  7 01:00:17 host backintime (user/1): INFO: mount ssh: user@server:./ on /home/user/.local/share/backintime/mnt/63C9878D/mountpoint
Mar  7 01:00:17 host backintime (user/1): INFO: Take a new snapshot. Profile: 1 Main profile
Mar  7 01:00:17 host org.kde.kwalletd[2461]: QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Mar  7 01:00:17 host org.kde.kwalletd[2461]: QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Mar  7 01:00:17 host org.kde.kwalletd[2461]: Checking for pam module
Mar  7 01:00:17 host org.kde.kwalletd[2461]: Lacking a socket, pipe: 0, env:0
Mar  7 01:00:17 host org.kde.kwalletd[2461]: kwalletd(16784): Communication problem with  "kwalletd" , it probably crashed.
Mar  7 01:00:17 host org.kde.kwalletd[2461]: Error message was:  "org.freedesktop.DBus.Error.NoReply" : " "Message recipient disconnected from message bus without replying" "
Mar  7 01:00:17 host org.kde.kwalletd[2461]: Checking for pam module
Mar  7 01:00:17 host org.kde.kwalletd[2461]: Lacking a socket, pipe: 0, env:0
Mar  7 01:00:17 host backintime (user/1): INFO: Compare with old snapshot: 20170306-010001-870
Mar  7 01:00:17 host backintime (user/1): INFO: [qt4systrayicon] begin loop
Mar  7 01:00:52 host backintime (user/1): INFO: Create hard-links
Mar  7 01:03:32 host backintime (user/1): INFO: Call rsync to take the snapshot
Mar  7 01:17:01 host CRON[17018]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Mar  7 01:17:09 host backintime (user/1): INFO: Save config file
Mar  7 01:17:09 host backintime (user/1): INFO: Save permissions
Mar  7 01:17:24 host backintime (user/1): INFO: Create info file
Mar  7 01:18:07 host backintime (user/1): INFO: Remove backups older than: 20070301-000000
Mar  7 01:18:07 host backintime (user/1): INFO: Keep min free disk space: 1024 MiB
Mar  7 01:18:07 host backintime (user/1): INFO: Keep min 2% free inodes
Mar  7 01:18:09 host backintime (user/1): INFO: unmount ssh: user@server:./ from /home/user/.local/share/backintime/mnt/63C9878D/mountpoint
Mar  7 01:18:09 host backintime (user/1): INFO: Unlock
Mar  7 01:18:09 host backintime (user/1): INFO: Release inhibit Suspend
Mar  7 01:18:10 host backintime (user/1): INFO: [qt4systrayicon] end loop
Germar commented 7 years ago

I guess this has something to do with inhibit suspend. Please disable the inhibit suspend function manually by running sudo nano /usr/share/backintime/common/tools.py and adding return like shown below (around line 790) and checkout if your screens still power up:

def inhibitSuspend( app_id = sys.argv[0],
                    toplevel_xid = None,
                    reason = 'take snapshot',
                    flags = INHIBIT_SUSPENDING | INHIBIT_IDLE):
    '''Prevent machine to go to suspend or hibernate.
    Returns the inhibit cookie which is used to end the inhibitor.
    '''
    return #<---------- add this here
    if not app_id:
        app_id = 'backintime'
    if not toplevel_xid:
        toplevel_xid = 0
thardeck commented 6 years ago

Thx for providing the workaround. Could this be done as an option in backintime?

Inhibiting suspend is great but many people do not have time based suspends but do not want there monitors to turn on all the time when a backup job runs.

Germar commented 6 years ago

Did the workaround fix the problem? I can't test it here because I don't have those problems.

Could you please undo the fix and remove | INHIBIT_IDLE three lines above instead and test again if the problem comes back?

thardeck commented 6 years ago

So the workaround works fine for me. I will test your suggestion and will report back.

thardeck commented 6 years ago

Removing INHIBIT_IDLE does not seem to fix the issue.

Germar commented 6 years ago

Okay. Thanks for testing

Gibbz commented 3 years ago

I'm having this issue on manjaro kde edition. I guess no fix for this yet?

RRPollack commented 3 years ago

Same problem with Kubuntu 18.04 using BIT 1.1.2, and now 20.04 with BIT 1.2.1.

As best I can see, this is a bug in a feature that 99% of users do not need. The last thing I need is some application blocking my system from suspending or hibernating when I want it to.

I used to use a company-issued Macbook. I closed the lid, expecting it to suspend as it was configured to do, and put it in my backpack. However, some unimportant application had blocked the suspension, which I didn't know about because the lid was closed. When I took it out of my backpack an hour or so later the thing was almost too hot to touch.

Please, please, please change BackInTime to not meddle in unrelated system behaviors like suspend and hibernate. If I wanted this kind of "we know better than you" behavior I'd use Apple crap instead of a Linux system.

buhtz commented 8 months ago

The Issues is quite old. It this still relevant and can be reproduced with the latest (1.4.1) or a more fresh (1.3.3) version of BIT?

aryoda commented 8 months ago

It this still relevant and can be reproduced with the latest (1.4.1) or a more fresh (1.3.3) version of BIT?

I am quite sure the behavior is the same in our latest version since the code is still in the backup function and dates back to Oct. 10, 2014 (last changed):

https://github.com/bit-team/backintime/blob/9618d03520b902635e8b647a0ec6efa45bd8929e/common/snapshots.py#L737-L738

I think this a feature request to

  1. add an option to configure the "Disable suspend while taking a snapshot"
  2. set a decent default (probably checked by default - which changes the current behavior which blocks a suspend)

A similar feature already exists in the options:

image

emtiu commented 8 months ago

1090 is a possible duplicate of this. It's one of my most-hated bugs in personal daily usage of BiT ;)

It's also very hard to debug, because it doesn't happen in virtual machines. You need actual silicon to test this, and I haven't managed to set that up.