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

* Re: [PATCH][WIP] Elogind update
  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ć
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Wingo @ 2018-11-12 14:21 UTC (permalink / raw)
  To: Stefan Stefanović; +Cc: guix-devel

On Sat 10 Nov 2018 17:00, Stefan Stefanović <stefanx2ovic@gmail.com> writes:

> 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.

We do this too, right?  At least there's a subtree of /run that we mount
fresh at boot-time.  See %elogind-file-systems in (gnu system
file-systems).  Perhaps we could put the PID file in /run/systemd or
something.

Andy

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

* Re: [PATCH][WIP] Elogind update
  2018-11-12 14:21 ` Andy Wingo
@ 2018-11-12 21:06   ` Stefan Stefanović
  2018-11-13 11:37     ` Stefan Stefanović
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Stefanović @ 2018-11-12 21:06 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

>Perhaps we could put the PID file in /run/systemd or something.
We could change the PID file path, I have changed it to "/var/run/elogind.pid".
I will change it to "/run/systemd/elogind.pid", I will test it and
report tomorrow.

I am thinking of making the PID file check more robust by covering the
use-case of the stale PID file. This should fix this problem.

Thank you, for the suggestion.
Sorry I did not respond sooner,
I just now saw your message.

Stefan.

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

* Re: [PATCH][WIP] Elogind update
  2018-11-12 21:06   ` Stefan Stefanović
@ 2018-11-13 11:37     ` Stefan Stefanović
  2018-11-14 10:33       ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Stefanović @ 2018-11-13 11:37 UTC (permalink / raw)
  To: guix-devel

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

Status update:
The solution Andy provided works.
The PID file has a new path:
 "/run/systemd/elogind.pid".
Additional patch that is needed,
will be provided with this message.

All that remains is to figure out how
to integrate this update to Guix,
following the next release of elogind (v239.2).

Any advice and suggestion is appreciated,
since I am relatively new to Scheme and Guix.

Issue:
Replacing elogind package definition in place
did not work for me the last time I tried it.
Problem is the guix commands were stuck/busy
(not stuck building or anything like that,
just stuck like "in an infinite loop")
every time I tried to build elogind,
with the newer package definition
as replacement for the older one.

Maybe I should have tried
and waited for a few hours.

The only thing that avoided this issue was
the replacement of "elogind" with "elogind-next"
while leaving the older elogind package intact.
It might be the case that my guix environment
setup is wrong. Am I missing something obvious?

Any comment around described
issue is appreciated.
Thank you.

Stefan.

[-- Attachment #2: 0001-gnu-elogind-next-Change-PID-file-path.patch --]
[-- Type: text/x-patch, Size: 1293 bytes --]

From ca741455a39417991405ef2f254f5773496d8fd1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
Date: Mon, 12 Nov 2018 22:23:28 +0100
Subject: [PATCH] gnu: elogind-next: Change PID file path.

* gnu/packages/freedesktop.scm (elogind-next)
  [origin][snippet]: Change PID file path to tmpfs mount point.
---
 gnu/packages/freedesktop.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index da2cadffac..940185f418 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -387,9 +387,10 @@ of a the system to know what users are logged in, and where.")
                        (string-append "xsltproc_flags = ["
                                       "        '--novalid',")))
                     (substitute* "src/login/elogind.c"
-                      ;; Change PID file path.
+                      ;; Change PID file path
+                      ;; to fmpfs mount point.
                       (("\"/run/elogind.pid\"")
-                       "\"/var/run/elogind.pid\""))
+                       "\"/run/systemd/elogind.pid\""))
                     #t))))
       (build-system meson-build-system)
       (outputs '("out"))
-- 
2.19.1


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

* Re: [PATCH][WIP] Elogind update
  2018-11-13 11:37     ` Stefan Stefanović
@ 2018-11-14 10:33       ` Ludovic Courtès
  2018-11-14 13:39         ` Stefan Stefanović
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2018-11-14 10:33 UTC (permalink / raw)
  To: Stefan Stefanović; +Cc: guix-devel

Hello,

Stefan Stefanović <stefanx2ovic@gmail.com> skribis:

> Status update: The solution Andy provided works.  The PID file has a
> new path: "/run/systemd/elogind.pid".  Additional patch that is
> needed, will be provided with this message.

The patch LGTM.

> All that remains is to figure out how to integrate this update to
> Guix, following the next release of elogind (v239.2).
>
> Any advice and suggestion is appreciated, since I am relatively new to
> Scheme and Guix.

We would squash this /run/systemd/elogind.pid patch with the one that
actually updates elogind and that’s it.

If you could check on a system that uses ‘%desktop-services’ (and thus
elogind) that you can still log in, etc., that’d be great.  You can do
that in a VM with ‘guix system vm’.

> Issue: Replacing elogind package definition in place did not work for
> me the last time I tried it.  Problem is the guix commands were
> stuck/busy (not stuck building or anything like that, just stuck like
> "in an infinite loop") every time I tried to build elogind, with the
> newer package definition as replacement for the older one.

What did ‘guix build elogind’ print?

Thanks,
Ludo’.

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

* Re: [PATCH][WIP] Elogind update
  2018-11-14 10:33       ` Ludovic Courtès
@ 2018-11-14 13:39         ` Stefan Stefanović
  2018-11-14 17:04           ` Marius Bakke
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Stefanović @ 2018-11-14 13:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Hello,
Ludo’.

Thank you, for the response.

Sorry for the verbose and long message,
it is low priority, so read it only you have time. :)

>> Stefan Stefanović <stefanx2ovic@gmail.com> skribis:
>>
>> All that remains is to figure out how to integrate this update to
>> Guix, following the next release of elogind (v239.2).
>>
>> Any advice and suggestion is appreciated, since I am relatively new to
>> Scheme and Guix.

> We would squash this /run/systemd/elogind.pid patch with the one that
> actually updates elogind and that’s it.

Yes I can do that.
But I was originally wondering about,
should we change the Scheme symbolic-name,
and should we keep the older elogind definition.
This is in the context of the problematic
in-place-update of elogind definition I described.
I assume that we should fix this in-place-update.

> If you could check on a system that uses ‘%desktop-services’ (and thus
> elogind) that you can still log in, etc., that’d be great.  You can do
> that in a VM with ‘guix system vm’.

I tested elogind-next on my system (not in VM),
using mingetty auto-login service and starting
sway (Wayland compositor) with the
dbus-launch wrapper.
(Off topic: I plan to send patches for sway,
when it releases its 1.0, it is in beta right now.)
Status:
New elogind works fine, using it daily.
I have no problems, but I do not use the default:
display-manager, session-manager and window-manager.

I will try and test it in VM, but I need to make sure that
all the packages that depend on elogind depend
on elogind-next.
This could be challenging. Not sure how to approach this.
Maybe by using higher order procedure: package-input-rewriting.

>> Issue: Replacing elogind package definition in place did not work for
>> me the last time I tried it.  Problem is the guix commands were
>> stuck/busy (not stuck building or anything like that, just stuck like
>> "in an infinite loop") every time I tried to build elogind, with the
>> newer package definition as replacement for the older one.

> What did ‘guix build elogind’ print?
Given elogind definition is replaced with the newer definition.

When I run:
$ guix build elogind
Then I get:
guix command hangs after printing:
"Updating channel 'guix' from Git repository...".

In the same context, when I run:
$ guix build -S elogind
Then I get the modified source, without problems.
"/gnu/store/...-elogind-....tar.xz"

Given elogind definition is not replaced
and newer definition is added next to it.

When I run:
$ guix build elogind-next
Then I get:
"/gnu/store/...-elogind-next-..."
The build result as expected.

I am going to do binary search (bisect) for this problem,
by replacing elogind with elogind-next, in order
to find out which use of elogind-next is problematic.

I will do that and report back.

Stefan.

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

* Re: [PATCH][WIP] Elogind update
  2018-11-14 13:39         ` Stefan Stefanović
@ 2018-11-14 17:04           ` Marius Bakke
       [not found]             ` <CAFBTj=gsoSHJbZmHTNdQb29ddic-X5hZekOQE+t2ooAgudWpCQ@mail.gmail.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Marius Bakke @ 2018-11-14 17:04 UTC (permalink / raw)
  To: Stefan Stefanović, Ludovic Courtès; +Cc: guix-devel

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

Hello Stefan,

Thank you very much for this work!

Stefan Stefanović <stefanx2ovic@gmail.com> writes:

> Hello,
> Ludo’.
>
> Thank you, for the response.
>
> Sorry for the verbose and long message,
> it is low priority, so read it only you have time. :)
>
>>> Stefan Stefanović <stefanx2ovic@gmail.com> skribis:
>>>
>>> All that remains is to figure out how to integrate this update to
>>> Guix, following the next release of elogind (v239.2).
>>>
>>> Any advice and suggestion is appreciated, since I am relatively new to
>>> Scheme and Guix.
>
>> We would squash this /run/systemd/elogind.pid patch with the one that
>> actually updates elogind and that’s it.
>
> Yes I can do that.
> But I was originally wondering about,
> should we change the Scheme symbolic-name,
> and should we keep the older elogind definition.
> This is in the context of the problematic
> in-place-update of elogind definition I described.
> I assume that we should fix this in-place-update.

Are you referring to the case of a stale /var/run/elogind.pid?  Or the
D-Bus versus Shepherd issue?

For the latter I think it may make sense to prevent D-Bus from starting
elogind.  For the former: /var/run should be automatically cleaned upon
booting, is this not the case?

>> If you could check on a system that uses ‘%desktop-services’ (and thus
>> elogind) that you can still log in, etc., that’d be great.  You can do
>> that in a VM with ‘guix system vm’.
>
> I tested elogind-next on my system (not in VM),
> using mingetty auto-login service and starting
> sway (Wayland compositor) with the
> dbus-launch wrapper.
> (Off topic: I plan to send patches for sway,
> when it releases its 1.0, it is in beta right now.)
> Status:
> New elogind works fine, using it daily.
> I have no problems, but I do not use the default:
> display-manager, session-manager and window-manager.
>
> I will try and test it in VM, but I need to make sure that
> all the packages that depend on elogind depend
> on elogind-next.
> This could be challenging. Not sure how to approach this.
> Maybe by using higher order procedure: package-input-rewriting.

It's probably easiest to do this from a git checkout of the Guix
repository and modify the "elogind" package directly.  Then you can
either `guix pull --url=./repo`, or use the "./pre-inst-env" script (see
<https://www.gnu.org/software/guix/manual/en/guix.html#Building-from-Git>).

>>> Issue: Replacing elogind package definition in place did not work for
>>> me the last time I tried it.  Problem is the guix commands were
>>> stuck/busy (not stuck building or anything like that, just stuck like
>>> "in an infinite loop") every time I tried to build elogind, with the
>>> newer package definition as replacement for the older one.
>
>> What did ‘guix build elogind’ print?
> Given elogind definition is replaced with the newer definition.
>
> When I run:
> $ guix build elogind
> Then I get:
> guix command hangs after printing:
> "Updating channel 'guix' from Git repository...".

I don't know why "guix build" would ever print "Updating channel ...",
but the hang sounds like a circular dependency issue.  Do you have the
in-place diff available?  It could be that some of the new dependencies
depend on elogind, directly or indirectly.

In that case we will have to investigate how to break the circular
dependency.  A typical solution is to add a "foo-sans-elogind" variant
which is used as the elogind input.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: [PATCH][WIP] Elogind update
       [not found]             ` <CAFBTj=gsoSHJbZmHTNdQb29ddic-X5hZekOQE+t2ooAgudWpCQ@mail.gmail.com>
@ 2018-11-16  6:11               ` Stefan Stefanović
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Stefanović @ 2018-11-16  6:11 UTC (permalink / raw)
  To: guix-devel

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

Hello,
Guix.

I solved my problem. Please use this new patch,
which will be attached to this message.

I must apologize for my carelessness.

I unnecessary added dependency cycle between elogind and polkit.
At the time I added polkit, as input dependency of elogind,
I was looking at service extension graph and
mistook it for dependency graph I had opened at that same time,
that was foolish of me. :(

My system compiled fine with newer version of elogind,
because the polkit my system used deepened on
older version of elogind.
But that meant that I had trouble when I tried to
replace old elogind in guix repository with the newer elogind version.

Problem is now solved.
I spent so much time looking for the cause of this problem. :(
But it was fun. And I gained useful experience. :)

I now know how guix behaves when I try to evaluate
derivation that has dependency cycle,
it hangs not printing anything and
keeps increasing RAM memory usage. :)

Thank you, for your patience.
I will wait for the official release of elogind version 239.2
before sending the modified version of this patch to guix-patches.
The 239.2 version of elogind should be released in a few days,
but that is only my prediction.

Stefan.

[-- Attachment #2: 0001-gnu-elogind-Update-to-version-239.2.patch --]
[-- Type: text/x-patch, Size: 12343 bytes --]

From 7366b0d198e7ac5d90419cfb081e3144f2248ad1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
Date: Fri, 16 Nov 2018 06:50:16 +0100
Subject: [PATCH] gnu: elogind: Update to version 239.2.

---
 gnu/packages/freedesktop.scm | 240 ++++++++++++++++++-----------------
 1 file changed, 125 insertions(+), 115 deletions(-)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 5cc2699ad..b52d2339d 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)
@@ -227,124 +230,131 @@ the freedesktop.org XDG Base Directory specification.")
     (license license:expat)))
 
 (define-public elogind
-  (package
-    (name "elogind")
-    (version "232.4")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/elogind/elogind/"
-                                  "archive/v" version ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
-              (sha256
-               (base32
-                "1qcxian48z2dj5gfmp7brrngdydqf2jm00f4rjr5sy1myh8fy931"))
-              (patches (search-patches "elogind-glibc-2.27.patch"))
-              (modules '((guix build utils)))
-              (snippet
-               '(begin
-                  (use-modules (guix build utils))
-                  (substitute* "Makefile.am"
-                    ;; Avoid validation against DTD because the DTDs for
-                    ;; both doctype 4.2 and 4.5 are needed.
-                    (("XSLTPROC_FLAGS = ") "XSLTPROC_FLAGS = --novalid"))
-                  #t))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:tests? #f ;FIXME: "make check" in the "po" directory fails.
-       #:configure-flags
-       (list (string-append "--with-udevrulesdir="
-                            (assoc-ref %outputs "out")
-                            "/lib/udev/rules.d")
-
-             ;; Let elogind be its own cgroup controller, rather than relying
-             ;; on systemd or OpenRC.  By default, 'configure' makes an
-             ;; incorrect guess.
-             "--with-cgroup-controller=elogind"
-
-             (string-append "--with-rootprefix="
-                            (assoc-ref %outputs "out"))
-             (string-append "--with-rootlibexecdir="
-                            (assoc-ref %outputs "out")
-                            "/libexec/elogind")
-             ;; These are needed to ensure that lto linking works.
-             "RANLIB=gcc-ranlib"
-             "AR=gcc-ar"
-             "NM=gcc-nm")
-       #:make-flags '("PKTTYAGENT=/run/current-system/profile/bin/pkttyagent")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'patch-locale-header
-           (lambda _
-             ;; Fix compilation with glibc >= 2.26, which removed xlocale.h.
-             ;; This can be removed for elogind 234.
-             (substitute* "src/basic/parse-util.c"
-               (("xlocale\\.h") "locale.h"))
-             #t))
-         (replace 'bootstrap
-           (lambda _
-             (invoke "intltoolize" "--force" "--automake")
-             (invoke "autoreconf" "-vif")))
-         (add-before 'build 'fix-service-file
-           (lambda* (#:key outputs #:allow-other-keys)
-             ;; Fix the file name of the 'elogind' binary in the D-Bus
-             ;; '.service' file.
-             (substitute* "src/login/org.freedesktop.login1.service"
-               (("^Exec=.*")
-                (string-append "Exec=" (assoc-ref %outputs "out")
-                               "/libexec/elogind/elogind\n")))
-             #t))
-         (add-after 'install 'add-libcap-to-search-path
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             ;; Add a missing '-L' for libcap in libelogind.la.  See
-             ;; <https://lists.gnu.org/archive/html/guix-devel/2017-09/msg00084.html>.
-             (let ((libcap (assoc-ref inputs "libcap"))
-                   (out    (assoc-ref outputs "out")))
-               (substitute* (string-append out "/lib/libelogind.la")
-                 (("-lcap")
-                  (string-append "-L" libcap "/lib -lcap")))
-               #t)))
-         (add-after 'unpack 'remove-uaccess-tag
-           (lambda _
-             ;; systemd supports a "uaccess" built-in tag, but eudev currently
-             ;; doesn't.  This leads to eudev warnings that we'd rather not
-             ;; see, so remove the reference to "uaccess."
-             (substitute* "src/login/73-seat-late.rules.in"
-               (("^TAG==\"uaccess\".*" line)
-                (string-append "# " line "\n")))
-             #t)))))
-    (native-inputs
-     `(("autoconf" ,autoconf)
-       ("automake" ,automake)
-       ("libtool" ,libtool)
-       ("intltool" ,intltool)
-       ("gettext" ,gettext-minimal)
-       ("python" ,python)
-       ("docbook-xsl" ,docbook-xsl)
-       ("docbook-xml" ,docbook-xml)
-       ("xsltproc" ,libxslt)
-       ("m4" ,m4)
-       ("libxml2" ,libxml2)                     ;for XML_CATALOG_FILES
-       ("pkg-config" ,pkg-config)
-
-       ;; Use gperf 3.0 to work around
-       ;; <https://github.com/wingo/elogind/issues/8>.
-       ("gperf" ,gperf-3.0)))
-    (inputs
-     `(("linux-pam" ,linux-pam)
-       ("linux-libre-headers" ,linux-libre-headers)
-       ("libcap" ,libcap)
-       ("shepherd" ,shepherd)                ;for 'halt' and 'reboot', invoked
-                                             ;when pressing the power button
-       ("dbus" ,dbus)
-       ("eudev" ,eudev)
-       ("acl" ,acl)))           ;to add individual users to ACLs on /dev nodes
-    (home-page "https://github.com/elogind/elogind")
-    (synopsis "User, seat, and session management service")
-    (description "Elogind is the systemd project's \"logind\" service,
+  (let* ((commit "0554def508b3328b70aaa6464886ad51219b9379")
+         (revision "1")
+         (version (git-version "239.2" 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
+                      ;; to fmpfs mount point.
+                      (("\"/run/elogind.pid\"")
+                       "\"/run/systemd/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)
+         ("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+)))
+      (license license:lgpl2.1+))))
 
 (define-public packagekit
   (package
-- 
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).