Skip to content

core/dns: tolerate unattended-upgrade held-back packages on FDE/Ubunt… - #4626

Open
SRIKKANTH wants to merge 2 commits into
mainfrom
smyakam/verify_dns_name_resolution_after_upgrade/2026_08_02
Open

core/dns: tolerate unattended-upgrade held-back packages on FDE/Ubunt…#4626
SRIKKANTH wants to merge 2 commits into
mainfrom
smyakam/verify_dns_name_resolution_after_upgrade/2026_08_02

Conversation

@SRIKKANTH

@SRIKKANTH SRIKKANTH commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

…u Pro images

verify_dns_name_resolution_after_upgrade failed with a false negative on Ubuntu 22.04 FDE Confidential VM images. unattended-upgrade -d -v returns a non-zero exit code whenever it holds back a package (conffile prompt, blacklisted or pinned package such as ubuntu-pro-client / ubuntu-advantage- tools), even though it prints "All upgrades installed" and every applicable upgrade — including the linux-*-azure-fde kernel stack — installed cleanly.

_upgrade_system() treated any non-zero exit as fatal and raised LisaException, failing the case even though DNS resolution succeeded at every checkpoint and the VM rebooted into the new kernel.

Fix: on a non-zero exit, treat the run as success when stdout contains "All upgrades installed" and no genuine apt/dpkg error marker is present (dpkg: error, E:, Errors were encountered, not fully installed, dpkg sub- process error). Only raise LisaException on a real error. A non-fatal held-back condition is now logged at INFO.

Description

Related Issue

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation update

Checklist

  • Description is filled in above
  • No credentials, secrets, or internal details are included
  • Peer review requested (if not, add required peer reviewers after raising PR)
  • Tests executed and results posted below

Test Validation

Key Test Cases:

Impacted LISA Features:

Tested Azure Marketplace Images:

  • canonical 0001-com-ubuntu-confidential-vm-jammy 22_04-lts-cvm 22.04.202307140

Test Results

Image VM Size Result
canonical 0001-com-ubuntu-confidential-vm-jammy 22_04-lts-cvm 22.04.202307140 Standard_DC2as_v6 PASSED

Copilot AI review requested due to automatic review settings August 3, 2026 03:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the DNS core test suite’s Debian/Ubuntu upgrade step to avoid false negatives when unattended-upgrade -d -v exits non-zero due to held-back packages (common on Ubuntu Pro/FDE images), while still failing on genuine apt/dpkg errors.

Changes:

  • Add regex markers to distinguish “upgrade completed” output from real apt/dpkg failure output.
  • Change _upgrade_system() to treat certain non-zero unattended-upgrade exits as non-fatal when output indicates upgrades were successfully applied.

Comment thread lisa/microsoft/testsuites/core/dns.py
Copilot AI review requested due to automatic review settings August 3, 2026 03:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

lisa/microsoft/testsuites/core/dns.py:183

  • The raised LisaException message is too generic for troubleshooting. Including the exit code and a concrete next step (inspect stdout/stderr for apt/dpkg errors) would make failures actionable, especially now that non-zero exits can be non-fatal in some cases.
                    raise LisaException(
                        "fail to run apt update && unattended-upgrade -d -v"
                    )

node.mark_dirty()
raise LisaException(
"fail to run apt update && unattended-upgrade -d -v"
combined_output = (result.stdout or "") + (result.stderr or "")
@LiliDeng

LiliDeng commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

AI Test Case Selection

Selected 87 test case(s): verify_default_targetpw,verify_grub,verify_network_manager_not_installed,verify_network_file_configuration,verify_ifcfg_eth0,verify_udev_rules_moved,verify_dhcp_file_configuration,verify_yum_conf,verify_os_update,verify_hv_kvp_daemon_installed,verify_repository_installed,verify_serial_console_is_enabled,verify_bash_history_is_empty,verify_boot_error_fail_warnings,verify_cloud_init_error_status,verify_client_active_interval,verify_no_pre_exist_users,verify_resource_disk_readme_file,verify_resource_disk_file_system,verify_waagent_version,verify_python_version,verify_openssl_version,verify_azure_64bit_os,verify_omi_version,verify_no_swap_on_osdisk,verify_essential_kernel_modules,verify_boot_with_debug_kernel,verify_l3_cache,verify_cpu_count,verify_vmbus_interrupts,verify_enable_kprobe,verify_dhcp_client_timeout,verify_floppy_module_is_blacklisted,verify_gdb,verify_lis_modules_version,verify_initrd_modules,verify_hyperv_modules,verify_reload_hyperv_modules,verify_kvp,verify_vmbus_devices_channels_bsd,verify_vmbus_devices_channels,verify_vmbus_heartbeat_properties,verify_hyperv_platform_id,verify_deployment_provision_synthetic_nic,verify_deployment_provision_standard_ssd_disk,verify_deployment_provision_ephemeral_managed_disk,verify_deployment_provision_premium_disk,verify_deployment_provision_premiumv2_disk,verify_deployment_provision_sriov,verify_reboot_in_platform,verify_deployment_provision_ultra_datadisk,verify_stop_start_in_platform,verify_deployment_provision_swiotlb_force,verify_sched_core_basic,verify_serial_console,verify_disks_device_timeout_setting,verify_resource_disk_mounted,verify_swap,verify_resource_disk_io,verify_scsi_disk_controller_type,verify_nvme_disk_controller_type,verify_os_partition_identifier,verify_hot_add_disk_serial,verify_hot_add_disk_serial_standard_ssd,verify_hot_add_disk_serial_premium_ssd,verify_hot_add_disk_parallel,verify_hot_add_disk_parallel_standard_ssd,verify_hot_add_disk_serial_random_lun_standard_ssd,verify_hot_add_disk_serial_random_lun_premium_ssd,verify_hot_add_disk_parallel_premium_ssd,verify_nfsv4_basic,verify_smb_linux,verify_cifs_basic,verify_timesync_ptp,verify_timesync_unbind_clocksource,verify_timesync_unbind_clockevent,verify_timesync_ntp,verify_timesync_chrony,verify_pmu_disabled_for_arm64,verify_timedrift_corrected,verify_vdso,verify_vm_hot_resize,verify_vm_hot_resize_decrease,verify_vm_resize_increase,verify_vm_resize_decrease,verify_zram_crypto_zstd,verify_zram_crypto_lz4

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Result: Failed

View full logs in Azure DevOps

SRIKKANTH and others added 2 commits August 3, 2026 13:37
…u Pro images

verify_dns_name_resolution_after_upgrade failed with a false negative on
Ubuntu 22.04 FDE Confidential VM images. `unattended-upgrade -d -v` returns
a non-zero exit code whenever it holds back a package (conffile prompt,
blacklisted or pinned package such as ubuntu-pro-client / ubuntu-advantage-
tools), even though it prints "All upgrades installed" and every applicable
upgrade — including the linux-*-azure-fde kernel stack — installed cleanly.

_upgrade_system() treated any non-zero exit as fatal and raised LisaException,
failing the case even though DNS resolution succeeded at every checkpoint and
the VM rebooted into the new kernel.

Fix: on a non-zero exit, treat the run as success when stdout contains
"All upgrades installed" and no genuine apt/dpkg error marker is present
(dpkg: error, E:, Errors were encountered, not fully installed, dpkg sub-
process error). Only raise LisaException on a real error. A non-fatal
held-back condition is now logged at INFO.

Work item: 63384991
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 3, 2026 08:08
@SRIKKANTH
SRIKKANTH force-pushed the smyakam/verify_dns_name_resolution_after_upgrade/2026_08_02 branch from 9592b46 to ea223e7 Compare August 3, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (3)

lisa/microsoft/testsuites/core/dns.py:162

  • combined_output concatenates stdout and stderr without a separator, which can merge the last line of stdout with the first line of stderr and break re.M line-anchored matching. Add a newline delimiter between the streams.
                combined_output = (result.stdout or "") + (result.stderr or "")

lisa/microsoft/testsuites/core/dns.py:54

  • The real-error regex only matches apt errors that start with E: (with a trailing space). apt often emits E: with no space (e.g. E:Unable to locate package ...), which would bypass has_real_error and could incorrectly treat a genuine failure as a held-back success.
    _upgrade_real_error_pattern = re.compile(
        r"^(?:dpkg: error|E: |Errors were encountered)|"
        r"not fully installed|"
        r"Sub-process /usr/bin/dpkg returned an error",
        re.M,

lisa/microsoft/testsuites/core/dns.py:183

  • The raised LisaException message here is very generic and doesn’t include the exit code or guidance on what to check next. Since this branch is specifically for real apt/dpkg failures, include result.exit_code and a short investigation hint to make failures actionable.
                    raise LisaException(
                        "fail to run apt update && unattended-upgrade -d -v"
                    )

@LiliDeng

LiliDeng commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

AI Test Case Selection

Selected 87 test case(s): verify_default_targetpw,verify_grub,verify_network_manager_not_installed,verify_network_file_configuration,verify_ifcfg_eth0,verify_udev_rules_moved,verify_dhcp_file_configuration,verify_yum_conf,verify_os_update,verify_hv_kvp_daemon_installed,verify_repository_installed,verify_serial_console_is_enabled,verify_bash_history_is_empty,verify_boot_error_fail_warnings,verify_cloud_init_error_status,verify_client_active_interval,verify_no_pre_exist_users,verify_resource_disk_readme_file,verify_resource_disk_file_system,verify_waagent_version,verify_python_version,verify_openssl_version,verify_azure_64bit_os,verify_omi_version,verify_no_swap_on_osdisk,verify_essential_kernel_modules,verify_boot_with_debug_kernel,verify_l3_cache,verify_cpu_count,verify_vmbus_interrupts,verify_enable_kprobe,verify_dhcp_client_timeout,verify_floppy_module_is_blacklisted,verify_gdb,verify_lis_modules_version,verify_initrd_modules,verify_hyperv_modules,verify_reload_hyperv_modules,verify_kvp,verify_vmbus_devices_channels_bsd,verify_vmbus_devices_channels,verify_vmbus_heartbeat_properties,verify_hyperv_platform_id,verify_deployment_provision_synthetic_nic,verify_deployment_provision_standard_ssd_disk,verify_deployment_provision_ephemeral_managed_disk,verify_deployment_provision_premium_disk,verify_deployment_provision_premiumv2_disk,verify_deployment_provision_sriov,verify_reboot_in_platform,verify_deployment_provision_ultra_datadisk,verify_stop_start_in_platform,verify_deployment_provision_swiotlb_force,verify_sched_core_basic,verify_serial_console,verify_disks_device_timeout_setting,verify_resource_disk_mounted,verify_swap,verify_resource_disk_io,verify_scsi_disk_controller_type,verify_nvme_disk_controller_type,verify_os_partition_identifier,verify_hot_add_disk_serial,verify_hot_add_disk_serial_standard_ssd,verify_hot_add_disk_serial_premium_ssd,verify_hot_add_disk_parallel,verify_hot_add_disk_parallel_standard_ssd,verify_hot_add_disk_serial_random_lun_standard_ssd,verify_hot_add_disk_serial_random_lun_premium_ssd,verify_hot_add_disk_parallel_premium_ssd,verify_nfsv4_basic,verify_smb_linux,verify_cifs_basic,verify_timesync_ptp,verify_timesync_unbind_clocksource,verify_timesync_unbind_clockevent,verify_timesync_ntp,verify_timesync_chrony,verify_pmu_disabled_for_arm64,verify_timedrift_corrected,verify_vdso,verify_vm_hot_resize,verify_vm_hot_resize_decrease,verify_vm_resize_increase,verify_vm_resize_decrease,verify_zram_crypto_zstd,verify_zram_crypto_lz4

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Result: Failed

View full logs in Azure DevOps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants