From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 06:01:06 2023 Received: (at submit) by debbugs.gnu.org; 15 Sep 2023 10:01:06 +0000 Received: from localhost ([127.0.0.1]:42141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh5dK-0002qF-Ax for submit@debbugs.gnu.org; Fri, 15 Sep 2023 06:01:06 -0400 Received: from lists.gnu.org ([2001:470:142::17]:37624) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh5dH-0002pV-3z for submit@debbugs.gnu.org; Fri, 15 Sep 2023 06:01:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh5d0-000118-SZ for bug-coreutils@gnu.org; Fri, 15 Sep 2023 06:00:49 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qh5ct-00067m-E6 for bug-coreutils@gnu.org; Fri, 15 Sep 2023 06:00:40 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 8A1E61F38C; Fri, 15 Sep 2023 10:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1694772035; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=So0h4CwmAk2t3QGD/Q0YHAI62HGR2i0o1P1N1JyiMTM=; b=Qvh12UNkSvVVKNv/3R5K6gj2IvYb/H/d/sZ1qnoZgf+BU9ACGL17xlB8wSUl1rVSEE6JrY D1KApjl4gTm6yM9quckJgEQ1DQShqMCAg7JkRgpC5gd3zDNZ0CHQOz48maTgUsxUci4WPw UMViUpI8K9kRUFfzaucnhkM3icQbjPk= Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 475C22C142; Fri, 15 Sep 2023 10:00:35 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 358) id 3BD3E6801; Fri, 15 Sep 2023 10:00:35 +0000 (UTC) Date: Fri, 15 Sep 2023 10:00:35 +0000 From: Thorsten Kukuk To: bug-coreutils@gnu.org Subject: readutmp should check for sd_booted() and not if /run/utmp exists Message-ID: <20230915100035.GA30741@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.10.1 (2018-07-13) Received-SPF: pass client-ip=195.135.220.29; envelope-from=kukuk@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi, if there is no /run/utmp file, /usr/bin/who falls back correctly to the systemd-logind interface and shows correct data. But there are applications, which don't use the libc interface for reading/writing utmp entries, they have their own implementation. And this implementations create the file /run/utmp if this does not [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) X-Debbugs-Envelope-To: submit Cc: Paul Eggert , Bruno Haible X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Hi, if there is no /run/utmp file, /usr/bin/who falls back correctly to the systemd-logind interface and shows correct data. But there are applications, which don't use the libc interface for reading/writing utmp entries, they have their own implementation. And this implementations create the file /run/utmp if this does not exist (glibc does not). Which means, /usr/bin/who shows sometimes wrong/incomplete data. procps (especially w) and other packages don't check if /run/utmp exist or not, but use sd_booted(). e.g.: if (sd_booted() > 0) { numuser = sd_get_sessions(NULL); } else { setutent(); while ((ut = getutent())) { if ((ut->ut_type == USER_PROCESS) && (ut->ut_name[0] != '\0')) numuser++; } endutent(); } So if logind is running, logind is used, else /run/utmp. I think gnulib/coreutils should do the same. It's impossible to find and fix all the code writing utmp entries at their own, especially if this is 3rd party software and you don't have the source code. Thorsten -- Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future Technologies SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nuernberg, Germany Managing Director: Ivo Totev, Andrew McDonald, Werner Knoblich (HRB 36809, AG Nürnberg) From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 08:31:51 2023 Received: (at submit) by debbugs.gnu.org; 15 Sep 2023 12:31:51 +0000 Received: from localhost ([127.0.0.1]:42362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh7zC-0006iO-Nq for submit@debbugs.gnu.org; Fri, 15 Sep 2023 08:31:51 -0400 Received: from lists.gnu.org ([2001:470:142::17]:49782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh7z8-0006hx-FT for submit@debbugs.gnu.org; Fri, 15 Sep 2023 08:31:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh7yg-0005hj-MM; Fri, 15 Sep 2023 08:31:23 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.162]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh7yc-0003p4-CB; Fri, 15 Sep 2023 08:31:18 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1694781059; cv=none; d=strato.com; s=strato-dkim-0002; b=eDSQegjpiDeA7r+NFyzwA3yLPr5zG/BHFjH7tzlWFgbLHoXxpHDE0WcKnWmT0/QWbo Gi7z/4wH7U+iA0/ccvG0wz/YN9GdeibAgkJk4jXpNa6vTSvIohfCQzpMpDcwIJethsj0 bkp5UY/HZmOgBuhPG4GGHRZgWWynFAkQr21/Orjqz8C9KINeej6lvuTBGUE1oD/F96XJ QtSaIVZFmINMPPzNSDJeyaUPF5MlheehIcrlCbTxLoZ5C36VhXqIr230SyGV8sCvHL5n eCuyt+BEfV/RKG+u65nTo593KfO6hj9Lbcl15Iml/jKU6zUlUvLCEN2w1vY7wY7+XISQ PH7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1694781059; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=dW7wfxDXz8fjU4mrfuy9ROSjJrYhAKOkVDGYdNAs6gI=; b=DWGEDELuFGw8vCO1tJnpVN7CrP6/mUJ5NJu5UWBD/8buwYfheVQN/TyoxNfHUvtWU5 HDmvsVUKLrMzyuKL2z69kWTyTD5xMK84k3b2qhYojebSm0Kw5wQ+XWrajQMZx1UmoS20 gusN5uakI/O5wbIpE+Nf1I8pb9ycUDWM9ODf6PZPNLo3avaMIpWnjVgBRcDbJgCtJAx5 kODE6R/woD4m26H98CnR/7IunHUIgFofVYjexfFCCiDr0TsfQ7K2crPUqLhbRxmfYM37 WDTV3iW4eEk4DoP8v0dXugSNrWsV1X0hfDb0RRQUf+c8PixDmf3V5njqNWYS2WclH2E9 x+8g== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1694781059; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=dW7wfxDXz8fjU4mrfuy9ROSjJrYhAKOkVDGYdNAs6gI=; b=J2u85fgTsaXsmhRUUMVTc5zu/NjW3hLct/N8m2ouZzClMUx/IJud+afwq8yyT8XHhd jhOnA7OOhYRIkMb1gl2Odp2QHBomlLb3318LB5DenYzVJIYy+LhDD0XvqlW61gJ07Hq4 VUgfgoRe/FqO4uTiPsbQsyIIEm66hlEifzz0PXGjqoBdopUDOWwg0HDch99gRecXyAQT z1N66idGlaCt5N6qCr/gffiYKsno+IelKoJe+tSzn8O5pJf6LcWXiJo0UdO+YnahajmC /Y98MJVxg4XcepsRrqJqHupLyFKkirktWJk49v/Pco7R0bNBTQPRWlu49R9IQ0N+nIoD 3iMA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1694781059; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=dW7wfxDXz8fjU4mrfuy9ROSjJrYhAKOkVDGYdNAs6gI=; b=ILLPk992nRuJ2rxD05hcw3gFDJipl6tPTeLbWvXe1GUxZi3FhCjJZBMxfHt528CRzT f/FcsqHKoyIFZZgRMGAA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPC2PImP6j50WxpAjzrN/IpvIbCaA==" Received: from nimes.localnet by smtp.strato.de (RZmta 49.8.2 AUTH) with ESMTPSA id m03934z8FCUxPBE (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 15 Sep 2023 14:30:59 +0200 (CEST) From: Bruno Haible To: bug-coreutils@gnu.org, Thorsten Kukuk Subject: Re: readutmp should check for sd_booted() and not if /run/utmp exists Date: Fri, 15 Sep 2023 14:30:58 +0200 Message-ID: <14244728.V5B86MhjE2@nimes> In-Reply-To: <20230915100035.GA30741@suse.com> References: <20230915100035.GA30741@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Received-SPF: none client-ip=81.169.146.162; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit Cc: Paul Eggert , bug-gnulib@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) [CCing bug-gnulib, because the readutmp code lives in gnulib] Thorsten Kukuk wrote: > if there is no /run/utmp file, /usr/bin/who falls back correctly to the > systemd-logind interface and shows correct data. >=20 > But there are applications, which don't use the libc interface for > reading/writing utmp entries, they have their own implementation. And > this implementations create the file /run/utmp if this does not exist > (glibc does not). Which means, /usr/bin/who shows sometimes wrong/incompl= ete > data. >=20 > procps (especially w) and other packages don't check if /run/utmp exist > or not, but use sd_booted(). e.g.: >=20 > if (sd_booted() > 0) { > numuser =3D sd_get_sessions(NULL); > } else { > setutent(); > while ((ut =3D getutent())) { > if ((ut->ut_type =3D=3D USER_PROCESS) && (ut->ut_name[0] !=3D '\0')) > numuser++; > } > endutent(); > } >=20 > So if logind is running, logind is used, else /run/utmp. > I think gnulib/coreutils should do the same. It's impossible to find and > fix all the code writing utmp entries at their own, especially if this > is 3rd party software and you don't have the source code.=20 You are actually talking about three different things: (A) Calling sd_booted in addition to calling sd_get_sessions. (B) Using the /var/run/utmp file when systemd is not active. (C) Using the /var/run/utmp file when systemd is active but some applications use old APIs. About (A) =3D=3D=3D=3D=3D=3D=3D=3D=3D This is redundant, because when sd_booted() is <=3D 0, sd_get_sessions retu= rns NULL. This comes from the implementation, see https://github.com/systemd/systemd/blob/main/src/libsystemd/sd-daemon/sd-da= emon.c#L716 About (B) =3D=3D=3D=3D=3D=3D=3D=3D=3D Is there any distro which has libsystemd installed (so that coreutils could be built with -lsystemd) but where a different init system is used at boot = time? If not, the suggestion is pointless. About (C) =3D=3D=3D=3D=3D=3D=3D=3D=3D This is not the same as (B), because the existence of an "application" that= uses old APIs does not mean that sd_booted() will return <=3D 0. > But there are applications, which don't use the libc interface for > reading/writing utmp entries, they have their own implementation. Which are these applications? The best approach is, obviously, to modernize these applications by sending them patches. codesearch.debian.net is your friend. > It's impossible to find and > fix all the code writing utmp entries at their own, especially if this > is 3rd party software and you don't have the source code. We should not let proprietary 3rd-party software prevent us from modernizing the GNU system. This is the stance that the Linux kernel has taken more than 20 years ago, by defining a formal interface for kernel modules. If some proprietary applications cause trouble, then the best approach is to ignore it and thus increase the users' will to replace these proprietary applicati= ons with free software. A temporary proposal =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D It is possible that, to get best results in the situation you describe, as long as some applications use the old APIs, it is needed for readutmp to combine (not choose among) the two approaches. The best way to determine if this is true, IMO, would be to 1) turn the compile-time switch in lib/readutmp.c:942 into a run-time swi= tch. 2) Add a '--traditional' option to 'who', 'pinky', 'uptime'. 3) Wait for users to report problems, that is, situations where `who` and `who --traditional` disagree, with precise description of the problems. Paul, P=E1draig, what do you think? Bruno From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 09:02:37 2023 Received: (at submit) by debbugs.gnu.org; 15 Sep 2023 13:02:37 +0000 Received: from localhost ([127.0.0.1]:42403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh8Sz-0007fu-Ej for submit@debbugs.gnu.org; Fri, 15 Sep 2023 09:02:37 -0400 Received: from lists.gnu.org ([2001:470:142::17]:57114) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh8Su-0007fe-9I for submit@debbugs.gnu.org; Fri, 15 Sep 2023 09:02:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh8Si-0006TQ-25; Fri, 15 Sep 2023 09:02:20 -0400 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qh8Sg-0002ZK-4B; Fri, 15 Sep 2023 09:02:19 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0243021899; Fri, 15 Sep 2023 13:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1694782936; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i2BrWpz8sygpqw/T73ekLcSnxiyqXanClgoM6tuNnrA=; b=BA3L+Ck4SMeSTOZddcJ7e3muIgcQUj2bLsm3rCBsJHAA8fcD6LetVQjVJpRTvF9o1eR4L6 icUUVh7FcSH60iCAnoQ5/sIxoYwvxmpv9BKr5ax/h3trb2yzipyNl/iPHO1RbpA7gzCon4 kW5IcQjA0ixUuaTto7d0xkMsaYegmqE= Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id DED302C142; Fri, 15 Sep 2023 13:02:15 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 358) id DF0E86802; Fri, 15 Sep 2023 13:02:15 +0000 (UTC) Date: Fri, 15 Sep 2023 13:02:15 +0000 From: Thorsten Kukuk To: Bruno Haible Subject: Re: readutmp should check for sd_booted() and not if /run/utmp exists Message-ID: <20230915130215.GB16127@suse.com> References: <20230915100035.GA30741@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Received-SPF: pass client-ip=2001:67c:2178:6::1c; envelope-from=kukuk@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Sorry, looks like strace confused me (since this checks the existence of /run/utmp) and the problem is a different one. kukuk@rubicon:~> ls /run/utmp ls: cannot access '/run/utmp': No such file or directory kukuk@rubicon:~> w 14:54:41 up 4 days, 4:51, 2 users, load average: 0,11, 0,13, 0,46 USER TTY FROM LOGIN@ IDLE JC [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) X-Debbugs-Envelope-To: submit Cc: "bug-gnulib@gnu.org" , Paul Eggert , "bug-coreutils@gnu.org" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Sorry, looks like strace confused me (since this checks the existence of /run/utmp) and the problem is a different one. kukuk@rubicon:~> ls /run/utmp ls: cannot access '/run/utmp': No such file or directory kukuk@rubicon:~> w 14:54:41 up 4 days, 4:51, 2 users, load average: 0,11, 0,13, 0,46 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT kukuk 172.17.0.109 14:54 22:57m 2:19m 0.04s sshd: kukuk [priv] kukuk tty2 - Mo10 4days 46:26 0.07s /usr/libexec/sddm/sddm-helper --socket /tmp/sddm-auth-4209f4f2-82f8-4a75-862d-c31963792a08 --id 1 --start /usr/bin/startplasma-x11 --user kukuk kukuk@rubicon:~> who kukuk sshd pts/13 2023-09-15 14:54 (172.17.0.109) kukuk seat0 2023-09-11 10:03 (:0) kukuk tty2 2023-09-11 10:03 (:0) Who creates an additional line for "seat0", which no other tools creates and which it did not create before. Since some display manager writes wrongly multiple utmp entries, one with the real tty, one with "seat0" as device, and with seeing /run/utmp in the strace output, I wrongly assumed we prefer /run/utmp over logind. So, there are two problems: 1. I don't think who should show an additional "seat0" line other tools and who in the past did not show. That's confusing. 2. There are reports that who/uptime seg.faults if gdm is used as display manager. The reporter confirmed, that this does not happen with sddm, login, sshd or so. Since I don't use GNOME, I cannot reproduce. The seg.faults are new reports. Thorsten -- Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future Technologies SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nuernberg, Germany Managing Director: Ivo Totev, Andrew McDonald, Werner Knoblich (HRB 36809, AG Nürnberg) From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 09:38:04 2023 Received: (at submit) by debbugs.gnu.org; 15 Sep 2023 13:38:04 +0000 Received: from localhost ([127.0.0.1]:42445 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh91I-00007q-3Z for submit@debbugs.gnu.org; Fri, 15 Sep 2023 09:38:04 -0400 Received: from lists.gnu.org ([2001:470:142::17]:39598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh91F-00007J-Dl for submit@debbugs.gnu.org; Fri, 15 Sep 2023 09:38:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh913-0007Z8-9y; Fri, 15 Sep 2023 09:37:49 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.218]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh911-0000n9-3G; Fri, 15 Sep 2023 09:37:49 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1694785054; cv=none; d=strato.com; s=strato-dkim-0002; b=g90cucP4/+x/zKyzC2JEuRpdQKnRRBuF1nvYURMrdrcx+esKyIZESMG4U19v1foscf pKAN9fqwjpGF46sepaj1TeIOIKiB01GKfjZjV8+eqJQ1w8jxNIhQCg2YRM0nRf+VVh0k kWkLHC252IBjVA3UaQktks88g5V3fEtDs2BItXCckoVD+tou/EUjrGS2TEO+jy6WuWFB JbEQgdaAZET0i6Ayar1u/Hb+rCbOECu/PN+AyB/kapYAVIMc5EIJIgx609unjEwOEY3d szstbIu9SG7iSjQ/xsj7SrNwWIGR9pO+B2kGDILV6GmQMEyuQOow51twi3lLBNebgYbh 5wfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1694785054; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=4FP7884uW+FL+w0sZwCb/h/1lZdCIK8T9MGN+IVObwE=; b=MYcHmN/L30j43PA9QK1IvOQPkHapo+eBcAqJFdgkYh1hvF8voPo77tImC5q4m0Ry8N Ry/QeB1UHyxTDileV9uNrPr/OViubTMI3CpNkJgKf/i4b4Gws5qpg8eXoEvJtIMpWxrj QflZdXpNuq2vHx11yrxrB/1d557Jv916NTlQElrPaVhqV6a1QGK810DEhmkS6P34CVSm i+BIr2lRtwL9lH+qj6Dsim5e3srGEdYHTt9DRBo7sE1uWPgJ1DPmc/5i8FAFsUz0jkb7 J0/0FF/1juYdcAJI/vka8BhcB1vG+r2fSXzZpfeIpPy5HBWcBMqn0SidFKF9JlyGo2Gv U86g== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1694785054; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=4FP7884uW+FL+w0sZwCb/h/1lZdCIK8T9MGN+IVObwE=; b=fsKcSxIncEvMjxLSK5ZGUI+i5LOVeMcI2rCztauQHlfpqEj68kJJLoVIesYRBiH412 XswwAfgXNIaZBqq+Aes0I97JCUrjteQwyGnUy2dUQjQ0Q6ztqe4xUVdnPeugUMPdZuH3 ZZk9KYlmlhIcDecskHa6L0LOSTIcyKngC9sxlIPUF5eJ8ej3kVp9pEHx86q5EsyKjRNe m7danZYbsVDAttPcfwkzqVj+OVf+tZ/148yLKr8SlSihJxZPQmlssZe9EahbmnOZVezq AshxeBJ9RZf04ky+N9YOsoUNjTs1OJmWSdStETlNjC86dKKI2uKe2DpeOiCSh8nfdT6V ouJw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1694785054; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=4FP7884uW+FL+w0sZwCb/h/1lZdCIK8T9MGN+IVObwE=; b=i7n1PwemH98jCcdsBgL01gMLCQMKiy+FBdPDs149XulctirBIHxusmr+pMywWEdyHk FKVwT0YlpO42X1E7tOBw== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPC2PImP6j50WxpAjzrN/IpvIbCaA==" Received: from nimes.localnet by smtp.strato.de (RZmta 49.8.2 AUTH) with ESMTPSA id m03934z8FDbYPY9 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 15 Sep 2023 15:37:34 +0200 (CEST) From: Bruno Haible To: Thorsten Kukuk Subject: Re: readutmp should check for sd_booted() and not if /run/utmp exists Date: Fri, 15 Sep 2023 15:37:33 +0200 Message-ID: <7706439.qhNJtBbHLU@nimes> In-Reply-To: <20230915130215.GB16127@suse.com> References: <20230915100035.GA30741@suse.com> <20230915130215.GB16127@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=81.169.146.218; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit Cc: "bug-gnulib@gnu.org" , Paul Eggert , "bug-coreutils@gnu.org" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Thorsten Kukuk wrote: > Who creates an additional line for "seat0", which no other tools creates > and which it did not create before. Since some display manager writes > wrongly multiple utmp entries To me, that's a feature, not a bug. Systemd has introduced the concept of seats [1], and the concept of tty is not so adequate any more for identifying a session (because some terminal emulators / desktops put a line into /var/run/utmp for each open terminal emulator window [2]). It is thus natural and useful to show the association between user and seat. Bruno [1] https://www.freedesktop.org/wiki/Software/systemd/multiseat/ [2] https://www.thkukuk.de/blog/Y2038_glibc_utmp_64bit/