New Question

Revision history [back]

click to hide/show revision 1
initial version

COM Port Permission Denied

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 but there do not seem to be any COM specific settings in the Organisations GPO. I also assume Administrator can access COM ports - I can log in as other users and open/close COM1 with no issues.