# Cannot create image from path

**URL:** <https://forum.opennebula.io/t/cannot-create-image-from-path/2605>\
**Category:** Product Support\
**Created:** [July 20, 2016, 2:28pm UTC](https://forum.opennebula.io/t/cannot-create-image-from-path/2605 "2016-07-20T14:28:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![silbogg](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@silbogg](https://forum.opennebula.io/u/silbogg)\
**Post date:** [July 20, 2016, 2:28pm UTC](https://forum.opennebula.io/t/cannot-create-image-from-path/2605/1 "2016-07-20T14:28:01Z")

</div>

Hi,

I have a qcow2 image on an external drive which is mounted as /mnt/sdh1  
ownership is oneadmin:oneadmin and i can manually copy the file to /var/lib/one/datastores while logged in as oneadmin. But through sunstone it gives error:  
“Error copying image in the datastore: Not allowed to copy image file /mnt/sdh1/cld\_transfer/xxxx.qcow2”

oned.log:  
Wed Jul 20 17:18:57 2016 [Z0][ImM][I]: Copying /mnt/sdh1/cld\_transfer/xxxx.qcow2 to repository for image 48  
Wed Jul 20 17:18:57 2016 [Z0][ReM][D]: Req:7920 UID:0 ImageAllocate result SUCCESS, 48  
Wed Jul 20 17:18:57 2016 [Z0][AuM][D]: Message received: AUTHENTICATE SUCCESS 588 -

Wed Jul 20 17:18:57 2016 [Z0][ReM][D]: Req:9328 UID:0 ImageInfo invoked , 48  
Wed Jul 20 17:18:57 2016 [Z0][ReM][D]: Req:9328 UID:0 ImageInfo result SUCCESS, "48\<U…"  
Wed Jul 20 17:18:58 2016 [Z0][ReM][D]: Req:432 UID:0 ImagePoolInfo invoked , -2, 0, -2000, -1  
Wed Jul 20 17:18:58 2016 [Z0][ReM][D]: Req:432 UID:0 ImagePoolInfo result SUCCESS, "\<IMAGE\_POOL\>\<…"  
Wed Jul 20 17:18:58 2016 [Z0][ImM][I]: Command execution fail: /var/lib/one/remotes/datastore/fs/cp PERTX0RSSVZFUl9BQ1RJT05fREFUQT48SU1BR0U+PElEPjQ4PC9JRD48V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+MTU8L0lEPjxJRD4xOTwvSUQ+PElEPjIwPC9JRD48SUQ+MjE8L0lEPjxJRD4yMjwvSUQ+PElEPjIzPC9JRD48SUQ+MjQ8L0lEPjxJRD4yNTwvSUQ+PElEPjI2PC9JRD48SUQ+Mjc8L0lEPjxJRD4yODwvSUQ+PElEPjI5PC9JRD48SUQ+MzA8L0lEPjxJRD4zMTwvSUQ+PElEPjMyPC9JRD48SUQ+MzM8L0lEPjxJRD4zNDwvSUQ+PElEPjM3PC9JRD48SUQ+Mzg8L0lEPjxJRD4zOTwvSUQ+PElEPjQwPC9JRD48SUQ+NDE8L0lEPjxJRD40MjwvSUQ+PElEPjQzPC9JRD48SUQ+NDQ8L0lEPjwvSU1BR0VTPjxURU1QTEFURT48Q0xPTkVfVEFSR0VUPjwhW0NEQVRBW1NZU1RFTV1dPjwvQ0xPTkVfVEFSR0VUPjxESVNLX1RZUEU+PCFbQ0RBVEFbRklMRV1dPjwvRElTS19UWVBFPjxEU19NQUQ+PCFbQ0RBVEFbZnNdXT48L0RTX01BRD48TE5fVEFSR0VUPjwhW0NEQVRBW05PTkVdXT48L0xOX1RBUkdFVD48UkVTVFJJQ1RFRF9ESVJTPjwhW0NEQVRBWy9dXT48L1JFU1RSSUNURURfRElSUz48U0FGRV9ESVJTPjwhW0NEQVRBWy92YXIvdG1wXV0+PC9TQUZFX0RJUlM+PFRNX01BRD48IVtDREFUQVtxY293Ml1dPjwvVE1fTUFEPjwvVEVNUExBVEU+PC9EQVRBU1RPUkU+PC9EU19EUklWRVJfQUNUSU9OX0RBVEE+ 48  
Wed Jul 20 17:18:58 2016 [Z0][ImM][E]: cp: Not allowed to copy images from /var/lib/one/ /etc/one/ /var/lib/one/ /  
Wed Jul 20 17:18:58 2016 [Z0][ImM][E]: Not allowed to copy image file /mnt/sdh1/cld\_transfer/xxxx.qcow2  
Wed Jul 20 17:18:58 2016 [Z0][ImM][I]: ExitCode: 255  
Wed Jul 20 17:18:58 2016 [Z0][ImM][E]: Error copying image in the datastore: Not allowed to copy image file /mnt/sdh1/cld\_transfer/xxxx.qcow2

[root@node01 cld\_transfer]# pwd  
/mnt/sdh1/cld\_transfer  
[root@node01 cld\_transfer]# ll -a  
total 19729984  
drwxr-xr-x 2 oneadmin oneadmin 40 Jul 20 16:43 .  
drwxr-xr-x 3 oneadmin oneadmin 25 Jul 20 16:42 …  
-rwxr-xr-x 1 oneadmin oneadmin 20203503616 Jul 20 16:53 xxxx.qcow2

Any idea what i’m missing and how to fix it?

Thanks,  
Orhan

---

<div class="post-metadata">

**Author:** ![silbogg](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@silbogg](https://forum.opennebula.io/u/silbogg)\
**Post date:** [July 20, 2016, 2:58pm UTC](https://forum.opennebula.io/t/cannot-create-image-from-path/2605/2 "2016-07-20T14:58:57Z")

</div>

changed mountpoint and tried through CLI:  
[oneadmin@node01 ~]$ oneimage create -d 101 --name Clog\_test --type OS --prefix hd --driver qcow2 --path /home/aktarim/cld\_transfer/xxxx.qcow2 --persistent

but no luck… the very same error again…

[oneadmin@node01 ~]$ onedatastore list  
ID NAME SIZE AVAIL CLUSTERS IMAGES TYPE DS TM STAT  
100 nfs\_system 3.8T 85% 0 0 sys - shared on  
101 nfs\_images 3.8T 85% 0 33 img fs qcow2 on

---

<div class="post-metadata">

**Author:** ![silbogg](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@silbogg](https://forum.opennebula.io/u/silbogg)\
**Post date:** [July 20, 2016, 3:14pm UTC](https://forum.opennebula.io/t/cannot-create-image-from-path/2605/3 "2016-07-20T15:14:32Z")

</div>

It’s somehow incorrectly assuming the image source location as a RESTRICTED\_DIRS. As a way around I’ve had to change the control line in the code: `check_restricted $SRC` -eq 1

And it worked… Fyi…

Kind regards,  
Orhan

---

<div class="post-metadata">

**Author:** ![cmartin](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/cmartin/32/4278_2.png) [@cmartin](https://forum.opennebula.io/u/cmartin)\
**Post date:** [July 20, 2016, 4:30pm UTC](https://forum.opennebula.io/t/cannot-create-image-from-path/2605/4 "2016-07-20T16:30:59Z")

</div>

Hi,

> [@silbogg](#):
>
> It’s somehow incorrectly assuming the image source location as a RESTRICTED\_DIRS. As a way around I’ve had to change the control line in the code: check\_restricted $SRC -eq 1

The way I see it, check\_restricted is working as it should. It looks like your datastore has RESTRICTED\_DIRS set to “/”, the default value.

---

<div class="post-metadata">

**Author:** ![kosha79](https://avatars.discourse-cdn.com/v4/letter/k/41988e/32.png) [@kosha79](https://forum.opennebula.io/u/kosha79)\
**Post date:** [July 21, 2016, 8:01am UTC](https://forum.opennebula.io/t/cannot-create-image-from-path/2605/5 "2016-07-21T08:01:28Z")

</div>

Hello,  
Have a similar problem,

Error executing image transfer script: Error copying opennebula:/var/lib/one//datastores/1/290167b06398c9b40e59d76228b9bd5f to 192.168.0.151:/var/lib/one//datastores/0/0/disk.0

I have used 192.168.0.151 as a node-kvm, and the rule ssh-copy image.

Well, the problem was the level right the /var/lib/one/.ssh directory  
and /var/lib/one/.ssh/authrized\_keys

Do it on the all servers

-rwxr–r-- 1 oneadmin oneadmin 401 июл 18 17:17 authorized\_keys  
-rw------- 1 oneadmin oneadmin 1679 июл 18 17:16 id\_rsa  
-rw-r–r-- 1 oneadmin oneadmin 401 июл 18 17:16 id\_rsa.pub  
-rw-r–r-- 1 oneadmin oneadmin 376 июл 20 17:51 known\_hosts

with b.r, Ilya

---

<div class="post-metadata">

**Author:** ![silbogg](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@silbogg](https://forum.opennebula.io/u/silbogg)\
**Post date:** [July 21, 2016, 8:49am UTC](https://forum.opennebula.io/t/cannot-create-image-from-path/2605/6 "2016-07-21T08:49:50Z")

</div>

Hi Carlos,

Yes you’re right, onedatastore show 101:  
DATASTORE TEMPLATE  
CLONE\_TARGET="SYSTEM"  
DISK\_TYPE="FILE"  
DS\_MAD="fs"  
LN\_TARGET=“NONE"  
RESTRICTED\_DIRS=”/“  
SAFE\_DIRS=”/var/tmp"  
TM\_MAD="qcow2"  
TYPE=“IMAGE\_DS”

The warning mentions only about /var/lib/one but setting the default value to / makes impossible to use local path. I think it’d be better to set /var/lib/one.

Thanks,  
Orhan

---

<div class="post-metadata">

**Author:** ![jojo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/jojo/32/4953_2.png) [@jojo](https://forum.opennebula.io/u/jojo)\
**Post date:** [January 25, 2017, 11:56am UTC](https://forum.opennebula.io/t/cannot-create-image-from-path/2605/7 "2017-01-25T11:56:45Z")

</div>

Hi Carlos,  
I have to agree that the default value of “/” is not a very useful choice. If for security reasons you decided to use this path, then at least the error message in oned.log should state something more obvious than “Not allowed to copy image file” maybe something like “this is a restricted path, if you want to allow it, you can do so in your datastore configuration” or something alike. other idea would be to mention in the gui that uploading is only allowed from /var/tmp.  
right now, it’s far from intuitive 😉  
thanks for considering  
hope that helps  
Jojo

---

<div class="post-metadata">

**Author:** ![darkfader](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/darkfader/32/4769_2.png) [@darkfader](https://forum.opennebula.io/u/darkfader)\
**Post date:** [May 17, 2017, 10:40am UTC](https://forum.opennebula.io/t/cannot-create-image-from-path/2605/8 "2017-05-17T10:40:42Z")

</div>

I think everyone would appreciate a more specific error message.  
I was looking for an NFS permission issue for a long time.

---

<div class="post-metadata">

**Author:** ![majid\_rajabi](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/majid_rajabi/32/7212_2.png) [@majid\_rajabi](https://forum.opennebula.io/u/majid_rajabi)\
**Post date:** [November 15, 2021, 2:31pm UTC](https://forum.opennebula.io/t/cannot-create-image-from-path/2605/9 "2021-11-15T14:31:54Z")

</div>

There is SAFE\_DIRS="/var/tmp" that you can put your file there to load without a problem.
