Bug 1469134
Summary: | virt-sparsify failed with permission denied on rhel 7.4 host | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Israel Pinto <ipinto> | ||||
Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> | ||||
Status: | CLOSED NOTABUG | QA Contact: | Virtualization Bugs <virt-bugs> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 7.4 | CC: | ptoscano, rbalakri, smelamud | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2017-07-11 08:34:18 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Israel Pinto
2017-07-10 12:58:36 UTC
virt-sparsify is part of libguestfs. The error from libguestfs looks like originating from libvirt though, but the initial triage should be done in libguestfs. This looks like another effect of: https://bugzilla.redhat.com/show_bug.cgi?id=753882#c2 Since XDG_RUNTIME_DIR=/run/user/0, then most probably the shell was a root one, and then `su - $user` (where $user is the user with uid=36, it seems) was used to switch to a non-priviledged user. Most probably this should be solved by unset'ing XDG_RUNTIME_DIR. Just copying my answer from a private email from yesterday ... From the log: libvirt: XML-RPC error : Cannot create user runtime directory '/run/user/0/lib virt': Permission denied libguestfs: error: could not connect to libvirt (URI = qemu:///session): Canno t create user runtime directory '/run/user/0/libvirt': Permission denied [code=38int1=13] This is a libvirt error message, but it's really caused because the process has changed user to vdsm, but an environment variable (XDG_RUNTIME_DIR I think) still references the root-owned /run/user/0 directory. Libvirt tries to create a socket in the runtime dir but fails because it doesn't have access. So basically if you're going to setuid to a different user you need to cleanse or change any environment variables like this. XDG_RUNTIME_DIR is unfortunately a difficult case because there is no default for it. It's supposed to be set by the login process, and the same login process is also supposed to create the actual /run/user/<UID> directory with the right permissions (and clean it when you log out). If you setuid then that may not be happening. It doesn't always happen even when you use the proper tools (notoriously ‘su’ gets it wrong). More discussion here: https://bugzilla.redhat.com/show_bug.cgi?id=753882#c49 https://bugs.freedesktop.org/show_bug.cgi?id=70810 https://serverfault.com/questions/388840/good-default-for-xdg-runtime-dir (In reply to Richard W.M. Jones from comment #4) You're right, the XDG_RUNTIME_DIR was the source of the error above. Because we used sudo -Eu vdsm for testing, it passed also the XDG_RUNTIME_DIR environment variable from root. But after unsetting XDG_RUNTIME_DIR we still get error from libguestfs-test-tool. And it is a kernel panic: [ 0.812095] RIP [<ffffffffb86b68c8>] atomic_notifier_chain_register+0x38/0x70 [ 0.812924] RSP <ffff8fda1db1fce0> [ 0.813326] ---[ end trace 6f1814589326ee27 ]--- [ 0.813853] Kernel panic - not syncing: Fatal exception [ 0.814747] Kernel Offset: 0x37600000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) [ 0.815959] Rebooting in 1 seconds..libguestfs: error: appliance closed the connection unexpectedly, see earlier error messages libguestfs: child_cleanup: 0x562f34a8dc30: child process died libguestfs: error: guestfs_launch failed, see earlier error messages libguestfs: trace: launch = -1 (error) libguestfs: trace: close libguestfs: closing guestfs handle 0x562f34a8dc30 (state 0) What can cause this failure? I've attached the full log. Created attachment 1295853 [details]
The log from libguestfs-test-tool with kernel panic
(In reply to Shmuel Melamud from comment #7) > Created attachment 1295853 [details] > The log from libguestfs-test-tool with kernel panic [ 0.789843] RIP: 0010:[<ffffffffb86b68c8>] [<ffffffffb86b68c8>] atomic_notifier_chain_register+0x38/0x70 This is a kernel bug, see bug 1448312. update to kernel-3.10.0-693.el7.x86_64 all work, thanks Richard closing the BZ |