Skip to content

OSError: [Errno 8] Exec format error: #27429

@darren221980

Description

@darren221980

Describe the bug

Hi,

So, I've created myself a VM using the Ubuntu 64-bit ARM Server 22.04.3 iso image. I've configured it as a agent to use with Azure Dev Ops. I've installed the azurecli and bicep but when attempting to run az bicep version i get the error detailed below.

Related command

az bicep version

Errors

darren@darren-ubuntu:~$ az bicep version
The command failed with an unexpected error. Here is the traceback:
[Errno 8] Exec format error: '/home/darren/.azure/bin/bicep'
Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/custom.py", line 4401, in show_bicep_cli_version
print(run_bicep_command(cmd.cli_ctx, ["--version"], auto_install=False))
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 94, in run_bicep_command
installed_version = _get_bicep_installed_version(installation_path)
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 267, in _get_bicep_installed_version
installed_version_output = _run_command(bicep_executable_path, ["--version"])
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 305, in _run_command
process = subprocess.run([rf"{bicep_installation_path}"] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/opt/az/lib/python3.10/subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "/opt/az/lib/python3.10/subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/opt/az/lib/python3.10/subprocess.py", line 1847, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/darren/.azure/bin/bicep'

Issue script & Debug output

darren@darren-ubuntu:~$ az bicep version --debug
cli.knack.cli: Command arguments: ['bicep', 'version', '--debug']
cli.knack.cli: init debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0xffffbc8113f0>, <function OutputProducer.on_global_arguments at 0xffffbc720310>, <function CLIQuery.on_global_arguments at 0xffffbc529510>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'bicep': ['azure.cli.command_modules.resource']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: resource 0.005 51 226
cli.azure.cli.core: Total (1) 0.005 51 226
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: Total (0) 0.000 0 0
cli.azure.cli.core: Loaded 51 groups, 226 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : bicep version
cli.azure.cli.core: Command table: bicep version
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0xffffbb5deef0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/darren/.azure/commands/2023-09-19.16-06-06.bicep_version.30572.log'.
az_command_data_logger: command args: bicep version --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0xffffbb5fba30>]
cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/profiles/_shared.py", line 655, in _get_attr
op = getattr(op, part)
AttributeError: module 'azure.mgmt.resource.resources.v2022_09_01.models' has no attribute 'ExemptionCategory'

cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0xffffbb641870>, <function register_cache_arguments..add_cache_arguments at 0xffffbb641990>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0xffffbc7203a0>, <function CLIQuery.handle_query_parameter at 0xffffbc5295a0>, <function register_ids_argument..parse_ids_arguments at 0xffffbb641900>]
cli.azure.cli.command_modules.resource._bicep: Current value of "use_binary_from_path": false.
cli.azure.cli.command_modules.resource._bicep: Bicep CLI installation path: /home/darren/.azure/bin/bicep
cli.azure.cli.command_modules.resource._bicep: Bicep CLI installed: True.
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/custom.py", line 4401, in show_bicep_cli_version
print(run_bicep_command(cmd.cli_ctx, ["--version"], auto_install=False))
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 94, in run_bicep_command
installed_version = _get_bicep_installed_version(installation_path)
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 267, in _get_bicep_installed_version
installed_version_output = _run_command(bicep_executable_path, ["--version"])
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 305, in _run_command
process = subprocess.run([rf"{bicep_installation_path}"] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/opt/az/lib/python3.10/subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "/opt/az/lib/python3.10/subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/opt/az/lib/python3.10/subprocess.py", line 1847, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/darren/.azure/bin/bicep'

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: [Errno 8] Exec format error: '/home/darren/.azure/bin/bicep'
Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/custom.py", line 4401, in show_bicep_cli_version
print(run_bicep_command(cmd.cli_ctx, ["--version"], auto_install=False))
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 94, in run_bicep_command
installed_version = _get_bicep_installed_version(installation_path)
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 267, in _get_bicep_installed_version
installed_version_output = _run_command(bicep_executable_path, ["--version"])
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 305, in _run_command
process = subprocess.run([rf"{bicep_installation_path}"] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/opt/az/lib/python3.10/subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "/opt/az/lib/python3.10/subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/opt/az/lib/python3.10/subprocess.py", line 1847, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/darren/.azure/bin/bicep'
az_command_data_logger: [Errno 8] Exec format error: '/home/darren/.azure/bin/bicep'
Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/custom.py", line 4401, in show_bicep_cli_version
print(run_bicep_command(cmd.cli_ctx, ["--version"], auto_install=False))
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 94, in run_bicep_command
installed_version = _get_bicep_installed_version(installation_path)
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 267, in _get_bicep_installed_version
installed_version_output = _run_command(bicep_executable_path, ["--version"])
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 305, in _run_command
process = subprocess.run([rf"{bicep_installation_path}"] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/opt/az/lib/python3.10/subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "/opt/az/lib/python3.10/subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/opt/az/lib/python3.10/subprocess.py", line 1847, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/darren/.azure/bin/bicep'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0xffffbb5df130>]
az_command_data_logger: exit code: 1
cli.main: Command ran in 0.199 seconds (init: 0.095, invoke: 0.104)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 6812 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/usr/bin/../../opt/az/bin/python3 /opt/az/lib/python3.10/site-packages/azure/cli/telemetry/init.py /home/darren/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

bicep version to be presented.

Environment Summary

azure-cli 2.52.0

core 2.52.0
telemetry 1.1.0

Extensions:
ssh 2.0.1

Dependencies:
msal 1.24.0b1
azure-mgmt-resource 23.1.0b2

Python location '/opt/az/bin/python3'
Extensions directory '/home/darren/.azure/cliextensions'

Python (Linux) 3.10.10 (main, Aug 31 2023, 09:17:29) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botPossible-SolutionSimilar-Issueact-identity-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions