#1038424 hostapd systemd template only works when matching interface name

Package:
hostapd
Source:
hostapd
Description:
access point and authentication server for Wi-Fi and Ethernet
Submitter:
kolAflash@kolahilft.de
Date:
2023-06-18 03:03:05 UTC
Severity:
normal
#1038424#5
Date:
2023-06-18 03:00:48 UTC
From:
To:
The file
   /usr/share/doc/hostapd/README.Debian
tells, that you can run hostapd by creating a config
   /etc/hostapd/wifi.conf
and using the template hostapd@wifi.service systemd unit.
So you run
   systemctl enable --now hostapd@wifi.service
to enable and start it.
Side note:
   systemctl command not mentioned in the README.debian.
   But that's how systemd unit templates are handled as far as
   I know. Maybe this should be added to the README.debian.

PROBLEM:
That only works if your wlan interface is namend "wifi".
If your interface is named differently, the templated name has to be
changed accordingly. E.g. for "wlan0": hostapd@wlan0.service


If the name doesn't matched the systemd unit is somehow immediately
stopped again:

Jun 18 04:53:00 myhost systemd[1]: Starting hostapd@wifi.service -
Access point and authentication server for Wi-Fi and Ethernet (wifi)...
Jun 18 04:53:01 myhost hostapd[45039]: wlan0: interface state
UNINITIALIZED->COUNTRY_UPDATE
Jun 18 04:53:01 myhost hostapd[45039]: wlan0: interface state
COUNTRY_UPDATE->ENABLED
Jun 18 04:53:01 myhost hostapd[45039]: wlan0: AP-ENABLED
Jun 18 04:53:01 myhost systemd[1]: Started hostapd@wifi.service - Access
point and authentication server for Wi-Fi and Ethernet (wifi).
Jun 18 04:53:01 myhost systemd[1]: Stopping hostapd@wifi.service -
Access point and authentication server for Wi-Fi and Ethernet (wifi)...
Jun 18 04:53:02 myhost systemd[1]: hostapd@wifi.service: Deactivated
successfully.
Jun 18 04:53:02 myhost systemd[1]: Stopped hostapd@wifi.service - Access
point and authentication server for Wi-Fi and Ethernet (wifi).

IF this behavior is not intended, it's a bug.

IF this behavior is intended, the README.Debian should mention it!
-> "documentation bug"
(just spend 30 minutes figuring it out)



Kind regards,
kolAflash