1

I was trying to make an access-point with a captive portal on my raspberry pi running Raspbian Stretch.

I have correctly configure hostapd and dnsmasq to make my AP work correctly a couple of weeks later, but nowadays I tried to make my AP work but I can't even enable the process. This is the error log when I tried to disable, or even enable it.

systemctl disable hostapd

Synchronizing state of hostapd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable hostapd
Failed to disable unit: Invalid argument

When I run system-analyze verify, it returns the next:

systemd-analyze verify hostapd.service
[/etc/systemd/system/hostapd.service:1] Assignment outside of section. Ignoring.
[/etc/systemd/system/hostapd.service:2] Assignment outside of section. Ignoring.
[/etc/systemd/system/hostapd.service:3] Assignment outside of section. Ignoring.
hostapd.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
hostapd.service: Failed to create hostapd.service/start: Unit hostapd.service is not loaded properly: Invalid argument.

And when I have tried to run apt remove hostapd

(Reading database ... 92822 files or directories currently installed.)
Uninstalling hostapd (2:2.6-21~bpo9~rpt1) ...
Failed to stop hostapd.service: Unit hostapd.service not loaded.
invoke-rc.d: initscript hostapd, action "stop" failed.
dpkg: error processing package hostapd (--remove):
 subprocess installing pre-removal script returns error code 5
Error processing:
 hostapd
E: Sub-process /usr/bin/dpkg returned an error code (1)

(I translate the last return lines because there are in Spanish, I think there are accurate).

And with this problem I'm not able to run hostapd or even uninstalling and configuring again...

Any clues on how to resolve my problem?

Thank you!

| improve this question | | | | |
  • 1
    I normally use the service commands, have you tried sudo service hostapd stop? – Dr_Bunsen Nov 5 '19 at 15:47
  • 1
    @Dr_Bunsen It doesn't make any difference. This old deprecated commands are emulated by systemd and they execute exactly the same then using systemctl direct. – Ingo Nov 5 '19 at 18:28
  • You can't have "correctly" configured it because it generates errors – Milliways Nov 5 '19 at 21:19
  • Yes, I have tried sudo service hostapd stop. – David González Blazman Nov 6 '19 at 7:46
  • @Milliways And yes, the configuration is correct, but first, you must limit to read what the error logs are saying, I solved the problem after a lot of tries. – David González Blazman Nov 6 '19 at 7:49
2

The solution passed to remove the service file in /etc/systemd/system/hostapd.service. Using cat in this file, because nano wasn't able to open it, I saw that the file was corrupted, so I delete the file and now, I am able to start/stop the service, and everything related.

Thank you to the ones that have tried to help me!

| improve this answer | | | | |

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.