From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#37423: Changing the login service from GDM to SLiM and then back to GDM causes a really bad loop Date: Fri, 20 Sep 2019 11:40:43 +0200 Message-ID: <875zlntiec.fsf@gnu.org> References: <20190916005154.41b74430@interia.pl> <871rwf5y49.fsf@ngyro.com> <87ftksvv4e.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:54589) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBFPU-0003Cs-3u for bug-guix@gnu.org; Fri, 20 Sep 2019 05:41:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBFPS-00051D-PT for bug-guix@gnu.org; Fri, 20 Sep 2019 05:41:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48009) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBFPS-000514-GT for bug-guix@gnu.org; Fri, 20 Sep 2019 05:41:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBFPS-0005Vm-2d for bug-guix@gnu.org; Fri, 20 Sep 2019 05:41:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: ("=?UTF-8?Q?G=C3=A1bor?= Boskovits"'s message of "Thu, 19 Sep 2019 23:47:58 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: =?UTF-8?Q?G=C3=A1bor?= Boskovits Cc: 37423@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi G=C3=A1bor, G=C3=A1bor Boskovits skribis: > Couldn't we simply do what the fix does: ensuring the owner of > the files under =E2=80=9C/var/lib/gdm=E2=80=9D is the current =E2=80=9Cgd= m=E2=80=9D user? Hey you=E2=80=99re right, I was not approaching it from the right angle. Here=E2=80=99s a patch that does that. Thoughts? I=E2=80=99ll push it if there are no objections. Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 06d72b5f60..1d55e388a1 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -773,6 +773,27 @@ the GNOME desktop environment.") (home-directory "/var/lib/gdm") (shell (file-append shadow "/sbin/nologin"))))) +(define %gdm-activation + ;; Ensure /var/lib/gdm is owned by the "gdm" user. This is normally the + ;; case but could be wrong if the "gdm" user was created, then removed, and + ;; then recreated under a different UID/GID: . + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + + (let* ((gdm (getpwnam "gdm")) + (uid (passwd:uid gdm)) + (gid (passwd:gid gdm)) + (st (stat "/var/lib/gdm" #f))) + ;; Recurse into /var/lib/gdm only if it has wrong ownership. + (when (and st + (or (not (= uid (stat:uid st))) + (not (= gid (stat:gid st))))) + (for-each (lambda (file) + (chown file uid gid)) + (find-files "/var/lib/gdm" + #:directories? #t))))))) + (define dbus-daemon-wrapper (program-file "gdm-dbus-wrapper" @@ -915,6 +936,8 @@ the GNOME desktop environment.") (extensions (list (service-extension shepherd-root-service-type gdm-shepherd-service) + (service-extension activation-service-type + (const %gdm-activation)) (service-extension account-service-type (const %gdm-accounts)) (service-extension pam-root-service-type --=-=-=--