unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH][WIP] Elogind update
@ 2018-11-10 16:00 Stefan Stefanović
  2018-11-12 14:21 ` Andy Wingo
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Stefanović @ 2018-11-10 16:00 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3061 bytes --]

Hello,
Guix.

As I announced, here is patch that let's us update elogind.
Note: This patch is work in progress.
 Please do not mind the lack of proper commit message.
 Since I expect more changes to this patch, I did not bother writing it.

As I far as I know, the last work on elogind is by Marius Bakke:
https://lists.gnu.org/archive/html/guix-patches/2018-01/msg00053.html

The main reason why we did not update to newer versions of elogind is
because system randomly failed to boot after power-off or reboot.

Problem: elogind service fails to start after reboot.

This issue started after elogind introduced ELOGIND_PID_FILE,
"/run/elogind.pid" or in our case "/var/run/elogind.pid", with the commits:

[7c401f91ca900a8ddb2718cbdf7c18dddbe69d59
 Prep v231.6: Allow elogind to be daemonized using -D/--daemon option]
[132565d5bc5f179532fe56c08abbba979e342a35
 Prep v235: Allow elogind to daemonize itself with "-D|--daemon".]

Version v232.4 didn't include the above problematic commits.
Version v234.3 included 7c401f91ca900a8ddb2718cbdf7c18dddbe69d59.

Thanks to the awesome work of current Elogind maintainer Yamakuzure (Sven)
the problem is mostly solved.
Please take a look at GitHub issue: https://github.com/elogind/elogind/issues/94
it will explain the problem better than I could.

The next release will contain the 1st part of the solution.
The installation of the signal handlers is fixed. PID file is deleted,
when system powers-off.

But the problem is with the stale PID found after a forced/abrupt reboot.
As far as I know other distributions do not have to deal with this problem,
because they mount tmpfs to /run and /var/run.
We (Guix) need to find the 2nd part of the solution.

WARNING: If you use the provided elogind-next patch please note that
you may need to manually delete stale PID file "/var/run/elogind.pid",
only in the special/rare case of forced/abrupt reboot.
Failure to do so will prevent elogind and your system from starting!

One thing that I noticed while testing other versions of elogind:
If I run:
 sudo herd disable elogind
 sudo herd stop elogind
the service is re-started by DBus daemon.
but the status of elogind remains:
Status of elogind:
  It is stopped.
  It is disabled.
It seams that Shepherd does not check/detect
if the process is stopped or running.
Is this a bug?
How should Shepherd deal/interact with DBus daemon
since they both start services?
How Should we deal with services started with user level privileges,
possibly by user DBus session daemon
(for example notification service or pulseaudio service)?

If you have time please test this update, and/or comment.
Do not forget to modify your desktop services to use elogind-next:
(modify-services
    %desktop-services
    (elogind-service-type config =>
        (elogind-configuration
            (inherit config)
            (elogind elogind-next)))
;; other modifications...
)

If we find solution for the second part of the problem
we could update elogind after next release v239.2,
which should be out by the end of the next week.

Stefan.

[-- Attachment #2: 0001-gnu-Add-elogind-next.v2.patch --]
[-- Type: text/x-patch, Size: 7184 bytes --]

From 20dec66225036aae54e28e755d28d2bd1e05c0eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
Date: Sat, 10 Nov 2018 14:27:53 +0100
Subject: [PATCH] gnu: Add elogind-next.

---
 gnu/packages/freedesktop.scm | 130 +++++++++++++++++++++++++++++++++++
 1 file changed, 130 insertions(+)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 5cc2699ad..723d26873 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -43,6 +43,7 @@
   #:use-module (gnu packages acl)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
@@ -65,6 +66,7 @@
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages m4)
+  #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages polkit)
@@ -72,6 +74,7 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages selinux)
   #:use-module (gnu packages valgrind)
   #:use-module (gnu packages w3m)
   #:use-module (gnu packages web)
@@ -346,6 +349,133 @@ the org.freedesktop.login1 interface over the system bus, allowing other parts
 of a the system to know what users are logged in, and where.")
     (license license:lgpl2.1+)))
 
+(define-public elogind-next
+  (let* ((commit "0554def508b3328b70aaa6464886ad51219b9379")
+         (revision "2")
+         (version (git-version "240a" revision commit)))
+    (package
+      (name "elogind-next")
+      (version version)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/elogind/elogind")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0xwwrkd20zwqsychf76yd8n8kydk5vsgkx17v3qqbmhnbyq30a42"))
+                (modules '((guix build utils)))
+                (snippet
+                 '(begin
+                    (use-modules (guix build utils))
+                    (substitute* "meson.build"
+                      ;; Clean RUNPATH.
+                      (("install_rpath :") "#install_rpath :")
+                      ;; TODO: To remove $ORIGIN...
+                      ;;       from RUNPATH of libexec executables:
+                      ;;       we should declare and use
+                      ;;       src/share/libshared as proper dependency.
+                      ;; Fix pkttyagent path:
+                      (("join_paths\\(bindir, 'pkttyagent'\\)")
+                       "'\"/run/current-system/profileb/bin/pkttyagent\"'"))
+                    (substitute* "man/meson.build"
+                      ;; Necessary because
+                      ;; there is no internet access
+                      ;; inside the build environment.
+                      (("xsltproc_flags = \\[")
+                       (string-append "xsltproc_flags = ["
+                                      "        '--novalid',")))
+                    (substitute* "src/login/elogind.c"
+                      ;; Change PID file path.
+                      (("\"/run/elogind.pid\"")
+                       "\"/var/run/elogind.pid\""))
+                    #t))))
+      (build-system meson-build-system)
+      (outputs '("out"))
+      (arguments
+       `(#:tests? #t
+         ;; Some tests fail only in chroot build environment:
+         ;; - https://github.com/elogind/elogind/issues/45
+         ;; Some tests assume existence of standard directories:
+         ;; *** test_copy_bytes FAILS because there is no
+         ;; /usr/lib/os-release or /etc/os-release file
+         ;; *** test_chase_symlinks FAILS because there is no
+         ;; /usr directory
+         ;;
+         #:configure-flags
+         (let* ((out (assoc-ref %outputs "out"))
+                (sysconf (string-append out "/etc"))
+                (libexec (string-append out "/libexec/elogind"))
+                (dbuspolicy (string-append out "/etc/dbus-1/system.d"))
+                (shepherd (assoc-ref %build-inputs "shepherd"))
+                (halt-path (string-append shepherd "/sbin/halt"))
+                (kexec-path "") ;; NOTE: We need to package kexec-tools,
+                                ;;       or support kexec whit shepherd.
+                (poweroff-path (string-append shepherd "/sbin/shutdown"))
+                (reboot-path (string-append shepherd "/sbin/reboot")))
+           `(,(string-append
+               "-Drootprefix=" out)
+             ,(string-append
+               "-Dsysconfdir=" sysconf)
+             ,(string-append
+               "-Drootlibexecdir=" libexec)
+             ,(string-append
+               "-Ddbuspolicydir=" dbuspolicy)
+             ,(string-append
+               "-Dc_link_args=-Wl,-rpath=" libexec)
+             ,(string-append
+               "-Dcpp_link_args=-Wl,-rpath=" libexec)
+             ,(string-append
+               "-Dhalt-path=" halt-path)
+             ,(string-append
+               "-Dkexec-path=" kexec-path)
+             ,(string-append
+               "-Dpoweroff-path=" poweroff-path)
+             ,(string-append
+               "-Dreboot-path=" reboot-path)
+             "-Dcgroup-controller=elogind"
+             ;; Disable some tests.
+             "-Dtests=false"
+             "-Dslow-tests=false"))
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'bootstrap))))
+      (native-inputs
+       `(("docbook-xsl" ,docbook-xsl)
+         ("docbook-xml-4.2" ,docbook-xml-4.2)
+         ("docbook-xml-4.5" ,docbook-xml)
+         ("libxml2" ,libxml2)
+         ("m4" ,m4)
+         ("pkg-config" ,pkg-config)
+         ("python" ,python)
+         ("python-lxml" ,python-lxml)
+         ("gettext" ,gettext-minimal)
+         ("gperf" ,gperf)
+         ("xsltproc" ,libxslt)))
+      (inputs
+       `(("acl" ,acl)
+         ("audit" ,audit)
+         ("dbus" ,dbus)
+         ("eudev" ,eudev)
+         ("glibc" ,glibc)
+         ("libcap" ,libcap)
+         ("libseccomp" ,libseccomp)
+         ("libselinux" ,libselinux)
+         ("linux-pam" ,linux-pam)
+         ("pcre2" ,pcre2)
+         ("polkit" ,polkit)
+         ("python" ,python) ;; libpython optional input
+         ("shepherd" ,shepherd)
+         ("util-linux" ,util-linux)))
+      (home-page "https://github.com/elogind/elogind")
+      (synopsis "Elogind provides user, seat, and session management service.")
+      (description "Elogind is the systemd project's \"logind\" service,
+extracted out as a separate project.  Elogind integrates with PAM to provide
+the org.freedesktop.login1 interface over the system bus, allowing other parts
+of a the system to know what users are logged in, and where.")
+      (license license:lgpl2.1+))))
+
 (define-public packagekit
   (package
     (name "packagekit")
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-11-16  6:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-10 16:00 [PATCH][WIP] Elogind update Stefan Stefanović
2018-11-12 14:21 ` Andy Wingo
2018-11-12 21:06   ` Stefan Stefanović
2018-11-13 11:37     ` Stefan Stefanović
2018-11-14 10:33       ` Ludovic Courtès
2018-11-14 13:39         ` Stefan Stefanović
2018-11-14 17:04           ` Marius Bakke
     [not found]             ` <CAFBTj=gsoSHJbZmHTNdQb29ddic-X5hZekOQE+t2ooAgudWpCQ@mail.gmail.com>
2018-11-16  6:11               ` Stefan Stefanović

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).