LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 05-29-2017, 08:06 AM   #1
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
BLFS8: dbus, deciding if I want it or not


So in every distro I use multiple DEs/WMs but I end up with XFCE as a DE because it is comfy and I've made some nice themes for it.

I've got a laptop, so I like the computer to sleep when the lid is closed. In the past, I've needed to be in XFCE with dbus for that to work. dbus also seems to be needed to get the reboot and shutdown options on the menu when exiting XFCE.

In the BLFS book, I read a simple way to get the laptop to sleep on lid close, even when in the console. I've tried it and it works. Nice.

In view of that, I wonder if there are also ways to get reboot/shutdown from within XFCE without dbus. If so, I could run without dbus?

I forget if dbus is used for the battery power-level notices. That's also kind of important.

If I do put dbus in, will there be a conflict between the existing lid-close detection and however dbus & XFCE handle it?

p.s. currently not running xfce, running treewm because zero dependencies (aside from xorg itself).

Last edited by jr_bob_dobbs; 05-29-2017 at 08:17 AM.
 
Old 05-29-2017, 10:33 PM   #2
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Assuming that you're talking about PM-Utils, whether or not conflicts will exist will depend entirely on what actions are taken by the scripts in /usr/lib/pm-utils/sleep.d or anything that overrides it in /etc/pm/sleep.d.

If you want the full scope of functionality, you'll probably need several different things that are there to perform specific tasks, but are almost always installed together and are part of most Linux distribution bases. As far as I know, there is only group of tools that are currently maintained for these desktop-specific tasks: GLib, D-Bus, PolicyKit, UPower, ACPId, LM_Sensors, PCIUtils and their associated dependencies. You might also need USBUtils and UDisks if you want to sleep peripherals and/or have drives spin down when idle.

You could try looking at some embedded solutions, like BusyBox, etc. too see if they have anything to replace those. You may also get by with just pm-utils, glib and acpid but, I doubt they'll do everything you might want.

As for conflicts, most of these things take actions based on something that is configurable: scripts, run-levels, policies, units, etc. You'll need to dig into them to find out if the same action is being pushed from multiple sources. These things tend to be triggered by system-wide events and more than one thing can answer.

Last edited by Luridis; 05-29-2017 at 10:35 PM.
 
Old 05-31-2017, 11:52 AM   #3
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
I may have found your problem when I was going through some change logs for the current version of Mate Desktop.

UPower use to work with PM-Utils directly. A couple of years ago, UPower dropped PM-Utils support in favor of Systemd. While a lot of folks will jump to conclusions, I'm more inclined to believe that this was due to one or two primary issues. First, PM-Utils hasn't seen a commit in years and the scripts required root, suid or sudo entries to allow regular users access. DBus and PolicyKit changed that and that's where development went. Since then, ConsoleKit2 was introduced, and if I understand correctly, it will work with PM-Utils, sending requests through DBus.

So, that might be what you need: ConsoleKit2 to get pm-utils working the way you want, without Systemd.
 
Old 06-01-2017, 07:41 AM   #4
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
Yikes. I suppose this is my fault for not being more precise in my posting.

The method I use for sleep on lid-close, originally specified in the BLFS 8 book. Makde file called /etc/acpi/events/lid, edit it to look like this:
Code:
event=button/lid
action=/etc/acpi/lid.sh
Create a file named /etc/acpi/lid.sh, edit it to look like this:
Code:
#!/bin/sh
/bin/grep -q open /proc/acpi/button/lid/LID/state && exit 0
/usr/sbin/pm-suspend
and make it executable.

Oh, and have acpid started at boot time. That's also documented in the book and I will skip that detail for this post.

My original question, restated is, will any part of DBUS and/or XFCE conflict with the above lid-closing system? Again, as stated originally, I have not yet installed XFCE nor DBUS. The purpose of my question is to ascertain things before going ahead and perhaps creating a mess.
 
Old 06-01-2017, 10:30 AM   #5
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Okay, I understand now. The answer is, it could, but it may not. ACPId + PM-Utils makes this a daemon-to-kernel chain of events. The command isn't coming from a user so privilege isn't the problem. However, notification may be as there may be daemons, open files, mount points, etc. that need to be cleaned up before or after pm-suspend.

Here is my suggestion: Download a distro that still uses pm-utils, but also has acpid, xfce and dbus available from package managers or is preinstalled. Slackware comes to mind, as does Debian. Install the distro on a virtual machine, along with dbus and xfce and then take a look at the /etc/acpi/lid.sh file and see what's in it. If you see something that looks like this:
Code:
#!/bin/sh

if grep -q open /proc/acpi/button/lid/LID/state
    dbus-send blah blah blah
fi

/usr/sbin/pm-suspend
Then you know something is needed before suspend takes place. There might even be a setup that sleeps the script and waits for a reply from dbus. I know that some profile-based wifi utilities won't reconnect properly if not notified before or after the suspend. A desktop widget that automounts usb drives could corrupt files if not cleanly unmounted before suspend, etc. The bottom line is to look for a setup similar to yours and see how people before you have set it up.
 
Old 06-09-2017, 07:48 AM   #6
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
OK: was finally able to check my old Slackware partition. There is no lid.sh, however, the /etc/acpi/events directory has a "default" file that just calls one generic script for *any* event. That script in turns ignores everything but a button-press to turn the machine off. So no conflict?

Maybe I should just, after a backup, install dbus & XFCE and see what heppens?

I probably don't want to know ... but...
Quote:
still uses pm-utils
"still" implies approaching obsolescence? What else would one use?

Last edited by jr_bob_dobbs; 06-09-2017 at 07:50 AM.
 
Old 06-11-2017, 03:29 AM   #7
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Whether or not it is in conflict depends on whether or not something needs to be notified before the machine goes into suspend. That's where dbus would come in.

What I do know: pm-utils is depreciated and people have reported that it doesn't work with current versions of UPower. There doesn't appear to have been significant work on it in more than 7 years. However, there is a branch version maintained by Gentoo that maintains it for use with more recent versions of UPower. Have a look at their ebuild respository, there are patches and configuration files in there that may help you work out what you need.
 
Old 06-11-2017, 03:58 AM   #8
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Here's another notice about this, found in a google search.

Quote:
Title: UPower loses hibernate / suspend to systemd
Author: Samuli Suominen <------------->
Content-Type: text/plain
Posted: 2014-06-03
Revision: 1
News-Item-Format: 1.0
Display-If-Installed: <sys-power/upower-0.99.0

UPower discontinued hibernate and suspend support in favor of systemd.
Because of this, we have created a compability package at
sys-power/upower-pm-utils which will give you the old UPower with
sys-power/pm-utils support back.
Some desktops have integrated the sys-power/pm-utils support directly
to their code, like Xfce, and as a result, they work also with the new
UPower as expected.
Note the bit about Xfce integrating the functionality. That may be why your Xfce still works and the command line no longer does. For the shell, you can either use their adaptations to pm-utils or probably use acpid to call a script that tells dbus to suspend the machine. You'll probably have to put a policy in to allow non-root to do so.

Last edited by Luridis; 06-11-2017 at 04:02 AM.
 
Old 06-12-2017, 01:57 PM   #9
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
Wow: thank you for all of the info.
 
Old 06-12-2017, 11:47 PM   #10
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
After looking at these a bit more, I have a better understanding now. Things change over time and we don't always pay attention to how or why when that's happening.

The older tools, used primarily before all the recent Linux plumbing work over the last decade...

ACPId: Monitored the system for power-related events and launched scripts.

PM-Utils: Provides the commands that make the system-calls that react to power events. More importantly, pm-utils provided event hooks for scripts that happened before or after power events. These were in the form of /usr/lib/pm-utils/{sleep.d, hibernate.d, shutdown.d, etc.} These would run scripts that did things like sleep wifi devices, disconnect usb or remote volumes. Some even send syscalls to clear certain kinds of memory on computers with shared ram, etc. In conclusion, writing a script that just tells the kernel to hibernate may not be sufficient and may corrupt files or even lock up the machine when it wakes.

Laptop Mode Tools: Added functionality for mobile PCs, spooling down hard drives, changing CPU power mode and shutting off backlights based on profiles, timers, etc.

...Then came the 2.6.32 kernel, Udev, DBus, PolicyKit, Systemd & UPower.

Udev: Monitors all kinds of system events, not just ACPI events. ACPId can still be used, but it is sort of redundant.

DBus: Allows udev to announce events system wide. Can be used in place of scripts in pm-utils to react to events.

PolKit: Allows non-root users to take root actions without using SUID, sudo, su, etc. Communicates through dbus.

Systemd: Everyone knows what it is, but one of the things it can do is react to power events (or any other type) like pm-utils. Event wants target, etc.

UPower: Monitors things like power usage, battery levels, charging rates, etc. Unlike ACPId or Udev, it's an ongoing thing and probably replaced some of what laptop mode tools used be for. It use to run scripts through pm-utils, but that was depreciated for systemd, probably do to lack of features or ongoing development.


What to use? Depends on what you're doing. If you're running SysV-Init, you can get events through ACPId or Eudev. PM-Utils is likely your best option for hooks, but the upstream won't work with UPower anymore. I don't know how well laptop mode tools is maintained, but UPower has forks for PM-Utils. ConsoleKit2 or eLogind can likely be used to hook in GUI shutdown requests with pm-utils, but dbus may be required for some things to work like UPower showing battery remaining in the GUI.

If you're running Systemd you can skip PM-Utils. Additionally, Udev, PolKit, DBus and UPower work natively with it. That said, nothing prevents you from using ACPId and other old utilities if you prefer them. Some things in Systemd, like networkd are very basic, but I don't think event handling is one of them.

Anyway... That's what I see on closer examination, but I could have misunderstood something if I'm incorrect on any of those points.

Last edited by Luridis; 06-12-2017 at 11:55 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
blfs8: first xorg package: possible failure jr_bob_dobbs Linux From Scratch 7 05-24-2017 10:19 PM
Dbus error org.freedesktop.DBus.Error.NoReply whilie replying for file descriptor canitha Linux - Newbie 1 05-10-2017 07:36 AM
[SOLVED] using jack2-dbus, jack_control start gives error: DBus exception: org.jackaudio.Error Laertiades Linux - Newbie 7 05-10-2014 05:10 PM
dbus "rm /var/run/dbus/Desktop can't remove..." longus Slackware 6 12-15-2008 03:33 AM
Fedora Core 9 update dbus.exception & dbus.proxies & DBus.Error.AccessDenied errors trien27 Fedora 1 12-08-2008 11:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 03:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration