2

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 at 17:09
5

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.

  • 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. – Stefan Wegener Mar 29 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 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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