Understanding init scripts Opennebula (Files for VM)

hello,

I am wondering if anyone can help with understanding how the files section of a VM template works.

I ussually used the startup script which worked fine, but for a common startup script I would prefer to attach this as a file.

I have created init.sh and uploaded it, I have then typed in the name init.sh for the VM’s file.

When the VM boots it doesn’t run the init.sh file (I have tested the script works fine).

Am I doing something wrong with this?

EDIT: i can see its trying to access this file

/var/log/syslog

Jul 9 10:37:43 Test one-contextd[1487]: chmod: cannot access ‘/tmp/one-context. 6M7wqE/init.sh’: No such file or directory

VM config

File in datastore

Hello @kingbuffalo

I tested and it works for me, could you please send me the template and oneimage show init.sh -x so I can help you.

Thanks, output is here:

bash-4.2$ oneimage show init.sh -x

135
0
105
oneadmin
SHARED_TEMPLATES
init.sh

<OWNER_U>1</OWNER_U>
<OWNER_M>1</OWNER_M>
<OWNER_A>1</OWNER_A>
<GROUP_U>1</GROUP_U>
<GROUP_M>1</GROUP_M>
<GROUP_A>1</GROUP_A>
<OTHER_U>1</OTHER_U>
<OTHER_M>1</OTHER_M>
<OTHER_A>1</OTHER_A>

5
<DISK_TYPE>0</DISK_TYPE>
0
1562667715

1 1 0 0 -1 -1 2 files

Try to give execution permission (chmod u+x init.sh) before uploading it to OpenNebula and then upload it and test again.

Thanks I’ll give that a go , I created the .sh in sublime on windows so no Unix permissions will have been set , surely opennebula would chnod the file on upload ?

It depends on your datastore tm_mad, but it will copy the file as it is.