You are not logged in.

#1 2017-04-30 02:47:18

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,226
Website

bl-exit

Apart from the discussion we had a while ago about theming, bl-exit appeared again in the context of systemd: https://forums.bunsenlabs.org/viewtopic.php?id=3632

While bl-exit as it now is, is init-agnostic ie it still works on systems that are not started up by systemd, it nevertheless needs systemd to be installed. One of our goals for BunsenLabs is to make it as portable as possible, so that our packages should work on most Debian-based systems without requiring major (or any) changes.
(Another is modularity - trying to keep inter-dependencies between our packages to a minimum, so users can cherry-pick the ones they want without dragging in the whole system.)

o9000 wrote:

Why not just create a group for the graphical users, then edit /etc/sudoers to allow the group to execute /sbin/halt, /sbin/reboot, /sbin/poweroff with sudo without password? Are those commands no longer working under systemd?

I was wondering this exact same thing (using shutdown)...

Head_on_a_Stick wrote:

Those commands are symlinks to /bin/systemctl and can be used without root privileges under systemd.

o9000 wrote:

Then for any other init system, one could add them to sudoers and they would work just the same.

So... that sounds as if the user switching to eg runit-init would still have to make some system changes to get bl-exit to work.

Does this mean that there are no poweroff/reboot commands which can be made to work for normal users on any Debian system? Would the  bl-exit package be required to edit /etc/sudoers in a maintainer script?

Meanwhile, what about suspend and hybernate?

These are all pretty basic functions which any user needs to work.

Any ideas, comments...?


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#2 2017-04-30 03:30:48

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,273

Re: bl-exit

Does this help?

Debian Wiki: Uswsusp = Suspend - Hibernate

For the rest: I've always thought the user needed to add themselves to the sudoers file.

Last edited by Sector11 (2017-04-30 03:33:50)


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#3 2017-04-30 03:35:50

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,273

Re: bl-exit

Here something else that might help.


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#4 2017-04-30 05:31:45

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,226
Website

Re: bl-exit

@Sector11 thanks for those two links.

Sector11 wrote:

I've always thought the user needed to add themselves to the sudoers file.

Not since quite a while, as long as you've got the right stuff installed.

On #! it was done, first via dbus>hal, then dbus>consolekit, neither of which needed users to be registered in /etc/sudoers as long as permissions were set up right (same thing in a way, except you don't need to use sudo). (hal and consolekit are now obsolete AFAIK.)

With systemd normal users can shutdown with 'systemctl poweroff' which is what bl-exit used at first. Those systemctl calls were replaced with dbus>freedesktop.login1 which still works for normal users, but needs systemd-logind from systemd.

cpoakes wrote:

The python script bl-exit, uses dbus and the org.freedesktop.login1 service to manage suspending, rebooting, and exiting a BL session. This service is provided by the systemd-logind daemon of the systemd package. This BL feature only works on a sysvinit system if you install systemd and the systemd-shim to get systemd-logind.

---

Systemd subsumed the udev and logind projects, making systemd-logind the only Debian source of the init-agnostic org.freedesktop.login1 service (irony noted). The systemd-shim was developed to re-enable independent operation of systemd-logind and this service (among others). 

While bl-exit could implement power management without logind it would require:
1) selecting commands specific to each init system (irony also noted), and
2) loss of logind features restricting how power management is handled by non-root users.
Using systemd-logind (natively or via the shim) to source the org.freedesktop.login1 service remains the best compromise.

When and if other logind replacements are implemented, bl-exit should just work (or at most need an alias to an alternate service name). But until then, bunsen-utilities is missing systemd as a dependency.

"selecting commands specific to each init system" would probably be doable, though sounds a bit clunky. The native systemctl commands are very neat and attractive, though.

I think, if we keep the current system calls (pity shutdown turns out to be systemctl in disguise) and the resultant dependency on systemd, then at least bl-exit ought to be split off into its own package so that the rest of bunsen-utilities can be installed without systemd.

Another route: a separate bl-exit package for non-systemd systems? Or an optional plug-in module of some kind?


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#5 2017-04-30 06:40:09

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,226
Website

Re: bl-exit

Quick thought:
1) In bl-exit use the calls to the generic commands /sbin/shutdown & friends, which in BL are provided by systemd-sysv.
2) Set dependencies to 'Depends: systemd-sysv|sysvinit-core|runit-init|(any other init packages in Debian which provide those commands)'.

Might that not be a fairly neat way of effectively switching the shutdown commands without actually changing anything in bl-exit itself?

That still would leave suspend and hybernate though...

...and the sudoers problem for other inits except systemd-sysv. How would a package maintainer script know what users to write in to /etc/sudoers?


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#6 2017-04-30 07:18:52

ohnonot
...again
Registered: 2015-09-29
Posts: 3,668
Website

Re: bl-exit

isn't it possible for python to query the system for which init is running, and choose a suitable command according to that? without pulling in any dependencies?

though i would prefer the generic command method.
fwiw, these generic commands exist on my archlinux system:

$> ll /usr/bin/shutdown
lrwxrwxrwx 1 root root 9 Jan 29 00:32 /usr/bin/shutdown -> systemctl*
$> ll /usr/bin/poweroff
lrwxrwxrwx 1 root root 9 Jan 29 00:32 /usr/bin/poweroff -> systemctl*
$> ll /usr/bin/halt
lrwxrwxrwx 1 root root 9 Jan 29 00:32 /usr/bin/halt -> systemctl*
$> ll /usr/bin/reboot
lrwxrwxrwx 1 root root 9 Jan 29 00:32 /usr/bin/reboot -> systemctl*
$> ll /usr/bin/hibernate
ls: cannot access '/usr/bin/hibernate': No such file or directory

Offline

#7 2017-04-30 12:35:49

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: bl-exit

johnraff wrote:

So... that sounds as if the user switching to eg runit-init would still have to make some system changes to get bl-exit to work.

Does this mean that there are no poweroff/reboot commands which can be made to work for normal users on any Debian system? Would the  bl-exit package be required to edit /etc/sudoers in a maintainer script?

I had to add /sbin/reboot & /sbin/poweroff to /etc/sudoers when I used runit-init:

https://forums.bunsenlabs.org/viewtopic.php?id=3441

I haven't tried sysvinit though.

I would actually suggest leaving the bl-exit script as it is, changing PID1 is something only competent users would attempt and they probably don't need (or want) our help.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#8 2017-04-30 18:14:58

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,273

Re: bl-exit

@johnraff - you're welcome, I went searching after reading your OP.  It's not that I knew that. 

Head_on_a_Stick wrote:

I would actually suggest leaving the bl-exit script as it is, changing PID1 is something only competent users would attempt and they probably don't need (or want) our help.

I agree with this for two reasons:

  1. we build for BunsenLabs, if it works in another distro; a bonus, if not - let them tweak it, and

  2. there are 1001 ways of doing things in Linux, we have one way that is a nice looking exit script that works OOTB!

We're building for Bunsen, not "all other distros", if it works in Bunsen we have achieved our goal.

"competent users" will know how to make changes, or at least know where to research for answers if they want to change things.


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#9 2017-04-30 18:20:12

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,273

Re: bl-exit

aptitude search init = runit-init not in repos.

Did I miss something?


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#10 2017-04-30 18:22:15

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: bl-exit

Sector11 wrote:

Did I miss something?

It's only in testing/unstable at the moment wink

https://packages.debian.org/search?keyw … ection=all


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#11 2017-05-01 00:39:34

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,273

Re: bl-exit

ops OOPS! {sigh} just like me too!

Last edited by Sector11 (2017-05-01 01:02:07)


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#12 2017-05-01 03:37:48

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,226
Website

Re: bl-exit

Head_on_a_Stick wrote:

I would actually suggest leaving the bl-exit script as it is, changing PID1 is something only competent users would attempt and they probably don't need (or want) our help.

To be honest, that's my view too. Back (in 2015!) when we were discussing init-agnostic shutdown commands on the #! forums, I was initially for keeping the systemctl commands because they're simple and neat - and easy to spot and replace. We finally used cpoakes' contribution of code which worked both with the default systemd init and with other inits provided systemd and systemd-shim were installed.

Since it works for us, and makes things somewhat easier for those changing init, let's keep it and worry about something else...

Meanwhile, I'd like to propose making bunsen-exit a separate package in BunsenLabs Helium. This should make dependencies easier for users, and make subsequent tweaking easier for developers.


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#13 2017-05-01 04:12:23

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,273

Re: bl-exit

Well, I'd welcome that.


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#14 2017-05-01 06:17:01

damo
....moderator....
Registered: 2015-08-20
Posts: 4,876

Re: bl-exit

johnraff wrote:

....
Since it works for us, and makes things somewhat easier for those changing init, let's keep it and worry about something else...

Meanwhile, I'd like to propose making bunsen-exit a separate package in BunsenLabs Helium. This should make dependencies easier for users, and make subsequent tweaking easier for developers.

I would go along with that.


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#15 2017-05-02 06:58:55

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: bl-exit

Implementing bl-exit using sudo enabled versions of shutdown, poweroff, reboot, pm-suspend, pm-hibernate, or other init-specific commands enables a remotely logged in user running an Xsession to poweroff/reboot/suspend the system. This is a use case logind goes to great lengths to avoid. Logind ensures these functions are only available to a local user when no other users are logged in. While the single-user local system is the most common scenario, this could be bad news for true multiuser systems.

Offline

#16 2017-05-02 13:34:23

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,273

Re: bl-exit

I did not know that.   Interesting.

I fall into the "single-user local system scenario"


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#17 2017-05-06 03:30:50

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,226
Website

Re: bl-exit

cpoakes wrote:

Logind ensures these functions are only available to a local user when no other users are logged in.

I don't feel like enabling ssh access to my main machine atm, so testing of remote user shutdowns will have to be postponed, but it was easy to open a fresh tty: and login as a new user:

'systemctl poweroff' brought up a warning that "john" was still logged in, but helpfully suggested the '-i' option. Sure enough 'systemctl poweroff -i' turned off the machine with another user logged in.

'bl-exit -p' failed with error message of logout not being an attribute... (sorry, cannot copy/paste from a tty - but bl-exit should work without X, so that's a separate issue).

Run 'startx', open a terminal emulator window, and 'bl-exit -b' causes an immediate reboot, no warnings about "john" being logged in. bl-exit is using logind I think.


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#18 2017-05-06 07:10:19

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: bl-exit

@johnraff - Glad you're testing it. I only know the theoretical justification for including the functions to power off, reboot, and suspend in logind in the first place.

Offline

#19 2017-05-21 03:37:49

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: bl-exit

Whatever you do, please keep the script so that it can be modded by users to lock the system when suspending if desired.  I use xscreensaver and mod bl-exit to call bl-lock when suspending.

Last edited by KrunchTime (2017-05-21 03:40:26)

Offline

#20 2017-05-21 10:37:42

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: bl-exit

KrunchTime wrote:

please keep the script so that it can be modded by users

All of the bl-* scripts will always be user-modifiable smile

The general technique is to copy the script to ~/bin/ and edit that file, it will always be run in preference to the installed version.

For example:

cp /usr/bin/bl-exit ~/bin && bl-editor ~/bin/bl-exit

This will apply on a per-user basis, for system-wide usage copy the file to /usr/local/bin/ instead.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#21 2017-05-23 08:10:01

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: bl-exit

^ Perhaps I worded my response incorrectly.  What I meant was I want to be able to easily use xscreensaver on my system and call bl-lock from bl-exit so that I have to login using xscreensaver.  I used the default technique briefly this week when rebuilding my desktop and I despise the technique; no offense (hopefully) to the developers.

The problem with copying the script to ~/bin is when scripts drastically change, as has happened with the bl-exit, and maybe the bl-lock, script.  That technique was suggested once before to me by johnraff, but I kind of glossed over it and decided to be a glutton for punishment and change the bl-exit and bl-lock scripts every time bl-utilities is updated.  I'll give the copying the scripts to ~/bin since you've brought it up again and see how it goes.

As always, thank you for chiming in.  I frequently learn from you when you chime in.   wink

Last edited by KrunchTime (2017-05-23 08:12:04)

Offline

#22 2017-05-25 11:12:51

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: bl-exit

KrunchTime wrote:

Whatever you do, please keep the script so that it can be modded by users to lock the system when suspending if desired.  I use xscreensaver and mod bl-exit to call bl-lock when suspending.

May I ask, just for my understanding, is it about locking the screen before suspend? I'm just wondering why to choose this way, hence there is a password requirement after waking up from suspend (at least as far as I can remember).

Offline

#23 2017-11-12 14:29:00

thierrybo
Member
Registered: 2017-11-12
Posts: 10

Re: bl-exit

Hi,

why not use obsession package in bunsenlabs? Here manually run :

https://www.youtube.com/watch?v=lnxTht1 … e=youtu.be

or merged in menu.xml :

        <item label="Exit">
            <action name="Execute">
                <command>
                    <!-- bl-exit -->
                    obsession-logout
                </command>
            </action>
        </item>

https://www.youtube.com/watch?v=U48SA4D … e=youtu.be

Last edited by thierrybo (2017-11-12 14:38:30)

Offline

#24 2017-11-12 21:59:02

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: bl-exit

^ Hi!

thierrybo wrote:

why not use obsession package in bunsenlabs?

First of all: what a lovely package, thanks for the heads-up, I am now using that in my live image smile

However, /usr/bin/obsession-logout is a binary executable whereas bl-exit is a (python) script and I personally think that the latter is better suited to BunsenLabs because it is easier for users to hack around and change.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#25 2017-11-12 22:48:59

thierrybo
Member
Registered: 2017-11-12
Posts: 10

Re: bl-exit

I see your point. But it can be an easy workaround for non systemd users like me !

Offline

Board footer

Powered by FluxBB