Azure / azure-linux-extensions

Linux Virtual Machine Extensions for Azure
Apache License 2.0
304 stars 253 forks source link

OS Patching Extension for Centos 7.3 does not work #373

Open AbdulMuqeet123 opened 7 years ago

AbdulMuqeet123 commented 7 years ago

Problem with the extension Microsoft.OSTCExtensions.OSPatchingForLinux The configuration is : 'publicSettings': {'category': 'ImportantAndRecommended', 'dayOfWeek': 'Tuesday', 'rebootAfterPatch': 'Auto', 'intervalOfWeeks': '3', 'stop': false, 'vmStatusTest': {'local': false, 'idleTestScript': '', 'healthyTestScript': ''}, 'disabled': false, 'installDuration': '01:00', 'oneoff': false, 'startTime': '03:00'}, It does not work, server does not get updated.

The template is being deployed using the template option in Azure portal. ##################################

cat /etc/rel

CentOS Linux release 7.3.1611 (Core) Derived from Red Hat Enterprise Linux 7.3 (Source) NAME='CentOS Linux' VERSION='7 (Core)' ID='centos' ID_LIKE='rhel fedora' VERSION_ID='7' PRETTY_NAME='CentOS Linux 7 (Core)' ANSI_COLOR='0;31' CPE_NAME='cpe:/o:centos:centos:7' HOME_URL='https://www.centos.org/' BUG_REPORT_URL='https://bu [Uploading extension.txt…]() [Uploading waagent.txt…]()

gs.centos.org/' CENTOS_MANTISBT_PROJECT='CentOS-7' CENTOS_MANTISBT_PROJECT_VERSION='7' REDHAT_SUPPORT_PRODUCT='centos' REDHAT_SUPPORT_PRODUCT_VERSION='7' cat: /etc/prelink.conf.d: Is a directory CentOS Linux release 7.3.1611 (Core) CentOS Linux release 7.3.1611 (Core) cpe:/o:centos:centos:7 ~]# uname -a Linux test1 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec 6 23:06:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux**** #################################### /var/log/azure/Microsoft.OSTCExtensions.OSPatchingForLinux/2.3.0.1/extension.log 2017/03/30 18:03:35 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]sequence number is 0 2017/03/30 18:03:35 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]setting file path is/var/lib/waagent/Microsoft.OSTCExtensions.OSPatchingForLin ux-2.3.0.1/config/0.settings 2017/03/30 18:03:35 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]JSON config: {'runtimeSettings': [{'handlerSettings': {'protectedSettings': 'M IIB4AYJKoZIhvcNAQcDoIIB0TCCAc0CAQAxggFpMIIBZQIBADBNMDkxNzA1BgoJkiaJk/IsZAEZFidXaW5kb3dzIEF6dXJlIENSUCBDZXJ0aWZpY2F0ZSBHZW5lcmF0b3ICEHwpRo936maARatE UAJ+GuQwDQYJKoZIhvcNAQEBBQAEggEACpf/yLDV4aQanc3e3D29ZuYz2COSVeEsnsOU2Hvntx2VDTSMfUcM5JE1pbUU1hUol0nqnnt6NjaOFmTo7WI6qFFFDO1F+gCzoCzsuGBzRMx3cWA2vVk nWqYvNvhn6gesQtNmJCslIwMCfPzIM57jE9RQX5FRwH+cD5fj1vceEbecuMaFxvpVDk2zO0+CQXsLRe97kBDyP8VfELJt/hsSQgpYtAZQw7clwCS2+prFsKA7ZbcCfuifr2aNj3TsakFpYf3CRh CMcpMcfSbsaqEW36Wh9j0ghcizAF7BhrtONUlfnVD2xgdggTPqEjy5dW6pBsM9yNs0qP6vi+Q7Sy4c0jBbBgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECKLGwZibaxOdgDjrw7u2co+0koeYuCCGe o8BcYpAD1FrC3vC0pV6sP7Al+nOdZsfg1FLdniuD2CZu2WTupESAEIlxA==', 'publicSettings': {'category': 'ImportantAndRecommended', 'dayOfWeek': 'Everyday', 'r ebootAfterPatch': 'Auto', 'intervalOfWeeks': '1', 'stop': false, 'vmStatusTest': {'local': false, 'idleTestScript': '', 'healthyTestScript': ''}, ' disabled': false, 'installDuration': '01:00', 'oneoff': false, 'startTime': '14:00'}, 'protectedSettingsCertThumbprint': '1FB5AA9625693206C022700C2 70BE6DD3A829993'}}]} 2017/03/30 18:03:35 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]Config decoded correctly. 2017/03/30 18:03:35 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]The value of parameter 'distUpgradeAll' is empty or invalid. Set it false by d efault. 2017/03/30 18:03:35 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]The extension will reserve 5 minutes for reboot. 2017/03/30 18:03:35 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]The extension will run in scheduled task mode. 2017/03/30 18:03:35 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]Current Configuration: category=importantandrecommended,dayOfWeek=Everyday,dis tUpgradeAll=False,intervalOfWeeks=1,stop=False,disabled=False,installDuration=01:00,rebootAfterPatch=auto,oneoff=False,startTime=14:00 extension.txt waagent.txt

2017/03/30 18:03:35 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]Current sequence number, 0, is not greater than the sequnce number of the most recent executed configuration. Exiting... ##################################

cat /etc/crontab

*# user-name command to be executed* 0 13 [1, 2, 3, 4, 5, 6, 7] root cd /var/lib/waagent/Microsoft.OSTCExtensions.OSPatchingForLinux-2.3.0.1 && python check.py 1 && python handler.py -download > /dev/null 2>&1 0 14 [1, 2, 3, 4, 5, 6, 7] root cd /var/lib/waagent/Microsoft.OSTCExtensions.OSPatchingForLinux-2.3.0.1 && python check.py 1 && python handler.py -patch >/dev/null 2>&1 1 14 * [1, 2, 3, 4, 5, 6, 7] root rm -f /var/lib/waagent/Microsoft.OSTCExtensions.OSPatchingForLinux-2.3.0.1/StopOSPatching #################################### Size at 0 for file /scheduled/history [Uploading extension.txt…]()

ls -l /var/lib/waagent/Microsoft.OSTCExtensions.OSPatchingForLinux-2.3.0.1/scheduled/history -rwxr--r--. 1 root root 0 Mar 30 13:40 /var/lib/waagent/Microsoft.OSTCExtensions.OSPatchingForLinux-2.3.0.1/scheduled/history

AbdulMuqeet123 commented 7 years ago

extension.txt waagent.txt

AbdulMuqeet123 commented 7 years ago

Tried with the below PowerShell commands on the same Centos 7.3 version of VM following the below link https://github.com/Azure/azure-linux-extensions/tree/master/OSPatching

Extension gets successfully installed and after the specified time it shows the "Patching succeeded" in the portal but there were no patches applied nor the machine got rebooted.

Please suggest

$RGName = '' $VmName = '' $Location = ''

$ExtensionName = 'OSPatchingForLinux' $Publisher = 'Microsoft.OSTCExtensions' $Version = '2.0'

$PublicConf = ConvertTo-Json -InputObject @{ "disabled" = $false; "stop" = $false; "rebootAfterPatch" = "Auto"; "category" = "ImportantAndRecommended"; "installDuration" = "01:00"; "oneoff" = $false; "intervalOfWeeks" = "1";

"dayOfWeek" = "Thursday";
"startTime" = "11:05";
"vmStatusTest" = (@{
    "local" = $false;
    "idleTestScript" = "<Path to Idle script>";
    "healthyTestScript" = "<Path to healthy Script>";
})

}

Optional

If you use azure storage, you have to offer the key

$PrivateConf = ConvertTo-Json -InputObject @{ "storageAccountName" = ""; "storageAccountKey" = "" }

Set-AzureRmVMExtension -ResourceGroupName $RGName -VMName $VmName -Location $Location -Name $ExtensionName -Publisher $Publisher -ExtensionType $ExtensionName -TypeHandlerVersion $Version -Settingstring $PublicConf -ProtectedSettingString $PrivateConf

AbdulMuqeet123 commented 7 years ago

Tested for the Ubuntu 16 version of VM "oneoff " patching works as expected but schedules patches does not

2017/04/28 14:55:02 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]No packages are available for update. 2017/04/28 14:55:02 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]No packages are available for update. (Category:importantandrecommended) 2017/04/28 14:55:02 [Microsoft.OSTCExtensions.OSPatchingForLinux-1.0]Enable,success,0,Patch Succeeded. Current Configuation: category=importantandrecommended,dayOfWeek=Friday,distUpgradeAll=False,intervalOfWeeks=1,stop=False,disabled=False,installDuration=01:00,rebootAfterPatch=auto,oneoff=False,startTime=14:55

Though the Linux machines has some packages to update but after configuring the scheduled patching the messages shows "No packages are available for update".