Azure / azure-linux-extensions

Linux Virtual Machine Extensions for Azure
Apache License 2.0
308 stars 254 forks source link

[Ubuntu 16.04] Unable to encrypt VM #783

Open l0nedigit opened 5 years ago

l0nedigit commented 5 years ago

VM Size: Standard D4s v3 (4 vcpus, 16 GB memory) OS: Ubuntu 16.04 LTS (30gb OS Disk) Region: West US

Error:

"statusMessage": "{\"status\":\"Failed\",\"error\":{\"code\":\"ResourceOperationFailure\",\"message\":\"The resource operation completed with terminal provisioning state 'Failed'.\",\"details\":[{\"code\":\"VMExtensionProvisioningError\",\"message\":\"VM has reported a failure when processing extension 'AzureDiskEncryptionForLinux'. Error message: \\"Failed to encrypt OS volume with error: 'NoneType' object has no attribute 'getFlag', stack trace: Traceback (most recent call last):\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/main/handle.py\\", line 1633, in daemon_encrypt\n os_encryption.start_encryption()\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/main/oscrypto/ubuntu_1604/Ubuntu1604EncryptionStateMachine.py\\", line 191, in start_encryption\n self.enter_split_root_partition()\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/transitions/transitions/core.py\\", line 222, in trigger\n return self.machine.process(f)\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/transitions/transitions/core.py\\", line 526, in process\n return trigger()\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/transitions/transitions/core.py\\", line 247, in _trigger\n if t.execute(event):\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/transitions/transitions/core.py\\", line 148, in execute\n self._change_state(event_data)\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/transitions/transitions/core.py\\", line 159, in _change_state\n event_data.machine.get_state(self.dest).enter(event_data)\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/transitions/transitions/core.py\\", line 48, in enter\n event_data.machine.callback(oe, event_data)\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/transitions/transitions/core.py\\", line 518, in callback\n func(*event_data.args, **event_data.kwargs)\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/main/oscrypto/ubuntu_1604/Ubuntu1604EncryptionStateMachine.py\\", line 114, in on_enter_state\n super(Ubuntu1604EncryptionStateMachine, self).on_enter_state()\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/main/oscrypto/OSEncryptionStateMachine.py\\", line 65, in on_enter_state\n self.state_objs[self.state].enter()\n File \\"/var/lib/waagent/Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.1.0.30/main/oscrypto/ubuntu_1604/encryptstates/SplitRootPartitionState.py\\", line 157, in enter\n if (root_partition.getFlag(parted.PARTITION_BOOT)):\nAttributeError: 'NoneType' object has no attribute 'getFlag'\n, machine state: split_root_partition\\".\"}]}}"

},

Steps to reproduce:

  1. Create an Ubuntu 16 VM as usual

  2. Once machine is created successfully, stop and deallocate the VM

  3. Resize the OS disk from within the portal

  4. Start the VM

  5. Verify disk resized (Ubuntu does it automatically) by ssh in and run df -h

  6. From Azure CLI: az vm encryption enable --resource-group "myResourceGroup" --name "myVmName" --disk-encryption-keyvault "myKeyVaultRG" --volume-type All

I've also tried encrypting using the old ADE method with AAD creds with no luck. Any input or help is appreciated. Thank you. Oddly enough, encryption was working fine prior to today.

davidlbyrne commented 5 years ago

Ame problem here!

l0nedigit commented 5 years ago

Hey David, I'd like to mention that for a quick work around, I was able to encrypt Ubuntu 18.04 LTS. No issues.

Would like to know what's up with the 16.04 LTS support though.

On Mon, Apr 15, 2019, 3:42 PM David Byrne notifications@github.com wrote:

Ame problem here!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Azure/azure-linux-extensions/issues/783#issuecomment-483390383, or mute the thread https://github.com/notifications/unsubscribe-auth/AXpgE1xq0T03CzKK0ImiNIsKRvti8f3Tks5vhNYUgaJpZM4crNvF .

davidlbyrne commented 5 years ago

I'm getting this error with the same 16.04.6 LTS :

[Microsoft.Azure.Security.AzureDiskEncryptionForLinux-1.0]: 4468: [Error] Failed to update encryption settings with error: coercing to Unicode: need string or buffer, NoneType found, stack trace: Traceback (most recent call last): 2019/04/15 19:40:37 File "main/handle.py", line 313, in update_encryption_settings 2019/04/15 19:40:37 shutil.copy(existing_passphrase_file, encryption_environment.bek_backup_path) 2019/04/15 19:40:37 File "/usr/lib/python2.7/shutil.py", line 119, in copy 2019/04/15 19:40:37 copyfile(src, dst) 2019/04/15 19:40:37 File "/usr/lib/python2.7/shutil.py", line 68, in copyfile 2019/04/15 19:40:37 if _samefile(src, dst): 2019/04/15 19:40:37 File "/usr/lib/python2.7/shutil.py", line 58, in _samefile 2019/04/15 19:40:37 return os.path.samefile(src, dst) 2019/04/15 19:40:37 File "/usr/lib/python2.7/posixpath.py", line 155, in samefile 2019/04/15 19:40:37 s1 = os.stat(f1) 2019/04/15 19:40:37 TypeError: coercing to Unicode: need strin