My question is somehow related to this question: hostapd doesent work anymore

I have a fresh Raspbian Stretch system and then install hostapd via sudo apt-get install hostapd there are no error messages during installation, but afterwards if I want to see the services status, I can see, that it is masked.

pi@raspberrypi:~ $ sudo service hostapd status
● hostapd.service
  Loaded: masked (/dev/null; bad)
  Active: inactive (dead)

I know that I can use sudo systemctl unmask hostapd to remove the masking, but my question is, why it is masking the service? Also journalctl and /varlog/syslog have noting in their logs.

I have a lot of Pis which I orchestrate via Ansible and since about one week, the hostapd-installation and configuration is not working correctly because of the masking. But I do not want to modify my playbooks for something that more or less looks like a behavior which normally should not be there.

  • 1
    Because it doesn't make sense to run it until you've created a local configuration file. Running it without configuration may break your network connection and may stop other machines on your network running.
    – Dougie
    Mar 28, 2019 at 17:09

2 Answers 2


Just from the installation with sudo apt install hostapd there is nothing configured for the service. hostapd has no default setup so it doesn't make sense to start the service without it. To avoid possible confusion I suppose the package manager has decided to mask the service on installation. Just disable it is not enough to be on the save side because a disabled service can always be started manually or by another service.

You have first to configure it by creating the file /etc/hostapd/hostapd.conf and reference to it in /etc/default/hostapd with option DAEMON_CONF="/etc/hostapd/hostapd.conf".

Only if you have done all of this it is meaningful to

rpi ~$ sudo systemctl unmask hostapd.service
rpi ~$ sudo systemctl enable hostapd.service

and reboot.

  • 1
    Good point! Masking the service because of no initial configuration seems like a good idea i never thought about. But it is interesting that this behavior seems to be very new to hostapd, as my ansible scripts were running without any unmasking until two weeks ago. Mar 29, 2019 at 7:03
  • @StefanWegener Yes, seems to be new. I have first observed it with your question. My "old" scripts still disable hostapd.service immediately after installing it for the described reason.
    – Ingo
    Mar 29, 2019 at 9:20

As of Debian Buster with hostapd (2:2.7+git20190128+0c1e29f-6+deb10u3), there is a new configuration method which requires that the service be masked.

In the past, one would uncomment the #DAEMON_CONF="" line in /etc/defaults/hostapd to point to the proper config. The comment block in that same file says this config method is now depreciated. Instead one should add a hostapd myconfig.conf line to the appropriate interface directly in /etc/network/interfaces*.

If you unmask the hostapd service and use the new configuration method, then everything breaks because hostapds are spawned from both the networking and hostapd services and they fight each other to control the same interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.