New Question

Local scripts not executed on boot

asked 2017-08-21 12:57:07 +0300

petarbr gravatar image

I am not using any of the services because I am implementing CloudBase with oVirt but that does not correlate with problem.

The problem is that local scripts on Windows server 2012 R2 are not exectured at all!

Because of better view of question I will just put in the post MAIN details of configuration file, log and startup scripts, and full files are on shared dropbox folder


NOTE: I removed unattended conf file and the only one left is *cloudbase-init.conf:*







The output of the cloudbase-init.log is:

2017-08-21 10:00:51.599 1396 DEBUG [-] Creating logon session for user: .\cloudbase-init createuserlogon_session c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\osutils\

2017-08-21 10:00:51.630 1396 DEBUG [-] Executing process as user, command line: ['C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\cloudbase-init', '--config-file', 'C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf', '--noresetservicepassword'] executeprocessas_user c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\osutils\

2017-08-21 10:00:52.505 2028 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin' loadclass c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\ 2017-08-21 10:00:52.521 2028 INFO cloudbaseinit.init [-] Executing plugins for stage 'PRENETWORKING':

2017-08-21 10:00:52.521 2028 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\

2017-08-21 10:00:52.521 2028 INFO cloudbaseinit.init [-] Executing plugins for stage 'PREMETADATADISCOVERY':

2017-08-21 10:00:52.521 2028 ERROR cloudbaseinit.init [-] No metadata service found

2017-08-21 10:00:52.521 2028 INFO cloudbaseinit.init [-] Plugins execution done

2017-08-21 10:00:55.537 2028 DEBUG [-] Stopping service cloudbase-init stop_service c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\osutils\*


And startup batch and PS scripts in C:\IaaS\LocalScripts (the same was not working in default folder C:\Program Files\CloudBase-Solutions..\LocalScripts):


rem cmd

@echo off

net user Administrator /active:yes

For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)

For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b)

echo %mydate% %mytime% >> C:\IaaS\cmdoutput.log

echo "BLA BLA TRUC" >> C:\IaaS\cmdoutput.log

NOTE: For this post and regular representation I added before # backslash (\).



net user Administrator /active:yes

$dt=Get-Date -Format g

Add-Content c:\IaaS\ps1output.log "$dt - CloudBase works!"



net user Administrator /active:yes

$dt=Get-Date -Format g

Add-Content c:\IaaS\ps1output.log "$dt - Test 2 - CloudBase!"

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2017-08-22 19:35:40 +0300

avladu gravatar image


Cloudbase-Init was made as a cloud init system in mind, and most of the functionality (including LocalScripts execution) being executed after the metadata service is loaded. In your case, LocalScriptsPlugin is not executed as it is internally configured to be executed only after one metadata service is loaded.

Do you need this use case for testing (without a metadata service) or for deploying without using a metadata service whatsoever?

Thank you,
Adrian Vladu

edit flag offensive delete link more


Thank you Adrian very much! I must say that I've spent more then 5 days to figure out what is happening and I had the conclusion as you wrote, but I had to be sure because I could not believe that you need metadata services to be active to load local scripts!

petarbr gravatar imagepetarbr ( 2017-08-23 09:55:13 +0300 )edit

Anyway, I handle this in other way (manged by local policies or even easier with Scheduled tasks). The solution which I am implementing is in stage of testing and I hope soon in a few months that will be put in production. CloudBase-init has potentials so I just right now put aside this solution.

petarbr gravatar imagepetarbr ( 2017-08-23 10:00:59 +0300 )edit

We are working to provide a way so that the non metadata dependent plugins can be executed without the metadata service loading requirement. I will let you know when we have a patch for this. Thank you,
Adrian Vladu

avladu gravatar imageavladu ( 2017-08-23 17:14:21 +0300 )edit

@aviadu - any chance this has been corrected yet? If so - in what version of Cloudbase-init ? I am facing the exact same problem where I have LocalScripts - but do not want/have/need any metadata services. I'm not certain if my problem is related to this issue, but it sounds exactly the same.

sygibson gravatar imagesygibson ( 2020-05-10 23:35:49 +0300 )edit

There is now a way to do it, by using the EmptyMetadataService, which is a NOOP like metadata service implementation. You can use the stable or beta version.

avladu gravatar imageavladu ( 2020-05-12 18:25:49 +0300 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-08-21 12:57:07 +0300

Seen: 2,798 times

Last updated: Aug 22 '17