Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Permission denied during local start script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
jerann
n00b
n00b


Joined: 26 Jan 2005
Posts: 67

PostPosted: Sun Dec 18, 2011 12:40 am    Post subject: Permission denied during local start script Reply with quote

I recently posted about trying to start/stop a vm automatically when my server boots: http://forums.gentoo.org/viewtopic-t-904312-highlight-.html. I've got virsh working, but I'm encountering a very odd problem. So, I made a script at /etc/local.d/90_start-x86_vm.start

Code:
#!/bin/bash
echo "Starting x86_vm..."
virsh start x86_vm
echo "Done"


As my regular user, I can run virsh start x86_vm and everything works great; but when the computer starts, I see this when it tries to run my local start script:

Code:
Starting x86_vm...
error: Failed to start domain x86_vm
error: internal error process exited while connecting to monitor: qemu-system-x86_64: -drive file=/var/lib/libvirt/images/gentoo-i386.img,if=none,id=drive-ide0-0-0,format=qcow2: could not open disk image /var/lib/libvirt/images/gentoo-i386.img: Permission denied


Done


I tried running it with sudo instead by doing "sudo -u jrann virsh start x86_vm" in the script (jrann is my normal user), but I got the same message. I find it very strange because I can take my normal user and do "/etc/local.d/90_start-x86_vm.start", and it works fine. Here's the vm configuration:

Code:
<domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>x86_vm</name>
  <uuid>1ba0f337-7678-7ae3-f705-a86a7e866c10</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='i686' machine='pc-0.14'>hvm</type>
  </os>
  <features>
    <acpi/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/gentoo-i386.img'/>
      <target dev='hda' bus='ide'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='ethernet'>
      <mac address='00:00:00:00:00:00'/>
      <script path='no'/>
      <target dev='tap0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5902' autoport='no' listen='*' keymap='en-us'>
      <listen type='address' address='*'/>
    </graphics>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
</domain>


Any ideas?
Back to top
View user's profile Send private message
teika
n00b
n00b


Joined: 19 Feb 2011
Posts: 59
Location: japan

PostPosted: Sat Dec 31, 2011 5:28 am    Post subject: Reply with quote

Have you googled for the words: "permission denied" "internal error process exited while connecting to monitor" "open disk image"?

It seems like a virtualization issue, and the subject title "Permission denied during local start script" must be wrong, failing to draw attention of VM gurus.

(Sorry, I can't help.)
_________________
Easy Shift / Ctrl / AltGr ... hack; save your pinkies, type without drudge: topic 865313
Back to top
View user's profile Send private message
markpitchless
n00b
n00b


Joined: 09 Mar 2012
Posts: 1

PostPosted: Fri Mar 09, 2012 6:46 pm    Post subject: Reply with quote

Funny, I googled similar words tto get here. I think I have may have a possible fix. The problem seems to be perms settings for libvirt's use of qemu. In /etc/libvirt/qemu.conf, uncomment the two settings like so:

Code:
      # The user ID for QEMU processes run by the system instance.
      user = "root"                                                       
     
      # The group ID for QEMU processes run by the system instance.
      group = "root"

I actually used a group of libvirtd, you may need to tweak accordingly. Then restart libvirtd and try again.

Based on reading http://lists.opennebula.org/pipermail/users-opennebula.org/2010-September/002848.html and http://ubuntuforums.org/showthread.php?t=1703744
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum