Freebsd 14.1 pam_xdg.so and XDG_RUNTIME_DIR

Freebsd 14.1 now creates the XDG_RUNTIME_DIR for you

Pointed out by bileslav on reddit


Since 14.1 you don't have to do all of that anymore.
14.1 silently (I didn't see a mention of it anywhere, planning to post here about that) brought pam_xdg.so to us, enabled by default. This thing does XDG_RUNTIME_DIR=/var/run/xdg/vlad for me automatically on login. It may kind of conflict with ConsoleKit2 if you have it, since that also tries to manage the runtime dir. Also, there are sysutils/pam_xdg in ports.

the location is

Code:
/var/run/xdg/

Code:
drwx--x--x  3 root    wheel       3  5 Jul 12:49 xdg

the /var/run/xdg/ contains a directory named after your user
with the group and user permissions set to your user

Code:
drwx------  2 djwilcox djwilcox 3  5 Jul 12:49 djwilcox

inside that directory is this file

Code:
-rwx------  1 root djwilcox 0  5 Jul 12:49 xdg_session.0

depending on your desktop on window manager you will probably still need to export the XDG_RUNTIME_DIR
in your shell config, replacing username with your username in the command below

Code:
export XDG_RUNTIME_DIR="/var/run/xdg/username"

just thought id mention it because setting up the XDG_RUNTIME_DIR
is needed for wayland and enabling hardware accelerated playback for mpv
 
im just going to test changing the xdg runtime dir from

Code:
/var/run/user/1001

to

Code:
/var/run/xdg/djwilcox

using the following code in my ~/.zshenv

Code:
export XDG_RUNTIME_DIR="/var/run/xdg/${USER}"

and see if there any issue with wayland and mpv
 
i changed the xdg runtime dir in my ~/.zshenv on my old macbook air 2011
running Freebsd 14.1

using

Code:
export XDG_RUNTIME_DIR="/var/run/xdg/${USER}"

booted into dwl ( wayland version of dwm )
no issues

played a video with mpv, no errors

i have the following in my xdg runtime dir

Code:
Alacritty-wayland-0-62795.sock
at-spi
dbus-1
dconf
dwlb
emacs
wayland-0
wayland-0.lock
xdg_session.0

ill check on my Macbook pro retina 2015 next
running 14.1 and dwl

then ill check on my Dells XPS 15 2019
with an nvidia gpu running 14.1 and dwl
 
i ran into a major problem

i set the xdg runtime dir to /var/run/xdg/username

where username is my username

and then moved the /var/run/user/1001 dir
which was the previous xdg runtime dir to the desktop

thinking now the xdg runtime was set to the new location it wasnt needed

rebooted

and now the geli passphrase doesnt work and throws an error about esp and pci root
so looks like im locked out

luckily i ran the test on an old machine and not my main machine

bugger

managed to boot from freebsd usb stick
enter the geli passphrase and boot into single user mode

will mount / and try and fix the issue

i should have filed this in the "i did a stupid thing" post
 
im just booted into single user mode from usb stick

running

Code:
zfs set readonly=off zroot

returns "cannot open zroot dataset does not exist"

also running

Code:
zfs list

returns "no datasets available"

have to boot back from the internal drive
then ill post the errors
 
i didnt export the xdg runtime dir in my shell config

Code:
export XDG_RUNTIME_DIR="/var/run/xdg/${USER}"

running

Code:
printenv

shows the xdg runtime dir is set to my username

Code:
XDG_RUNTIME_DIR=/var/run/xdg/djwilcox

so you dont have to export the XDG_RUNTIME_DIR in your shell config
its done automatically

which is really good because you need to set the xdg runtime dir for wayland
and a lot of users miss that step

so the XDG_RUNTIME_DIR directory is created
and exported so you dont need to do anything

not sure why i got locked out
i wouldnt have thought the xdg runtime dir was related to geli

i blame the outgoing Tory government
 
upgraded 3 machines to use the new location for XDG_RUNTIME_DIR directory

all running Freebsd 14.1 with wayland and dwl

1 - Macbook air 2011 - 11 inch
2 - Macbook Pro Retina 2015 - 13 inch
3 - Dell XPS 15 2019 - 15 inch
 
this is what i have in my ~/.zshenv

Code:
# xdg directories
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
# XDG_RUNTIME_DIR automatically set to /var/run/xdg/djwilcox

i dont export the XDG_RUNTIME_DIR and just rebooted

XDG_RUNTIME_DIR

Code:
# ls -l /var/run/xdg/djwilcox/
total 7
dr-xr-xr-x  11 djwilcox djwilcox 704  6 Jul 20:09 .fcdm-jail
-r--r--r--   1 djwilcox djwilcox   0  6 Jul 20:09 .fcdm-lock
srwxr-xr-x   1 djwilcox djwilcox   0  6 Jul 15:01 Alacritty-wayland-0-58804.sock
drwx------   2 djwilcox djwilcox   3  6 Jul 13:18 at-spi
drwx------   3 djwilcox djwilcox   3  6 Jul 13:18 dbus-1
drwx------   2 djwilcox djwilcox   3  6 Jul 19:09 dconf
drwx------   2 djwilcox djwilcox   2  6 Jul 13:19 doc
drwx------   2 djwilcox djwilcox   3  6 Jul 13:18 dwlb
drwx------   2 djwilcox djwilcox   3  6 Jul 13:18 emacs
drwx------   2 djwilcox djwilcox   2  6 Jul 15:46 pulse
-rw-------   1 djwilcox djwilcox   0  6 Jul 13:19 tofi.lock
srwxr-xr-x   1 djwilcox djwilcox   0  6 Jul 13:18 wayland-0
-rw-r-----   1 djwilcox djwilcox   0  6 Jul 13:18 wayland-0.lock
-rwx------   1 root     djwilcox   0  6 Jul 13:18 xdg_session.0
 
Back
Top