Skip to content

Conversation

lucaspin
Copy link
Contributor

@lucaspin lucaspin commented May 5, 2025

Issue

As part of supporting Ubuntu 22 ARM in agent-aws-stack, we reached an issue with the when CLI installation. For some reason, the erl command used to determine the version of Erlang/OTP returns some junk and not only the version we are interested in:

Erlang version: =ERROR REPORT==== 30-Apr-2025::21:44:30.114827 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: .. Function: read_file_info. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.115317 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./maps.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.119437 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./logger_formatter.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.123005 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./standard_error.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.124423 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./string.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.132585 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./supervisor_bridge.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.134116 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./unicode_util.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.219142 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./io_lib.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.221839 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./inet_db.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.252741 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./io_lib_format.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.255448 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./inet_config.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.258994 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./epp.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.263716 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./inet_udp.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.267596 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./io_lib_pretty.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.271321 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./inet.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.305718 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./erl_scan.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.309813 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./inet_parse.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.316695 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./inet_gethost_native.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.323713 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./rpc.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.326941 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./global.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.332291 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./net_kernel.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.341387 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./rand.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.346562 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./erl_distribution.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.348264 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./global_group.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.353477 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./erpc.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.357317 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./user_sup.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.359145 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./user_drv.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.363462 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./gen_statem.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.369089 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./prim_tty.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.382769 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./io.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.388798 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./group.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.395718 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./edlin.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.398882 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./logger_sup.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.401521 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./edlin_key.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.402824 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./logger_handler_watcher.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.404594 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./kernel_config.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.406334 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./kernel_refc.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.408109 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./erl_signal_handler.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.409589 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./logger_std_h.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.412476 ===
    label: {erl_prim_loader,file_error}
    report: File operation error: eacces. Target: ./logger_h_common.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.114827 ===
File operation error: eacces. Target: .. Function: read_file_info. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.115317 ===
File operation error: eacces. Target: ./maps.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.119437 ===
File operation error: eacces. Target: ./logger_formatter.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.123005 ===
File operation error: eacces. Target: ./standard_error.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.124423 ===
File operation error: eacces. Target: ./string.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.132585 ===
File operation error: eacces. Target: ./supervisor_bridge.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.134116 ===
File operation error: eacces. Target: ./unicode_util.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.219142 ===
File operation error: eacces. Target: ./io_lib.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.221839 ===
File operation error: eacces. Target: ./inet_db.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.252741 ===
File operation error: eacces. Target: ./io_lib_format.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.415915 ===
File operation error: eacces. Target: ./c.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.420388 ===
File operation error: eacces. Target: ./orddict.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.422703 ===
File operation error: eacces. Target: ./raw_file_io.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.424144 ===
File operation error: eacces. Target: ./erl_anno.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.426196 ===
File operation error: eacces. Target: ./ordsets.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.427552 ===
File operation error: eacces. Target: ./otp_internal.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 30-Apr-2025::21:44:30.429389 ===
File operation error: eacces. Target: ./erl_internal.beam. Function: get_file. Process: code_server.
26

Due to that, the ERLANG_VERSION variable ends up having some spaces in it, so the mv command here ends up being expanded to a move command that tries to move multiple files. Since moving multiple files, the mv command expects the last argument to be a directory, the when CLI fails to be installed with the cannot access '/usr/local/bin/when': No such file or directory error message.

Weirdly enough, that only happens when the install script runs as part of an Ansible task, and not in all cases - for example, if the install-toolbox toolbox script is run separately from the install.sh agent installation script, it works just fine. Also, if I run that command through any other means, I don't see those errors.

Ref: https://github.com/renderedtext/tasks/issues/7932

Solution

I couldn't find a reasonable explanation of why Erlang shows these errors inconsistently (only during Ansible task when the script runs as part of another script invocation), so I think the best route forward here is to update the install-toolbox script to just ignore that extra output.

@lucaspin lucaspin requested review from hamir-suspect and dexyk May 5, 2025 13:05
@lucaspin lucaspin merged commit 02e0042 into master May 5, 2025
22 checks passed
@lucaspin lucaspin deleted the fix/update-when-installation branch May 5, 2025 16:48
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.

2 participants