I have a locally built qemu. I am using libvirt python API to defineXML. I get the error:
libvirt: error : internal error: Child process (LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /home/deepti/testqemu/bin/qemu-system-arm -help) unexpected exit status 126: libvirt: error : cannot execute binary /home/deepti/testqemu/bin/qemu-system-arm: Permission denied Traceback (most recent call last): File "testcustomQemu.py", line 70, in dom = conn.defineXML(xmlconfig) File "/home/deepti/.virtualenvs/testlibvirt/local/lib/python2.7/site-packages/libvirt.py", line 3685, in defineXML if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self) libvirt.libvirtError: internal error: Child process (LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /home/deepti/testqemu/bin/qemu-system-arm -help) unexpected exit status 126: libvirt: error : cannot execute binary /home/deepti/testqemu/bin/qemu-system-arm: Permission denied
The ownership for /home/deepti/testqemu is root:root. Changing the permission to +x also does not work.
What am I missing. How can I get my custom qemu to be taken?
My script and xml are as below:
import libvirt
import sys
xmlconfig = """<domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name>limom_instance</name>
<uuid>35615c44-b004-4b3f-9f42-da182b9662ef</uuid>
<memory unit='KiB'>786432</memory>
<currentMemory unit='KiB'>786432</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='armv7l' machine='limott'>hvm</type>
<kernel>/home/deepti/limom/FinalArtifacts/kerneldist1/zImage</kernel>
<dtb>/home/deepti/limom/FinalArtifacts/dtbdist1/emmc.dtb</dtb>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/home/deepti/testqemu/bin/qemu-system-arm</emulator>
<serial type='pty'>
<target port='0'/>
</serial>
<serial type='pty'>
<target port='1'/>
</serial>
<serial type='pty'>
<target port='2'/>
</serial>
<serial type='pty'>
<target port='3'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<memballoon model='none'/>
</devices>
<qemu:commandline>
<qemu:arg value='-sdl'/>
<qemu:arg value='-show-cursor'/>
<qemu:arg value='-nographic'/>
<qemu:arg value='-sd'/>
<qemu:arg value='/home/deepti/limom/FinalArtifacts/emmc.dat'/>
</qemu:commandline>
</domain>"""
conn = libvirt.open('qemu:///system')
if conn == None:
print('Failed to open connection to qemu:///system')
exit(1)
uri = conn.getURI()
print('Canonical URI: '+uri)
dom = conn.defineXML(xmlconfig)
if dom == None:
print('Failed to define a domain from an XML definition')
exit(1)
conn.close()
/home/deeptiisn'to+x, nobody but you (or users who are in whatever group owns said directory) can recurse through it. Same for/home/deepti/limom, etc.root, is tosudo -u qemu:qemu bashand then actually try tocd /home/deepti/testqemu/bin/and./qemu-system-arm --helpor such. If thecdfails, you know directory permissions are the problem. If executing the binary fails, you want to look into its permission *and those of libraries it depends on; the output ofldd ./qemu-system-arm` may be useful. If usingsudoto runbashasqemu(orlibvirtor whatever the account name is) doesn't let you reproduce the problem, it's time to start investigating SELinux configuration &c.