Created attachment 5065 Add shutdown/reboot functionality for systemd In a consolekit-free environment PowerOff stopped working. Patch atttached implements required functionality.
Created attachment 5118 support shutdown/reboot through logind Your patch unnecessarily couples ENABLE_POLKIT with systemd support, users may want polkit support without systemd. Also systemd usage should be detected at runtime with ConsoleKit as a fallback rather than hardcoding at compile time so that distros can build with systemd support but still allow booting without systemd. Finally there are some typos in src/xfpm-systemd.h. Attached path fixes all of the above.
Hi Nick, can you comment on this bug (as well as bug #9335 and bug #9963, and maybe also the relevant bugs for xfce4-session?).
Andreas, it seems that the patch on https://build.opensuse.org/package/view_file/X11:xfce/xfce4-power-manager/xfce4-power-manager-systemd-shutdown-reboot-support.patch?expand=1 is still the original version, could you comment on the updated patch by Guido? (I'm trying to determine what should I import into Debian to have some slight systemd support in xfpm). Thanks in advance!
Without having tested Guido's patch (still using mine): I think it is much more flexible and we should use that.
(In reply to Guido Berhoerster from comment #1) > Created attachment 5118 > support shutdown/reboot through logind > > Your patch unnecessarily couples ENABLE_POLKIT with systemd support, users > may want polkit support without systemd. Also systemd usage should be > detected at runtime with ConsoleKit as a fallback rather than hardcoding at > compile time so that distros can build with systemd support but still allow > booting without systemd. Finally there are some typos in src/xfpm-systemd.h. > Attached path fixes all of the above. Actually, it seems that xfpm-systemd.h is completely missing from that patch.
Created attachment 5201 Add shutdown/reboot functionality for systemd (In reply to Yves-Alexis Perez from comment #5) > (In reply to Guido Berhoerster from comment #1) > > Created attachment 5118 > > support shutdown/reboot through logind > > > > Your patch unnecessarily couples ENABLE_POLKIT with systemd support, users > > may want polkit support without systemd. Also systemd usage should be > > detected at runtime with ConsoleKit as a fallback rather than hardcoding at > > compile time so that distros can build with systemd support but still allow > > booting without systemd. Finally there are some typos in src/xfpm-systemd.h. > > Attached path fixes all of the above. > > Actually, it seems that xfpm-systemd.h is completely missing from that patch. Stupid git, here is the version of the patch that the openSUSE package uses (with the leftover comments on top removed), sorry for the confusion.
It seems I need to add: +AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$systemd" = "xyes"]) to configure.ac[.in] (I patch 1.2.0 tarball) Also, it doesn't seem to build here: xfce4_power_manager-xfpm-manager.o: In function `xfpm_manager_shutdown': /tmp/buildd/xfce4-power-manager-1.2.0/src/xfpm-manager.c:218: undefined reference to `xfpm_systemd_shutdown' xfce4_power_manager-xfpm-manager.o: In function `xfpm_manager_start': /tmp/buildd/xfce4-power-manager-1.2.0/src/xfpm-manager.c:545: undefined reference to `xfpm_systemd_new' xfce4_power_manager-xfpm-power.o: In function `xfpm_power_dbus_reboot': /tmp/buildd/xfce4-power-manager-1.2.0/src/xfpm-power.c:1753: undefined reference to `xfpm_systemd_reboot' xfce4_power_manager-xfpm-power.o: In function `xfpm_power_dbus_shutdown': /tmp/buildd/xfce4-power-manager-1.2.0/src/xfpm-power.c:1720: undefined reference to `xfpm_systemd_shutdown' xfce4_power_manager-xfpm-power.o: In function `xfpm_power_init': /tmp/buildd/xfce4-power-manager-1.2.0/src/xfpm-power.c:1399: undefined reference to `xfpm_systemd_new' collect2: error: ld returned 1 exit status maybe because of --as-needed (will redo a build with verbose rules).
Here's the link command: libtool: link: gcc -I.. -I../common -I../libdbus -DLOCALEDIR=\"/usr/share/locale\" -DG_LOG_DOMAIN=\"xfce4-power-manager\" -DSYSCONFDIR=\"/etc\" -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/xfce4/libxfce4ui-1 -I/usr/include/gtk-2.0 -I/usr/include/xfce4 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/libdrm -I/usr/include/harfbuzz -I/usr/include/xfce4/xfconf-0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libpng12 -pthread -I/usr/include/polkit-1 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIE -pie -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-z -Wl,defs -Wl,--as-needed -Wl,-O1 -o xfce4-power-manager xfce4_power_manager-xfpm-enum-types.o xfce4_power_manager-xfpm-marshal.o xfce4_power_manager-xfpm-main.o xfce4_power_manager-xfpm-manager.o xfce4_power_manager-xfpm-power.o xfce4_power_manager-xfpm-power-common.o xfce4_power_manager-xfpm-battery.o xfce4_power_manager-xfpm-xfconf.o xfce4_power_manager-xfpm-disks.o xfce4_power_manager-xfpm-console-kit.o xfce4_power_manager-egg-idletime.o xfce4_power_manager-xfpm-backlight.o xfce4_power_manager-xfpm-dpms.o xfce4_power_manager-xfpm-button.o xfce4_power_manager-xfpm-network-manager.o xfce4_power_manager-xfpm-inhibit.o xfce4_power_manager-xfpm-notify.o xfce4_power_manager-xfpm-polkit.o xfce4_power_manager-xfpm-errors.o -pthread ../common/.libs/libxfpmcommon.a ../libdbus/.libs/libxfpmdbus.a -lgthread-2.0 -lxfce4ui-1 -lgtk-x11-2.0 -lxfce4util -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lpangocairo-1.0 /usr/lib/x86_64-linux-gnu/libcairo.so -lpango-1.0 -lfontconfig /usr/lib/x86_64-linux-gnu/libfreetype.so -lxfconf-0 -ldbus-glib-1 -ldbus-1 -lnotify -lgdk_pixbuf-2.0 -lpolkit-gobject-1 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lXrandr -lXext -lX11 -lm -pthread
(In reply to Yves-Alexis Perez from comment #8) > Here's the link command: > > libtool: link: gcc -I.. -I../common -I../libdbus > -DLOCALEDIR=\"/usr/share/locale\" -DG_LOG_DOMAIN=\"xfce4-power-manager\" > -DSYSCONFDIR=\"/etc\" -I/usr/include/glib-2.0 > -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread > -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include > -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include > -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include > -pthread -I/usr/include/xfce4/libxfce4ui-1 -I/usr/include/gtk-2.0 > -I/usr/include/xfce4 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include > -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 > -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ > -I/usr/include/freetype2 -I/usr/include/glib-2.0 > -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 > -I/usr/include/libpng12 -I/usr/include/libdrm -I/usr/include/harfbuzz > -I/usr/include/xfce4/xfconf-0 -I/usr/include/dbus-1.0 > -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 > -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread > -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 > -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libpng12 > -pthread -I/usr/include/polkit-1 -I/usr/include/glib-2.0 > -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2 -fPIE -fstack-protector > --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIE -pie -Wl,-z > -Wl,relro -Wl,-z -Wl,now -Wl,-z -Wl,defs -Wl,--as-needed -Wl,-O1 -o > xfce4-power-manager xfce4_power_manager-xfpm-enum-types.o > xfce4_power_manager-xfpm-marshal.o xfce4_power_manager-xfpm-main.o > xfce4_power_manager-xfpm-manager.o xfce4_power_manager-xfpm-power.o > xfce4_power_manager-xfpm-power-common.o xfce4_power_manager-xfpm-battery.o > xfce4_power_manager-xfpm-xfconf.o xfce4_power_manager-xfpm-disks.o > xfce4_power_manager-xfpm-console-kit.o xfce4_power_manager-egg-idletime.o > xfce4_power_manager-xfpm-backlight.o xfce4_power_manager-xfpm-dpms.o > xfce4_power_manager-xfpm-button.o xfce4_power_manager-xfpm-network-manager.o > xfce4_power_manager-xfpm-inhibit.o xfce4_power_manager-xfpm-notify.o > xfce4_power_manager-xfpm-polkit.o xfce4_power_manager-xfpm-errors.o -pthread > ../common/.libs/libxfpmcommon.a ../libdbus/.libs/libxfpmdbus.a -lgthread-2.0 > -lxfce4ui-1 -lgtk-x11-2.0 -lxfce4util -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 > -lpangocairo-1.0 /usr/lib/x86_64-linux-gnu/libcairo.so -lpango-1.0 > -lfontconfig /usr/lib/x86_64-linux-gnu/libfreetype.so -lxfconf-0 > -ldbus-glib-1 -ldbus-1 -lnotify -lgdk_pixbuf-2.0 -lpolkit-gobject-1 > -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lXrandr -lXext -lX11 -lm -pthread I don't see xfce4_power_manager-xfpm-systemd.o, have you run xdt-autogen before building since the Makefile.am has been modified?
(In reply to Guido Berhoerster from comment #9)> > I don't see xfce4_power_manager-xfpm-systemd.o, have you run xdt-autogen > before building since the Makefile.am has been modified? Yes (I can provide a complete build log if needed)
(In reply to Yves-Alexis Perez from comment #10) > (In reply to Guido Berhoerster from comment #9)> > > I don't see xfce4_power_manager-xfpm-systemd.o, have you run xdt-autogen > > before building since the Makefile.am has been modified? > > Yes (I can provide a complete build log if needed) Yes, that might help. You can also take a look and compare with our build log at https://build.opensuse.org/package/rawlog/X11:xfce/xfce4-power-manager/openSUSE_Factory/x86_64
Created attachment 5202 xfpm build log (In reply to Guido Berhoerster from comment #11) > (In reply to Yves-Alexis Perez from comment #10) > > (In reply to Guido Berhoerster from comment #9)> > > > I don't see xfce4_power_manager-xfpm-systemd.o, have you run xdt-autogen > > > before building since the Makefile.am has been modified? > > > > Yes (I can provide a complete build log if needed) > > Yes, that might help. You can also take a look and compare with our build > log at > https://build.opensuse.org/package/rawlog/X11:xfce/xfce4-power-manager/ > openSUSE_Factory/x86_64 Actually I can't (it requires a username).
(In reply to Yves-Alexis Perez from comment #12) > Created attachment 5202 > xfpm build log > > (In reply to Guido Berhoerster from comment #11) > > (In reply to Yves-Alexis Perez from comment #10) > > > (In reply to Guido Berhoerster from comment #9)> > > > > I don't see xfce4_power_manager-xfpm-systemd.o, have you run xdt-autogen > > > > before building since the Makefile.am has been modified? > > > > > > Yes (I can provide a complete build log if needed) So the configure check works, SYSTEMD_CFLAGS/SYSTEMD_LIBS makefile macros are set, the HAVE_SYSTEMD macro seems defined, only xfpm-systemd.c does not seem to be added to the sources in src/Makefile, not sure why that would be. > > Yes, that might help. You can also take a look and compare with our build > > log at > > https://build.opensuse.org/package/rawlog/X11:xfce/xfce4-power-manager/ > > openSUSE_Factory/x86_64 > > Actually I can't (it requires a username). OK, see http://pastebin.com/raw.php?i=xBUSCyWq
Created attachment 5306 Add shutdown/reboot functionality for systemd (Bug 10167) I've created a git formatted patch combining Andreas' and Guido's work. Guido, I noticed one spot in your patch where it calls: +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + xfpm_systemd_reboot (power->priv->systemd, error); +#else xfpm_console_kit_reboot (power->priv->console, error); +#endif Which I changed to: +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + xfpm_systemd_reboot (power->priv->systemd, error); + else +#endif xfpm_console_kit_reboot (power->priv->console, error); Is that what was intended?
(In reply to Eric Koegel from comment #14) > Created attachment 5306 > Add shutdown/reboot functionality for systemd (Bug 10167) > > I've created a git formatted patch combining Andreas' and > Guido's work. Guido, I noticed one spot in your patch where > it calls: > > +#ifdef HAVE_SYSTEMD > + if ( LOGIND_RUNNING () ) > + xfpm_systemd_reboot (power->priv->systemd, error); > +#else > xfpm_console_kit_reboot (power->priv->console, error); > +#endif > > Which I changed to: > > +#ifdef HAVE_SYSTEMD > + if ( LOGIND_RUNNING () ) > + xfpm_systemd_reboot (power->priv->systemd, error); > + else > +#endif > xfpm_console_kit_reboot (power->priv->console, error); > > Is that what was intended? Yes. BTW, since this does runtime detection of logind should we drop the HAVE_SYSTEMD ifdefs and build-time detection by autoconf?
Created attachment 5311 Add shutdown/reboot functionality for systemd (runtime checks only) This patch eliminates the compile time checks. It uses xfpm's polkit helper functions to avoid bringing in another library. Let me know if this works as expected.
Seems to work great on my Manjaro (archlinux like) system ! Thanks, with that patch I can poweroff my system just by pressing the power button. This was working in xubuntu, but not in Manjaro... probably because consolekit is missing in Manjaro (systemd instead).
Pushed to master in: http://git.xfce.org/xfce/xfce4-power-manager/commit/?id=12f16e0e6a24ee009bc534e00c476939824cd4aa
Marking resolved.