Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Poweroff & reboot under openrc-init via GUI, how to?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Universebenzene
n00b
n00b


Joined: 14 Jul 2019
Posts: 9

PostPosted: Tue Aug 13, 2019 12:24 pm    Post subject: Poweroff & reboot under openrc-init via GUI, how to? Reply with quote

Recently I just tried using openrc-init instead of init provide by sysvinit, and it works almost fine. Also as we know the shutdown command is replaced by openrc-shutdown, and this works OK as well.

However if I want to shutdown or reboot graphically, for example, by pressing the buttons provide by gdm and lightdm, it just do nothing - until I launch the terminal and type openrc-shutdown commands.

Also, the loginctl reboot & loginctl poweroff commands can't work - by which we don't need to switch to the root user or using sudo to execute under sysvinit.

So, is there any way to shutdown or reboot via GUI or using loginctl under openrc-init? Or did I miss some configuration?

Thanks :)
_________________
—— I can do nothing but behave like a clown.
Back to top
View user's profile Send private message
GDH-gentoo
n00b
n00b


Joined: 20 Jul 2019
Posts: 40
Location: South America

PostPosted: Tue Aug 13, 2019 3:15 pm    Post subject: Reply with quote

I think the elogind daemon needs executable files named poweroff, reboot and halt that it can find via PATH search. Normally, those would be sysvinit's programs in /sbin. You'd need scripts with those names that call openrc-shutdown with suitable options and arguments. The thing is, you can't replace the /sbin programs, because OpenRC is declared in its ebuild to depend on sysvinit. But even if you could, I wouldn't recommend it, because you woldn't be able to switch to a supported init system if you need to.

I suppose one could try to put such scripts in a directory that comes before /sbin in elogind's PATH, and find a way to launch the daemon with a custom PATH. /lib/rc/bin might work if elogind is launched by OpenRC, as it normally is.

I have neither elogind, nor GDM, nor LightDM to test any of this, though. And I should give you the usual warning about being careful when messing with an init system. If it breaks, you get to keep the pieces :P
Back to top
View user's profile Send private message
Universebenzene
n00b
n00b


Joined: 14 Jul 2019
Posts: 9

PostPosted: Tue Aug 13, 2019 3:35 pm    Post subject: Reply with quote

GDH-gentoo wrote:
I think the elogind daemon needs executable files named poweroff, reboot and halt that it can find via PATH search.


Well thanks for your suggestion :) . I might need to read the documentation fo elogind
_________________
—— I can do nothing but behave like a clown.
Back to top
View user's profile Send private message
GDH-gentoo
n00b
n00b


Joined: 20 Jul 2019
Posts: 40
Location: South America

PostPosted: Wed Aug 14, 2019 2:02 am    Post subject: Reply with quote

On a closer look, it is elogind's build system that searches for halt, poweroff and reboot. From the build log:

Code:
meson --buildtype plain --libdir lib64 --localstatedir /var/lib --prefix /usr --sysconfdir /etc --wrap-mode nodownload -Ddocdir=/usr/share/doc/elogind-241.3 -Dhtmldir=/usr/share/doc/elogind-241.3/html -Dpamlibdir=/lib64/security -Dudevrulesdir=/lib/udev/rules.d --libdir=/usr/lib64 -Drootlibdir=/lib64 -Drootlibexecdir=/lib64/elogind -Drootprefix=/ -Dbashcompletiondir=/usr/share/bash-completion/completions -Dman=auto -Dsmack=true -Dcgroup-controller=openrc -Ddefault-hierarchy=legacy -Ddefault-kill-user-processes=false -Dacl=true --buildtype release -Dhtml=false -Dpam=true -Dselinux=false -Dutmp=true /var/tmp/portage/sys-auth/elogind-241.3/work/elogind-241.3 /var/tmp/portage/sys-auth/elogind-241.3/work/elogind-241.3-build
The Meson build system
...
Program halt found: YES (/sbin/halt)
...
Program poweroff found: YES (/sbin/poweroff)
Program reboot found: YES (/sbin/reboot)

Code:
$ grep -E '(halt|poweroff|reboot)' config.h
#define HALT "/sbin/halt"
#define POWEROFF "/sbin/poweroff"
#define REBOOT "/sbin/reboot"

Those would be sysvinit's. It is possible to specify other programs by passing -Dhalt-path, -Dpoweroff-path or -Dreboot-path options to meson, e.g. -Dpoweroff-path=/pathname/of/script-that-calls-openrc-shutdown:
Code:
$ meson configure .
...
  Option         Current Value Possible Values  Description
...
  halt-path                                     path to halt
...
  poweroff-path                                 path to poweroff
  reboot-path                                   path to reboot

However, I'm not sure if elogind's ebuild or the meson eclass support some way of passing extra options, like EXTRA_ECONF does for GNU-style build systems. You might have to copy the ebuild to a local repository and edit it to add the options.
Back to top
View user's profile Send private message
Universebenzene
n00b
n00b


Joined: 14 Jul 2019
Posts: 9

PostPosted: Wed Aug 14, 2019 3:59 am    Post subject: Reply with quote

GDH-gentoo wrote:
However, I'm not sure if elogind's ebuild or the meson eclass support some way of passing extra options, like EXTRA_ECONF does for GNU-style build systems. You might have to copy the ebuild to a local repository and edit it to add the options.


Yeah, I also found this build option. Maybe I had to patch the ebuild myself...
_________________
—— I can do nothing but behave like a clown.
Back to top
View user's profile Send private message
Universebenzene
n00b
n00b


Joined: 14 Jul 2019
Posts: 9

PostPosted: Wed Aug 14, 2019 2:16 pm    Post subject: Reply with quote

GDH-gentoo wrote:
It is possible to specify other programs by passing -Dhalt-path, -Dpoweroff-path or -Dreboot-path options to meson

Well finally I add the -Dhalt-path, -Dpoweroff-path and -Dreboot-path options to the ebuild, and also with tiny poweroff & reboot scripts included. Full scripts here: https://github.com/Universebenzene/benzene-overlay/tree/master/sys-auth/elogind

Now everything goes fine. Thanks for your help! :D
_________________
—— I can do nothing but behave like a clown.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum