Skip to content

Fix Ubuntu/Debian package installation#13207

Draft
vishesh92 wants to merge 2 commits into
apache:mainfrom
shapeblue:fix-ubuntu-package-installation
Draft

Fix Ubuntu/Debian package installation#13207
vishesh92 wants to merge 2 commits into
apache:mainfrom
shapeblue:fix-ubuntu-package-installation

Conversation

@vishesh92

@vishesh92 vishesh92 commented May 21, 2026

Copy link
Copy Markdown
Member

Description

This PR fixes package installation errors on Ubuntu and debian

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@vishesh92

Copy link
Copy Markdown
Member Author

@blueorangutan package

@vishesh92 vishesh92 added this to the 4.23.0 milestone May 21, 2026
@blueorangutan

Copy link
Copy Markdown

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

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 Debian/Ubuntu cloudstack-common post-install script to use Python 3 byte-compilation tooling during package installation, aiming to resolve install-time failures related to Python compilation steps.

Changes:

  • Replace pycompile invocations with py3compile in debian/cloudstack-common.postinst.
  • Keep post-install Python module copying and explicit python3 -m py_compile/compileall steps intact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread debian/cloudstack-common.postinst
Comment thread debian/cloudstack-common.postinst
@codecov

codecov Bot commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.09%. Comparing base (1fe486f) to head (782f28b).
⚠️ Report is 28 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13207      +/-   ##
============================================
- Coverage     18.09%   18.09%   -0.01%     
- Complexity    16732    16733       +1     
============================================
  Files          6037     6037              
  Lines        542780   542811      +31     
  Branches      66464    66471       +7     
============================================
+ Hits          98233    98235       +2     
- Misses       433499   433529      +30     
+ Partials      11048    11047       -1     
Flag Coverage Δ
uitests 3.51% <ø> (ø)
unittests 19.26% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17954

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test debian12 kvm-debian12

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Trillian-Jenkins test job (debian12 mgmt + kvm-debian12) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-16140)

@vishesh92

Copy link
Copy Markdown
Member Author

@blueorangutan package

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 20 out of 20 changed files in this pull request and generated 11 comments.

Comments suppressed due to low confidence (1)

scripts/storage/secondary/cloud-install-sys-tmplt.py:176

  • file(...) is not defined in Python 3, so these calls will raise NameError at runtime. Replace with open(..., 'wb') (and consider using context managers) for decompression output and template.properties writes.
  def uncompressFile(self, fileName):
    print('Uncompressing the file %s... which could take a long time, please wait' % self.systemvmtemplatepath)
    if self.fileextension == 'gz':
      compressedFile = gzip.GzipFile(self.systemvmtemplatepath, 'rb')
      decompressedData = compressedFile.read()
      compressedFile.close()
      decompressedFile = file(fileName, 'wb')
      decompressedFile.write(decompressedData)
      decompressedFile.close()

Comment on lines +28 to 31
if which py3compile >/dev/null 2>&1; then
py3compile -p cloudstack-common /usr/share/cloudstack-common
fi

if self.args.templatesuffix:
self.templatesuffix = self.args.templatesuffix
print 'Password for DB: %s'%self.databaseuserpassword
print('Password for DB: %s'%self.databaseuserpassword)
Comment on lines 110 to 127
def runCmd(self, cmds):
process = subprocess.Popen(' '.join(cmds), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
print(stdout)
if process.returncode != 0:
raise Exception(stderr)
return stdout

def runMysql(self, query):
try:
print 'Running Query: %s' % query
print('Running Query: %s' % query)
mysqlCmds = ['mysql', '--user=%s'%self.databaseusername, '--host=%s'%self.databasehostname, '--password=%s'%self.databaseuserpassword, '--skip-column-names', '-U', 'cloud', '-e "%s"'%query]
templateId = self.runCmd(mysqlCmds)
print 'TemplateId is : %s' % templateId
except Exception, e:
print('TemplateId is : %s' % templateId)
except Exception as e:
err = '''Encountering an error when executing mysql script\n%s''' % str(e)
self.errorAndExit(err)
return templateId
Comment on lines 119 to +123
try:
print 'Running Query: %s' % query
print('Running Query: %s' % query)
mysqlCmds = ['mysql', '--user=%s'%self.databaseusername, '--host=%s'%self.databasehostname, '--password=%s'%self.databaseuserpassword, '--skip-column-names', '-U', 'cloud', '-e "%s"'%query]
templateId = self.runCmd(mysqlCmds)
print 'TemplateId is : %s' % templateId
except Exception, e:
print('TemplateId is : %s' % templateId)
modfile = "%s/%s.py" % (modpath, cs.getName().lower())
me = os.path.abspath(__file__)
if os.path.isfile(modfile):
if hashlib.md5(open(me).read()).hexdigest() != hashlib.md5(open(modfile).read()).hexdigest():
sys.exit(2)
params = {}
pos = 0;
for i in range(len(paramList) / 2):
Comment on lines 594 to 595
if val in ["10", "100", "1000"]:
settings += ['duplex', 'val']
network_conf.close()
except Exception, e:
except Exception as e:
raise Error("failed to determine network backend:" + e)
if len(sys.argv) < 4:
print "Usage: prepare_kickstart_kerneal_initrd.py path_to_kernel path_to_initrd path_kernel_initrd_copy_to"
sys.exit(1)
print("Usage: prepare_kickstart_kerneal_initrd.py path_to_kernel path_to_initrd path_kernel_initrd_copy_to")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

😄

if __name__ == "__main__":
if len(sys.argv) < 12:
print "Usage: prepare_tftp_bootfile.py tftp_dir mac cifs_server share directory image_to_restor cifs_username cifs_password ip netmask gateway"
print("Usage: prepare_tftp_bootfile.py tftp_dir mac cifs_server share directory image_to_restor cifs_username cifs_password ip netmask gateway")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

😆

@weizhouapache weizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code lgtm

if len(sys.argv) < 4:
print "Usage: prepare_kickstart_kerneal_initrd.py path_to_kernel path_to_initrd path_kernel_initrd_copy_to"
sys.exit(1)
print("Usage: prepare_kickstart_kerneal_initrd.py path_to_kernel path_to_initrd path_kernel_initrd_copy_to")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

😄

if __name__ == "__main__":
if len(sys.argv) < 12:
print "Usage: prepare_tftp_bootfile.py tftp_dir mac cifs_server share directory image_to_restor cifs_username cifs_password ip netmask gateway"
print("Usage: prepare_tftp_bootfile.py tftp_dir mac cifs_server share directory image_to_restor cifs_username cifs_password ip netmask gateway")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

😆

@daviftorres

Copy link
Copy Markdown
Contributor

Dear @vishesh92, just for clarification. The title says Ubuntu and the description says Debian. Which ones is this fix for? Or is it for the Debian-based, that includes Ubuntu?

@vishesh92

Copy link
Copy Markdown
Member Author

Dear @vishesh92, just for clarification. The title says Ubuntu and the description says Debian. Which ones is this fix for? Or is it for the Debian-based, that includes Ubuntu?

The packages are same for both Ubuntu and Debian.

@vishesh92 vishesh92 changed the title Fix Ubuntu package installation Fix Ubuntu/Debian package installation May 27, 2026
@weizhouapache

Copy link
Copy Markdown
Member

@vishesh92
is this ready for review and testing ?

@vishesh92

Copy link
Copy Markdown
Member Author

@vishesh92 is this ready for review and testing ?

I couldn't confirm if some of the scripts works as expected before and after changes. Should we rely on just BO for this?

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18424

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test debian12 kvm-debian12

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Trillian-Jenkins test job (debian12 mgmt + kvm-debian12) has been kicked to run smoke tests

@weizhouapache

Copy link
Copy Markdown
Member

@vishesh92
can you address some of copilot's comments ?

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-16454)
Environment: kvm-debian12 (x2), zone: Advanced Networking with Mgmt server d12
Total time taken: 79399 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr13207-t16454-kvm-debian12.zip
Smoke tests completed. 121 look OK, 31 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_role_account_acls_multiple_mgmt_servers Error 2.01 test_dynamicroles.py
test_query_async_job_result Error 76.68 test_async_job.py
test_provision_certificate Error 120.64 test_certauthority_root.py
test_revoke_certificate Error 0.04 test_certauthority_root.py
login_test_saml_user Error 3.22 test_login.py
test_configure_ha_provider_invalid Error 0.04 test_hostha_simulator.py
test_configure_ha_provider_valid Error 0.03 test_hostha_simulator.py
test_ha_configure_enabledisable_across_clusterzones Error 0.03 test_hostha_simulator.py
test_ha_disable_feature_invalid Error 0.03 test_hostha_simulator.py
test_ha_enable_feature_invalid Error 0.03 test_hostha_simulator.py
test_ha_list_providers Error 0.03 test_hostha_simulator.py
test_ha_multiple_mgmt_server_ownership Error 0.03 test_hostha_simulator.py
test_ha_verify_fsm_available Error 0.03 test_hostha_simulator.py
test_ha_verify_fsm_degraded Error 0.03 test_hostha_simulator.py
test_ha_verify_fsm_fenced Error 0.03 test_hostha_simulator.py
test_ha_verify_fsm_recovering Error 0.03 test_hostha_simulator.py
test_hostha_configure_default_driver Error 0.03 test_hostha_simulator.py
test_hostha_configure_invalid_provider Error 0.03 test_hostha_simulator.py
test_hostha_disable_feature_valid Error 0.03 test_hostha_simulator.py
test_hostha_enable_feature_valid Error 0.03 test_hostha_simulator.py
test_hostha_enable_feature_without_setting_provider Error 0.03 test_hostha_simulator.py
test_list_ha_for_host Error 0.03 test_hostha_simulator.py
test_list_ha_for_host_invalid Error 0.03 test_hostha_simulator.py
test_list_ha_for_host_valid Error 0.03 test_hostha_simulator.py
ContextSuite context=TestClusterDRS>:setup Error 0.00 test_cluster_drs.py
test_01_host_ping_on_alert Error 0.14 test_host_ping.py
test_01_host_ping_on_alert Error 0.14 test_host_ping.py
test_deploy_more_vms_than_limit_allows Error 6.20 test_deploy_vms_in_parallel.py
test_deployvm_firstfit Error 0.20 test_deploy_vms_with_varied_deploymentplanners.py
test_deployvm_userconcentrated Error 0.11 test_deploy_vms_with_varied_deploymentplanners.py
test_deployvm_userdispersing Error 0.17 test_deploy_vms_with_varied_deploymentplanners.py
test_deployvm_userdata Error 0.16 test_deploy_vm_with_userdata.py
test_deployvm_userdata_post Error 0.07 test_deploy_vm_with_userdata.py
ContextSuite context=TestRemoteDiagnostics>:setup Error 0.00 test_diagnostics.py
test_03_deploy_vm_domain_service_offering Error 6.08 test_domain_service_offerings.py
test_04_validate_vpc_offering_conserve_mode_disabled Error 57.33 test_domain_vpc_offerings.py
test_01_browser_migrate_template Error 15.43 test_image_store_object_migration.py
test_01_invalid_upgrade_kubernetes_cluster Failure 263.41 test_kubernetes_clusters.py
test_02_upgrade_kubernetes_cluster Failure 273.31 test_kubernetes_clusters.py
test_03_deploy_and_scale_kubernetes_cluster Failure 261.20 test_kubernetes_clusters.py
test_04_autoscale_kubernetes_cluster Failure 237.85 test_kubernetes_clusters.py
test_05_basic_lifecycle_kubernetes_cluster Failure 230.54 test_kubernetes_clusters.py
test_06_delete_kubernetes_cluster Failure 285.63 test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_cluster Failure 3690.92 test_kubernetes_clusters.py
test_10_vpc_tier_kubernetes_cluster Failure 285.61 test_kubernetes_clusters.py
test_11_test_unmanaged_cluster_lifecycle Error 58.02 test_kubernetes_clusters.py
test_12_test_deploy_cluster_different_offerings_per_node_type Failure 254.28 test_kubernetes_clusters.py
test_01_add_delete_kubernetes_supported_version Error 0.16 test_kubernetes_supported_versions.py
test_01_deployVMInSharedNetwork Error 65.74 test_network.py
test_03_destroySharedNetwork Failure 0.07 test_network.py
ContextSuite context=TestSharedNetwork>:teardown Error 0.16 test_network.py
test_oobm_issue_power_cycle Error 2.31 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_off Error 2.30 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_on Error 1.28 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_reset Error 1.30 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_soft Error 2.29 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_status Error 1.24 test_outofbandmanagement_nestedplugin.py
test_oobm_background_powerstate_sync Failure 20.59 test_outofbandmanagement.py
test_oobm_background_powerstate_sync Error 20.60 test_outofbandmanagement.py
test_oobm_configure_default_driver Error 0.07 test_outofbandmanagement.py
test_oobm_configure_invalid_driver Error 0.08 test_outofbandmanagement.py
test_oobm_disable_feature_invalid Error 0.07 test_outofbandmanagement.py
test_oobm_disable_feature_valid Error 0.14 test_outofbandmanagement.py
test_oobm_enable_feature_invalid Error 0.06 test_outofbandmanagement.py
test_oobm_enable_feature_valid Error 0.14 test_outofbandmanagement.py
test_oobm_enabledisable_across_clusterzones Error 5.76 test_outofbandmanagement.py
test_oobm_enabledisable_across_clusterzones Error 5.76 test_outofbandmanagement.py
test_oobm_issue_power_cycle Error 1.30 test_outofbandmanagement.py
test_oobm_issue_power_cycle Error 1.30 test_outofbandmanagement.py
test_oobm_issue_power_off Error 2.31 test_outofbandmanagement.py
test_oobm_issue_power_off Error 2.31 test_outofbandmanagement.py
test_oobm_issue_power_on Error 2.35 test_outofbandmanagement.py
test_oobm_issue_power_on Error 2.35 test_outofbandmanagement.py
test_oobm_issue_power_reset Error 0.28 test_outofbandmanagement.py
test_oobm_issue_power_reset Error 0.28 test_outofbandmanagement.py
test_oobm_issue_power_soft Error 0.26 test_outofbandmanagement.py
test_oobm_issue_power_soft Error 0.26 test_outofbandmanagement.py
test_oobm_issue_power_status Error 0.26 test_outofbandmanagement.py
test_oobm_issue_power_status Error 0.26 test_outofbandmanagement.py
test_oobm_multiple_mgmt_server_ownership Error 0.23 test_outofbandmanagement.py
test_oobm_multiple_mgmt_server_ownership Error 0.23 test_outofbandmanagement.py
test_oobm_zchange_password Error 0.18 test_outofbandmanagement.py
test_oobm_zchange_password Error 0.18 test_outofbandmanagement.py
test_02_edit_primary_storage_tags Error 0.05 test_primary_storage.py
test_01_primary_storage_scope_change Error 0.07 test_primary_storage_scope.py
test_01_vpc_privategw_acl Error 0.07 test_privategw_acl_ovs_gre.py
test_03_vpc_privategw_restart_vpc_cleanup Error 0.05 test_privategw_acl_ovs_gre.py
test_05_vpc_privategw_check_interface Error 0.04 test_privategw_acl_ovs_gre.py
test_01_vpc_privategw_acl Error 60.09 test_privategw_acl.py
test_02_vpc_privategw_static_routes Error 162.63 test_privategw_acl.py
test_03_vpc_privategw_restart_vpc_cleanup Error 165.17 test_privategw_acl.py
test_04_rvpc_privategw_static_routes Error 320.66 test_privategw_acl.py
test_01_purge_expunged_api_vm_start_date Error 20.78 test_purge_expunged_vms.py
test_02_purge_expunged_api_vm_end_date Error 18.73 test_purge_expunged_vms.py
test_03_purge_expunged_api_vm_start_end_date Error 14.18 test_purge_expunged_vms.py
test_04_purge_expunged_api_vm_no_date Error 16.87 test_purge_expunged_vms.py
test_05_purge_expunged_vm_service_offering Error 239.64 test_purge_expunged_vms.py
test_06_purge_expunged_vm_background_task Error 367.08 test_purge_expunged_vms.py
test_01_snapshot_root_disk Error 3.36 test_snapshots.py
test_CreateTemplateWithDuplicateName Error 28.16 test_templates.py
test_01_register_template_direct_download_flag Error 0.20 test_templates.py
test_01_positive_tests_usage Error 10.48 test_usage_events.py
test_01_ISO_usage Error 1.15 test_usage.py
test_01_lb_usage Error 5.34 test_usage.py
test_01_nat_usage Error 10.45 test_usage.py
test_01_public_ip_usage Error 1.10 test_usage.py
test_01_snapshot_usage Error 23.76 test_usage.py
test_01_template_usage Error 21.17 test_usage.py
test_01_vm_usage Error 136.27 test_usage.py
test_01_volume_usage Error 126.33 test_usage.py
test_01_vpn_usage Error 12.69 test_usage.py
test_01_migrate_VM_and_root_volume Error 72.21 test_vm_life_cycle.py
test_02_migrate_VM_with_two_data_disks Error 22.57 test_vm_life_cycle.py
test_01_secure_vm_migration Error 149.02 test_vm_life_cycle.py
test_02_unsecure_vm_migration Error 149.15 test_vm_life_cycle.py
test_03_secured_to_nonsecured_vm_migration Error 148.09 test_vm_life_cycle.py
test_04_nonsecured_to_secured_vm_migration Error 148.00 test_vm_life_cycle.py
test_08_migrate_vm Error 16.99 test_vm_life_cycle.py
test_10_attachAndDetach_iso Error 19.50 test_vm_life_cycle.py
test_12_start_vm_multiple_volumes_allocated Error 10.55 test_vm_life_cycle.py
test_01_vmschedule_create Error 0.13 test_vm_schedule.py
test_disable_oobm_ha_state_ineligible Error 0.11 test_hostha_kvm.py
test_hostha_configure_default_driver Error 0.07 test_hostha_kvm.py
test_hostha_enable_ha_when_host_disabled Error 0.07 test_hostha_kvm.py
test_hostha_enable_ha_when_host_disconected Error 0.07 test_hostha_kvm.py
test_hostha_enable_ha_when_host_in_maintenance Error 0.08 test_hostha_kvm.py
test_hostha_kvm_host_degraded Error 0.08 test_hostha_kvm.py
test_hostha_kvm_host_fencing Error 0.09 test_hostha_kvm.py
test_hostha_kvm_host_recovering Error 0.07 test_hostha_kvm.py
test_remove_ha_provider_not_possible Error 0.07 test_hostha_kvm.py

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18486

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test ubuntu24 xcpng82

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Trillian-Jenkins test job (ubuntu24 mgmt + xcpng82) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-16499)

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-16503)

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test ubuntu24 xenserver-84

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Trillian-Jenkins test job (ubuntu24 mgmt + xenserver-84) has been kicked to run smoke tests

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants