diff --git a/ansible/roles/ovos_installer/templates/virtualenv/wrapper-ovos-phal-admin.sh.j2 b/ansible/roles/ovos_installer/templates/virtualenv/wrapper-ovos-phal-admin.sh.j2 index c156474..74ea324 100644 --- a/ansible/roles/ovos_installer/templates/virtualenv/wrapper-ovos-phal-admin.sh.j2 +++ b/ansible/roles/ovos_installer/templates/virtualenv/wrapper-ovos-phal-admin.sh.j2 @@ -16,6 +16,24 @@ while ! [ -d "$combo_locks_path" ]; do ((attempt_counter++)) echo "Trying to start ovos-phal-admin systemd unit... Attempt ${attempt_counter}/${max_attempt}" sleep 1 + else + # If for some reasons /tmp/combo_locks is not created by the other + # services then we force the directory creation with the + # correct permissions to avoid a potential race condition. + if ! mkdir -p "$combo_locks_path"; then + echo "Failed to create $combo_locks_path directory" >&2 + exit 1 + fi + if ! chmod 755 "$combo_locks_path" || \ + ! chown -R {{ ovos_installer_user }}:{{ ovos_installer_group }} "$combo_locks_path"; then + echo "Failed to set permissions on $combo_locks_path" >&2 + exit 1 + fi + # Verify directory exists and has correct ownership + if [ ! -d "$combo_locks_path" ]; then + echo "Directory creation verification failed" >&2 + exit 1 + fi fi done