Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to start hostapd.service: Unit hostapd.service is masked. #1018

Open
ijash opened this issue Oct 30, 2018 · 35 comments

Comments

@ijash
Copy link

commented Oct 30, 2018

sudo systemctl start hostapd returned Failed to start hostapd.service: Unit hostapd.service is masked.

@JamesH65

This comment has been minimized.

Copy link
Contributor

commented Oct 30, 2018

I have no idea why you have posted this issue. Do you have a specific part of the documentation that is showing this error?

@ijash

This comment has been minimized.

Copy link
Author

commented Oct 31, 2018

I have no idea why you have posted this issue. Do you have a specific part of the documentation that is showing this error?

sorry for not pointing to the documentation.

i have followed https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md
and get those error during sudo systemctl start.

i am using RPi3 B

@JamesH65

This comment has been minimized.

Copy link
Contributor

commented Jan 18, 2019

Odd. We've not had any other comments about this that I am aware of. Anything unusual about your setup?

@ijash

This comment has been minimized.

Copy link
Author

commented Jan 18, 2019

i'll close this topic, as i long forgot the steps to reproduce.

@ijash ijash closed this Jan 18, 2019

@beta-tester

This comment has been minimized.

Copy link

commented Mar 10, 2019

i have the same issue.

today, i took the actual rasbian image 2018-11-13-raspbian-stretch.zip
and flashed it to an SD card for my RPi3B+.

i enabled SSH by adding a ssh file to boot partition befor very first boot.

at reboot (after automatic resizing/growing filesystem pass) i could shortly see a message with something like that the WiFi was disables because of unsetted country code or something similar.

from SSH i ran sudo raspi-config to setup I4: WiFi country code to DE for Germany.

after sudo apt update && sudo apt upgrade -y i installed packages sudo apt install -y dnsmasq hostapd to be able to setup Wifi AccessPoint i tried to setup my RPi3B+ folowed the steps for Access-Point (NAT)

but when i try to start/enable hostapd with sudo systemctl start hostapd i get an error message
Failed to start hostapd.service: Unit hostapd.service is masked.

how can i enable WiFi again? how can i unmask hostapd?

@XECDesign

This comment has been minimized.

Copy link
Contributor

commented Mar 10, 2019

@beta-tester

This comment has been minimized.

Copy link

commented Mar 10, 2019

yes, thank you this is working.

sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd

but why was it masked?

beta-tester added a commit to beta-tester/RPi-PXE-Server that referenced this issue Mar 10, 2019

@scudrunner

This comment has been minimized.

Copy link

commented Mar 11, 2019

THANK YOU! I have been having the same issue with fresh installs, and the three lines above seem to have solved it!

@ijash

This comment has been minimized.

Copy link
Author

commented Mar 11, 2019

@beta-tester try unmasking, enabling and starting the service:
https://github.com/raspberrypi/documentation/pull/1097/files#diff-bab12433eaae7aea98b21a2978c8ba52R223

shouldn't this be on the documentation page? i agree if so.

@XECDesign

This comment has been minimized.

Copy link
Contributor

commented Mar 11, 2019

but why was it masked?

It's just the behaviour of the package that was backported from buster. I'm guessing the logic is that if hostapd is installed, it should be enabled explicitly by the user. The postinst script is checking whether the conf file exists before masking it, but I'm not sure if that's working as intended. I've only run through the instructions from a clean start and haven't tested updating from a previously working hostapd configuration.

shouldn't this be on the documentation page?

It's undergoing review and copy editing, which may take a while.

@JamesH65

This comment has been minimized.

Copy link
Contributor

commented Mar 11, 2019

With regard to updating the docs, @XECDesign has provided a PR, but unfortunately, staff shortages in our copy edit department means there is a long backlog to get things approved. I've asked for this to be given priority.

@heartlandcoop-prichards

This comment has been minimized.

Copy link

commented Mar 13, 2019

Thank you, I was having the same problem. I believe this issue just appeared in the last few weeks.

@bmoren

This comment has been minimized.

Copy link

commented Mar 14, 2019

checking in on this issue! it was masked for me...

@ijash

This comment has been minimized.

Copy link
Author

commented Mar 14, 2019

Should i reopen the issue? Even though the fix is found, just letting the others found this case easily before the documentation is being updated.. @JamesH65 @XECDesign ?

@XECDesign

This comment has been minimized.

Copy link
Contributor

commented Mar 14, 2019

Not sure. We already have #1093, #1095 and probably a few others.

@bmoren

This comment has been minimized.

Copy link

commented Mar 14, 2019

it seems logical to me to re-open. given 1. that the name of this issue is exactly the error you get when trying to config the documentation, and the solution:

sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd

is presented here nicely by @beta-tester.
and 2. that this issue really hasn't been solved yet. eg, the documentation hasn't actually been updated. My general tendency is to think that issues should stay open until they are actually fixed in the proper place (the documentation), not just that a solution is provided with this hidden github issue.

@beta-tester

This comment has been minimized.

Copy link

commented Mar 14, 2019

sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd

is presented here nicely by @beta-tester.

that is not my merit. that solution came from the documentation of @XECDesign

@weasdown

This comment has been minimized.

Copy link

commented Apr 2, 2019

@XECDesign's solution didn't work for me. The first two commands ran without any problems, but running sudo systemctl start hostapd generated an error: Job for hostapd.service failed because the control process exited with error code. See "systemctl hostapd.service" and "journalctl -xe" for details..

When I ran systemctl hostapd.service, the following output was generated:

● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2019-04-02 12:42:00 BST; 2s ago
Process: 1557 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=1/FAILURE

Apr 02 12:42:00 raspberrypi systemd[1]: hostapd.service: Control process exited, code=exited status=1
Apr 02 12:42:00 raspberrypi systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
Apr 02 12:42:00 raspberrypi systemd[1]: hostapd.service: Unit entered failed state.
Apr 02 12:42:00 raspberrypi systemd[1]: hostapd.service: Failed with result 'exit-code'.
Apr 02 12:42:02 raspberrypi systemd[1]: hostapd.service: Service hold-off time over, scheduling restart.
Apr 02 12:42:02 raspberrypi systemd[1]: Stopped Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
Apr 02 12:42:02 raspberrypi systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...

@XECDesign

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2019

Your issue is not related to this one.

Is this using the onboard wifi? Can you post your hostapd config file?

@weasdown

This comment has been minimized.

Copy link

commented Apr 3, 2019

I thought the issue was related because I was having the same issue as at the start of the thread while using the same Wi-Fi hotspot tutorial. I am using the onboard Wi-Fi on a Pi 3B+ with a clean install of the 2018-11-13 version of Raspbian and updates installed as recommended on first boot. Here's the hostapd.conf file:
hostapd.txt

@ijash ijash reopened this Apr 3, 2019

@XECDesign

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2019

Does it work if you use hw_mode=g instead? That's the only difference I see.

Edit: I'd try starting hostapd directly with whatever verbose/debug options it has and see what's it's complaining about.

@weasdown

This comment has been minimized.

Copy link

commented Apr 3, 2019

It does work with hw_mode=g, strangely. Below are versions of the log files with the two levels of verbosity. I have also noticed that if I set it to hw_mode=a and try starting it, the taskbar Wi-Fi icon gets stuck in a loop, going up to two bars then instantly cutting to the double x icon, briefly showing the two bars before starting the loop again.
hostapd_d.log
hostapd_dd.log

@XECDesign

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2019

1554303941.345443: 1554303941.345448: wlan0: IEEE 802.11 Configured channel (7) not found from the channel list of current mode (2) IEEE 802.11a

Channel 7 isn't a valid 5GHz channel, so that makes sense.

Try something suitable for your region from the table here:
https://en.wikipedia.org/wiki/List_of_WLAN_channels#5_GHz_(802.11a/h/j/n/ac/ax)

@weasdown

This comment has been minimized.

Copy link

commented Apr 3, 2019

I'm in Europe, so tried channel 36, and that works fine - thank you! I tried channel 38, 50 and 106 out of curiosity too though and they fail with that same error as before about the channel not being in the list. Here are the logs for all three cases:
hostapd_38d.log
hostapd_50d.log
hostapd_106d.log

@XECDesign

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2019

The hardware is certified for the North American region, so I suspect it filters out some channels which may be acceptable in your region. It's hard to get any clear answers about anything when it comes to 5GHz regulatory domains.

@weasdown

This comment has been minimized.

Copy link

commented Apr 3, 2019

Interesting, thanks. If I need to use 5GHz then I'll use channel 36, but for my application 2.4GHz should be more than adequate, so I'll just use that.

@XECDesign

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2019

iw list shows the frequencies that are available. Then select whatever is appropriate for your region from that subset.

@weasdown

This comment has been minimized.

Copy link

commented Apr 3, 2019

Great, thanks for the help.

@XECDesign

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2019

np

@beta-tester

This comment has been minimized.

Copy link

commented Apr 3, 2019

I'm in Europe, so tried channel 36, and that works fine - thank you! I tried channel 38, 50 and 106 out of curiosity too though and they fail with that same error as before about the channel not being in the list.

in my hostapd.conf file i have country_code=DE for germany, to setup the region.

# Country code (ISO/IEC 3166-1). Used to set regulatory domain.
# Set as needed to indicate country in which device is operating.
# This can limit available channels and transmit power.
# These two octets are used as the first two octets of the Country String
# (dot11CountryString)
#country_code=US

@weasdown

This comment has been minimized.

Copy link

commented Apr 3, 2019

What does this do? I haven't noticed any difference in the output from iw list.

@beta-tester

This comment has been minimized.

Copy link

commented Apr 4, 2019

i expect that this option is regulating the available channels and the transmitting power of the wifi for the selected region...
i didn't test it, i only used what is written in the description here.

@Doyled96

This comment has been minimized.

Copy link

commented Apr 13, 2019

I am still having problems with this. I am located in the US followed the directions exactly and hit the same speed bumps with hostapd being masked. Now facing the issue with the error code. PLEASE HELP!

@JamesH65

This comment has been minimized.

Copy link
Contributor

commented Apr 15, 2019

This really isn't a documentation issue, so should really be posted in the linux issue tracker where it will get more views. You could also try the forums.

@GitHubIsToxic

This comment has been minimized.

Copy link

commented Apr 18, 2019

Just a heads-up: I spend a few hours trying to solve this issue...and it turned out my password phrase in "hostapd.conf" was too short. As result hostapd doesn't start, apparently leading to the 'mask' thing issue.

eifinger added a commit to eifinger/rpi3-dns-ap-setup that referenced this issue Apr 24, 2019

hkapanen added a commit to tkurki/marinepi-provisioning that referenced this issue Apr 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.