RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1155488 - The env parameter $XDG_RUNTIME_DIR should get the cocrret value automatically while su - to usermode
Summary: The env parameter $XDG_RUNTIME_DIR should get the cocrret value automaticall...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-22 08:44 UTC by Pei Zhang
Modified: 2014-11-05 12:09 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-22 11:19:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Pei Zhang 2014-10-22 08:44:23 UTC
Description:
While su - to usermode, the env parameter $XDG_RUNTIME_DIR is NULL,it should get the correct value automatically.

using  su -  and  ssh two different ways to switch to user mode  in two terminal,
guest status is different . the change to the guest can not be synchronized

Product Version:
kernel-3.10.0-188.el7.x86_64
qemu-kvm-rhev-2.1.2-3.el7.x86_64
libvirt-1.2.8-5.el7.x86_64

How producible:
100%

Steps:
1. root login into host ;

add a test user.
#useradd test

#pwd
/home/test

prepare a img and xml which belong to test .

# ls -al domain.xml r7new.img
-rw-r--r--. 1 test test       3281 Oct 16 11:09 domain.xml
-rw-r--r--. 1 test test 3863478272 Oct 16 11:07 r7new.img

2. in terminal 1, using ssh to switch to user mdoe:

#ssh -X test@localhost

$ virsh define domain.xml
Domain r7user defined from domain.xml


[test@184 ~]$ virsh start r7user
Domain r7user started

[test@184 ~]$ virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     r7user                         running


[test@184 ~]$  echo $XDG_RUNTIME_DIR
/run/user/1001


3. in terminal2, using su - test to switch to user mode :

[root@184 test]# su - test

to check the guest status:

[test@184 ~]$ virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     r7user                         shut off

check $XDG_RUNTIME_DIR, nothing out put.
[test@184 ~]$  echo $XDG_RUNTIME_DIR 


if start guest
#virsh start r7user
it will hang

ctrl + c to stop then

#virsh start r7user
error: Domain is already active

[test@184 ~]$ virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     r7user                         shut off


4. check with qemu , it has two qemu process.
[test@184 ~]$ ps -ef | grep qemu
test      9567     1  1 11:56 ? .......
test      9601     1  0 11:56 ?.......


5. set the value of $XDG_RUNTIME_DIR manually same with the one in step 2, the guest status will be sync with step 2.
[test@184 ~]$ export XDG_RUNTIME_DIR='/run/user/1001'
[test@184 ~]$  echo $XDG_RUNTIME_DIR
/run/user/1001
[test@184 ~]$ virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     r7user                         running


Actual Result:
In step 3, using  su -  switch to user mode , the environment parameter  XDG_RUNTIME_DIR is empty. libvirt guest can not get correct status .
  
Expected Result:
In step 3, using  su -  switch to user mode , the environment parameter  XDG_RUNTIME_DIR should get the cocrret value automatically. libvirt guest can get correct status. 
The guest status should be synced while using ssh and su to the usermode.


additonal information:
There is one similar bug for you reference, which is verified.
https://bugzilla.redhat.com/show_bug.cgi?id=955470

Comment 1 Michal Sekletar 2014-10-22 11:19:57 UTC
Semantics of /bin/su - are very vaguely defined and doesn't mention XDG_RUNTIME_DIR explicitly. We don't leave XDG_RUNTIME_DIR set unconditionally. We undefine it when newly logged in user is not the same as the one which owns the session. If you want a full session use mechanism which will provide you one. Calling /bin/su - just doesn't cut it. Sorry. Closing as NOTABUG for now.

Comment 2 Xuesong Zhang 2014-10-31 06:53:16 UTC
hi, Jiri,

libvirt is not working well while su - to usermode, it's one systemd bug. But the systemd developer closed as NOTABUG, is it ok for libvirt side? Would you please kindly have a look at this bug? Thanks in advanced.

Comment 3 Jiri Denemark 2014-11-05 12:09:15 UTC
Well, I think libvirt doesn't really care.


Note You need to log in before you can comment on or make changes to this bug.