On 2/18/25 4:26 AM, Daniel P. Berrangé wrote:
On Mon, Feb 17, 2025 at 03:11:56PM -0500, Laine Stump wrote:
On 2/17/25 5:28 AM, Daniel P. Berrangé wrote:
On Mon, Feb 17, 2025 at 02:14:49AM -0500, Laine Stump wrote:
But sometimes XDG_RUNTIME_DIR isn't set in the user's environment.
Do you have examples of scenarios in which this happens, and
yet the /run/user/NNNN directory is still being created, as
that rather sounds like something is broken outside of libvirt.
After seeing the bug report, I replicated the situation by ssh'ing in as a
user that hadn't previously logged in, and then unsetting XDG_RUNTIME_DIR. I
hadn't thought there might be some other case where the user could be logged
in but XDG_RUNTIME_DIR had never been set.
But after seeing your question I tried running
sudo $someuser virsh list
NB, that is the classic sudo usage trapdoor, because they didn't
make "-i" (aka --login) the default, so your environment is not
populated correctly.
I'd hope that when passing sudo -i ... it will do the right
thing
It seems not. If I login as $someuser, start a guest, then in a separate
terminal window from root run:
sudo -u $someuser -i virsh list
It returns an empty list (the same as if I omit the -i). By running the
same command without "virsh list", I'm given a shell instance, and
within that shell I can see that $UID, $USER, and $EUID are all set, but
$XDG_RUNTIME_DIR is not.