New Question
0

COM Port Permission Denied

asked 2017-06-05 14:45:08 +0300

dev-rowbot gravatar image

Hi,

I am trying to boot a Windows 2012R2 image that I built myself with Packer and add it to our Domain. When installing Cloudbase-Init I pass LOGGINGSERIALPORTNAME=COM1 on the command line.

$p = Start-Process -Wait -PassThru -FilePath msiexec -ArgumentList "/i C:\Windows\Temp\cloudbase-init.msi /qn /l*v C:\Windows\Temp\cloudbase-init.log USERNAME=$username NETWORKADAPTERNAME=""$networkAdapterName"""

I've added a script to the user_data field which will add the server to the domain on boot. The script executes and returns 1001 to trigger a reboot. However, after the reboot there are a lot of errors regarding access to COM1.

cloudbaseinit.utils.log [-] could not open port 'COM1': PermissionError(13, 'Access is denied.', None, 5) _open c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\log.py:71
cloudbaseinit.utils.log [-] could not open port 'COM1': PermissionError(13, 'Access is denied.', None, 5) _open c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\log.py:71
cloudbaseinit.utils.log [-] could not open port 'COM1': PermissionError(13, 'Access is denied.', None, 5) _open c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\log.py:71
cloudbaseinit.utils.log [-] could not open port 'COM1': PermissionError(13, 'Access is denied.', None, 5) _open c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\log.py:71
cloudbaseinit.utils.log [-] could not open port 'COM1': PermissionError(13, 'Access is denied.', None, 5) _open c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\log.py:71
cloudbaseinit.utils.log [-] could not open port 'COM1': PermissionError(13, 'Access is denied.', None, 5) _open c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\log.py:71
cloudbaseinit.shell [-] maximum recursion depth exceeded
cloudbaseinit.shell Traceback (most recent call last):
cloudbaseinit.shell   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\log.py", line 66, in _open
cloudbaseinit.shell     bytesize=int(settings[3]))
cloudbaseinit.shell   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\serial\serialwin32.py", line 31, in __init__
cloudbaseinit.shell     super(Serial, self).__init__(*args, **kwargs)
cloudbaseinit.shell   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\serial\serialutil.py", line 240, in __init__
cloudbaseinit.shell     self.open()
cloudbaseinit.shell   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\serial\serialwin32.py", line 62, in open
cloudbaseinit.shell     raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
cloudbaseinit.shell serial.serialutil.SerialException: could not open port 'COM1': PermissionError(13, 'Access is denied.', None, 5)

This repeats quite a few times and then Cloudbase-Init seems to exit before configuring WinRM and injecting the Administrator password. Trying to get the password returns an empty string as well.

If I remove COM1 from the install command then the execution completes BUT I do not get any log output in Openstack.

Is there any reason why access to COM1 would be denied after adding the server to the domain and rebooting?

My first thoughts were group policy ... (more)

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2017-06-06 13:24:15 +0300

avladu gravatar image

updated 2017-06-07 11:56:07 +0300

Hello,

We have just made a patch in order for cloudbase-init to continue its execution, even if the serial port for logging becomes unavailable. You can use the nightly cloudbase-init installer build to create a new Windows image.

But this won't solve you the real issue you are having. When you join a domain, the cloudbase-init user under which the cloudbase-init service runs will become a local administrator for that computer and it might not have the rights to open a com port. Can you jchange the cloudbase-init user password, log in as that user an try to open a com port?

[Update] I tried to reproduce the error using a Windows 2012 R2 Standard instance added to a newly created AD and I did not get any error related to the COM ports. What version of CloudBase-Init are you using?

Thank you,
Adrian Vladu

edit flag offensive delete link more

Comments

Hi Adrian Thank you for the feedback. I changed the install to use the same user that packer uses during the provisioning since I know for sure this user has local administrator rights and now the COM port works.

dev-rowbot gravatar imagedev-rowbot ( 2017-06-07 11:59:05 +0300 )edit

Great! Glad to be of help.

avladu gravatar imageavladu ( 2017-06-07 12:13:48 +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

Stats

Asked: 2017-06-05 14:45:08 +0300

Seen: 135 times

Last updated: Jun 07