Advisory: $HOME/.habana_logs can be created without write/execute permissions

Under some conditions, the directory for Habana log files can be created by the root, without the user permissions to modify this directory.
(For example, if the user executes sudo hl-smi for the first time, or if some packages were installed under sudo, etc.)

$HOME/.habana_logs is the default location, used by all Habana tools to store log files. This location will be used if the environment variable HABANA_LOGS is not set up, or is set up but points to this location.
In such situation, various commands can fail with “permission denied” message (see picture for an example)

There are several ways to avoid this situation:

  • Set up environment variable HABANA_LOGS to some other location.
    OR
  • Sudo chmod 777 $HOME/.habana_logs; Sudo chmod 777 $HOME/.habana_logs/*
    OR
  • Sudo chown $USER:$USER $HOME/.habana_logs; Sudo chgrp $USER:$USER $HOME/.habana_logs

FYI, I recommend against suggesting sudo chmod 777 anything as a solution. It’s better to rearchitect instead, if needed, like using /var/log/habana owned by a specific habana user. Ideally you are not having home directories, which are private by design, storing data supposed to be accessed and writeable by everyone. you could, for example, have /var/log/habana set to 0755 which means that the owner (I.E.habana) can write and execute (use and list the directory) in this case, while everyone else can execute and read. There are specific cases where 777 is okay (like /var/tmp), but they shouldn’t be in home directories.