Skip to content

tedge-agent error does not show which file does not exist #3159

@reubenmiller

Description

@reubenmiller

Describe the bug

tedge-agent fails to start and shows an unhelpful log message which does not help the user to find out "which file does not exist".

Error: No such file or directory (os error 2)

Below shows how the tedge-agent service just exits and go into a restart loop.

Oct 04 16:04:30 rpi5-d83add9f145a systemd[1]: Started tedge-agent.service - tedge-agent is a thin-edge.io component to support operations..
Oct 04 16:04:30 rpi5-d83add9f145a tedge-agent[1923]: Error: No such file or directory (os error 2)
Oct 04 16:04:30 rpi5-d83add9f145a systemd[1]: tedge-agent.service: Main process exited, code=exited, status=1/FAILURE
Oct 04 16:04:30 rpi5-d83add9f145a systemd[1]: tedge-agent.service: Failed with result 'exit-code'.

Starting tedge-agent manually and setting the log level to DEBUG shows the which file does not exist.

RUST_LOG=debug tedge-agent
2024-10-04T15:05:58.018373645Z DEBUG tedge_config::tedge_config_cli::tedge_config_location: Loading configuration from "/etc/tedge/tedge.toml"
2024-10-04T15:05:58.018459551Z DEBUG mqtt_channel::config: Using CA certificate: /etc/step-ca/certs/root_ca.crt
Error: No such file or directory (os error 2)

To Reproduce

  1. Stop the tedge-agent service

    systemctl stop tedge-agent
    
  2. Set the mqtt.client.auth.ca_file to a path that does not exist

    tedge config set mqtt.client.auth.ca_file /etc/does/not/exist/root_ca.crt
  3. Start the tedge-agent service

    systemctl start tedge-agent
    

Expected behavior

It is ok that the tedge-agent fails on startup, however the error message should contain the path to the file that does not exist to allow the user to fix the configuration error.

Screenshots

Environment (please complete the following information):

Property Value
OS [incl. version] Debian GNU/Linux 12 (bookworm)
Hardware [incl. revision] Raspberry Pi 5 Model B Rev 1.0
System-Architecture Linux rpi5-d83add9f145a 6.6.31+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux
thin-edge.io version tedge 1.3.1

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtheme:troubleshootingTheme: Troubleshooting and remote control

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions