Scp: /var/lib/one//datastores/0/155/disk.1: Permission denied

Hello.

After powering off and afterwards on a virtual machine i get:

Thu Sep 22 20:04:32 2016 [Z0][VMM][I]: scp: /var/lib/one//datastores/0/155/disk.1: Permission denied
Thu Sep 22 20:04:32 2016 [Z0][VMM][E]: Error copying context ISO to mydomain.tld:/var/lib/one//datastores/0/155/disk.1

disk.1 is owned by the qemu user. After chown the file to oneadmin everything works. Question remains. Is this an error of opennebula or is my setup faulty.

thanks and cheers

How have you installed OpenNebula? What OS? what packages?

What are the contents of /etc/libvirt/libvirtd.conf and /etc/libvirt/qemu.conf? can you gist them?

Hello Jaime.

It’s a gentoo system. Opennebula compiled from source. The relevant part from qemu.conf is:

# The user for QEMU processes run by the system instance. It can be
# specified as a user name or as a user id. The qemu driver will try to
# parse this value first as a name and then, if the name doesn't exist,
# as a user id.
#
# Since a sequence of digits is a valid user name, a leading plus sign
# can be used to ensure that a user id will not be interpreted as a user
# name.
#
# Some examples of valid values are:
#
#       user = "qemu"   # A user named "qemu"
#       user = "+0"     # Super user (uid=0)
#       user = "100"    # A user named "100" or a user with uid=100
#
#user = "root"

# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
#group = "root"

# Whether libvirt should dynamically change file ownership
# to match the configured user/group above. Defaults to 1.
# Set to 0 to disable file ownership changes.
#dynamic_ownership = 1# 

So pretty much default. libvirtd,conf default too. Should i change user to oneadmin?

thanks and cheers

Happy to hear that OpenNebula is running on Gentoo somewhere :wink:

Try with this ``/etc/libvirt/qemu.conf(only those lines in the whole file):

user  = "oneadmin"
group = "oneadmin"
dynamic_ownership = 0

Restart libvirtd afterwards.

This should be documented here:
http://docs.opennebula.org/5.0/deployment/open_cloud_host_setup/kvm_driver.html

It used to be, but somehow it’s not there any more… So I opened a ticket to re-add it.
http://dev.opennebula.org/issues/4818

cheers!

Thanks Jaime. Works as expected. :slight_smile:

cheers
t.

Hello,

I am using the Opennebula version 5.2.1 on Ubuntu 16.04. LTS and I have the same error.

In my case disk.1 is also owned by the qemu user, but disk.0 is owned by the root. When I check the /etc/libvirt/qemu.conf, i have already the three lines you mentioned in this post.

It is strange that it was working without any problem and all the previous virtual machines had no such error. When I checked their permissions, I saw that disk0 and disk1 owned by libvirt-qemu user. I changed the permissions according to it, but I still got the following error:

Thu Apr 6 16:10:18 2017 [Z0][VM][I]: New state is POWEROFF
Thu Apr 6 16:10:18 2017 [Z0][VM][I]: New LCM state is LCM_INIT
Thu Apr 6 16:13:53 2017 [Z0][VM][I]: New state is ACTIVE
Thu Apr 6 16:13:53 2017 [Z0][VM][I]: New LCM state is BOOT_POWEROFF
Thu Apr 6 16:13:53 2017 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/43/deployment.11
Thu Apr 6 16:13:54 2017 [Z0][VMM][I]: Command execution fail: /var/lib/one/remotes/tm/ssh/context /var/lib/one/vms/43/context.sh sestserver:/DATASTORE/0/43/disk.1 43 0
Thu Apr 6 16:13:54 2017 [Z0][VMM][I]: context: Generating context block device at sestserver:/DATASTORE/0/43/disk.1
Thu Apr 6 16:13:54 2017 [Z0][VMM][E]: context: Command “scp /var/lib/one/datastores/.isofiles/43/43.iso sestserver:/DATASTORE/0/43/disk.1” failed: Warning: Permanently added ‘sestserver,192.168.2.10’ (ECDSA) to the list of known hosts.
Thu Apr 6 16:13:54 2017 [Z0][VMM][I]: scp: /DATASTORE/0/43/disk.1: Permission denied
Thu Apr 6 16:13:54 2017 [Z0][VMM][E]: Error copying context ISO to sestserver:/DATASTORE/0/43/disk.1
Thu Apr 6 16:13:54 2017 [Z0][VMM][I]: ExitCode: 255
Thu Apr 6 16:13:54 2017 [Z0][VMM][I]: Failed to execute transfer manager driver operation: tm_context.
Thu Apr 6 16:13:54 2017 [Z0][VMM][E]: Error deploying virtual machine: Error copying context ISO to sestserver:/DATASTORE/0/43/disk.1
Thu Apr 6 16:13:54 2017 [Z0][VM][I]: New state is POWEROFF
Thu Apr 6 16:13:54 2017 [Z0][VM][I]: New LCM state is LCM_INIT

Do you have any idea why I am having this problem?