Skip to content

Error: Install failed with error: local variable 'h_settings' referenced before assignment #189

@hamdrew

Description

@hamdrew

The Microsoft.GuestConfiguration.ConfigurationforLinux extension is suddenly failing to install on our Ubuntu 22.04 VMs.

The version being installed is 1.26.96 but this doesn't appear to be a documented release: Extension for Linux extension release notes

Error Log

The handler for VM extension type 'Microsoft.GuestConfiguration.ConfigurationforLinux' has reported terminal failure for VM extension 'AzurePolicyforLinux' with error message:  
[ExtensionOperationError] Non-zero exit code: 1,  
/var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.96/guest-configuration-shim gc_extension.py install  
  
[stdout]  
Linux distribution version is 22.04.  
Linux distribution is Ubuntu.  
Python 3.10.12 + python3 /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.96/gc_extension.py install  
Importing utils failed with error: waagent2.0 doesn't support python3  
Unable to initialize waagent log because of exception name 'waagent' is not defined  
Info: ConfigurationforLinux started to handle.  
Error: Unable to load handler settings from /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.96/config/0.settings  
Error: Install failed with error: local variable 'h_settings' referenced before assignment  
  
Stacktrace:  
Traceback (most recent call last):  
  File "/var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.96/gc_extension.py", line 134, in main  
    exit_code, output = operations[operation]()  
  File "/var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.96/gc_extension.py", line 175, in install  
    public_settings, protected_settings = get_settings()  
  File "/var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.96/gc_extension.py", line 321, in get_settings  
    if ('protectedSettings' in h_settings  
UnboundLocalError: local variable 'h_settings' referenced before assignment  
  
Error: Install failed with error: local variable 'h_settings' referenced before assignment  
  
Stacktrace:  
Traceback (most recent call last):  
  File "/var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.96/gc_extension.py", line 134, in main  
    exit_code, output = operations[operation]()  
  File "/var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.96/gc_extension.py", line 175, in install  
    public_settings, protected_settings = get_settings()  
  File "/var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.96/gc_extension.py", line 321, in get_settings  
    if ('protectedSettings' in h_settings  
UnboundLocalError: local variable 'h_settings' referenced before assignment  
  
[stderr]  
Running scope as unit: install_7aec8806-022f-4304-b9c4-5d92effade1a.scope  
  
Install handler failed for the extension.  
More information on troubleshooting is available at https://aka.ms/vmextensionlinuxtroubleshoot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions