Re: Directory 1002/ missing from /var/run/user/

From: Graham Perrin <grahamperrin_at_freebsd.org>
Date: Sat, 17 Jun 2023 08:34:56 UTC
On 12/06/2023 14:20, Jan Beich wrote:
> Graham Perrin <grahamperrin@freebsd.org> writes:
>
>> What normally takes care of creation of the numbered directories?
> /var/run/user/ (or /run/user/ on Linux with systemd) is a common prefix
> for XDG_RUNTIME_DIR, a standardized place for user-owned unix(4) sockets.
> Fallbacks are either app-specific or shared (e.g., CVE-2020-25697).
>
> /var/run/user/<UID> is managed by sysutils/consolekit2 or sysutils/pam_xdg.
> In consolekit2 case the directory is created (contents destroyed if
> already exists) on the first session of the specific UID either via
> C API, DBus API, ck-launch-session(1) or pam_ck_connector(8) and removed
> when the last session terminates. In pam_xdg case the directory is
> created but not removed unless track_sessions is set.
>
>> A few hours ago, it was unexpectedly missing:
> Probably auto-removed by consolekit2 either due to logout or dbus restart.
>
>> I recreated the directory.
> Can be automated via PAM e.g.,
>
>    # pkg install consolekit2
>    # echo "session optional pam_ck_connector.so nox11" >>/etc/pam.d/system
>    # service dbus onestart
>    $ exit # log out on VT console to re-trigger PAM
>
> or
>
>    # pkg install pam_xdg
>    # echo "session optional pam_xdg.so notroot runtime" >>/etc/pam.d/system
>    $ exit # log out on VT console to re-trigger PAM


Thanks.

Prior to reporting I had consolekit2 but not pam_xdg, with 
/etc/pam.d/system content as shown below. I can't recall the origin of 
this content.

The problem (directory 1002/ missing from /var/run/user/) recurred a few 
times.

It has not recurred since packages were upgraded on 15th June (the 
second of two attachments). Fingers crossed.


% pkg iinfo consolekit2 pam_xdg
consolekit2-1.2.5
pkg: No package(s) matching pam_xdg
% cat /etc/pam.d/system
#
# $FreeBSD$
#
# System-wide defaults
#

# auth
#auth           sufficient      pam_krb5.so             no_warn 
try_first_pass
#auth           sufficient      pam_ssh.so              no_warn 
try_first_pass
auth            required        pam_unix.so             no_warn 
try_first_pass nullok

# account
#account        required        pam_krb5.so
account         required        pam_login_access.so
account         required        pam_unix.so

# session
#session        optional        pam_ssh.so              want_agent
session         required        pam_lastlog.so          no_fail

# password
#password       sufficient      pam_krb5.so             no_warn 
try_first_pass
password        required        pam_unix.so             no_warn 
try_first_pass
% ls -hln /etc/pam.d/system
-rw-r--r--  1 0  0   540B  7 Oct  2022 /etc/pam.d/system
% pkg -vv | grep -e url -e enabled -e priority
    url             : 
"pkg+http://pkg0.fra.freebsd.org/FreeBSD:14:amd64/latest",
    enabled         : yes,
    priority        : 4,
    url             : 
"https://alpha.pkgbase.live/current/FreeBSD:14:amd64/latest",
    enabled         : no,
    priority        : 0,
    url             : 
"file:///usr/local/poudriere/data/packages/1049-default",
    enabled         : no,
    priority        : 2
    url             : 
"file:///usr/local/poudriere/data/packages/main-default",
    enabled         : yes,
    priority        : 3
% uname -aKU
FreeBSD mowa219-gjp4-8570p-freebsd 14.0-CURRENT FreeBSD 14.0-CURRENT #6 
main-n263493-4e8d558c9d1c-dirty: Sun Jun 11 06:22:01 BST 2023 
     grahamperrin@mowa219-gjp4-8570p-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GEN
ERIC amd64 1400090 1400090
%