0

I am trying to configure an Wifi access point on my raspberry. I have created a virtual interface that enables my RPI (3B+) to still use wlan0 for wifi connection and "apwlan0" for accesspoint. I just need my RPI to be able to be connected to, via wifi (not bluetooth or ethernet) when no other network is available. i have followed this user's answer:

Access point as WiFi router/repeater, optional with bridge

I have many files that I changed exactly like he did I haven't touched the dhcpd.conf. but here is the files modified:

hostapd.conf

driver=nl80211
ssid=RPidaq
country_code=FR
hw_mode=g
channel=1
auth_algs=1
wpa=2
wpa_passphrase=verySecretPassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

The new service (called accesspoint@wlan0.service when running)

accesspoint@.service (edited)

[Unit]
Description=accesspoint with hostapd (interface-specific version)
Wants=wpa_supplicant@%i.service

[Service] ExecStartPre=/sbin/iw dev %i interface add ap@%i type __ap ExecStart=/usr/sbin/hostapd -i ap@%i /etc/hostapd/hostapd.conf ExecStopPost=-/sbin/iw dev ap@%i del

[Install] WantedBy=sys-subsystem-net-devices-%i.device

Created a new conf file for the wlan0 AP

wpa_supplicant-wlan0.conf

country=FR
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={ ssid="RPIdaq" psk="SamePass" key_mgmt=WPA-PSK
}

And finally edited the wpa_supplicant@wlan0.service

wpa_supplicant@wlan0.service (edited)

[Unit]
BindsTo=accesspoint@%i.service
After=accesspoint@%i.service

Then created two files for static IP adresses for both interfaces wlan0 and apwlan0

Problem is when i reboot my RPI, wifi works fine, apwlan0 is displayed, i can see ssid:RPIdaq on my phone, but can't connect to it. The accesspoint@wlan0.service is loaded but failed for active and waiting. This is the output for sudo systemctl status accesspoint@wlan0.service:

● accesspoint@wlan0.service - accesspoint with hostapd
   Loaded: loaded (/etc/systemd/system/accesspoint@.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2021-04-16 16:30:54 CEST; 24min ago
  Process: 4325 ExecStartPre=/sbin/iw dev wlan0 interface add apwlan0 type __ap (code=exited, status=240/LOGS_DIRECTORY)
  Process: 4326 ExecStopPost=/sbin/iw dev ap@i del (code=exited, status=237/KEYRING)

Apr 16 16:30:54 PFema systemd[1]: Starting accesspoint with hostapd... Apr 16 16:30:54 PFema iw[4325]: command failed: Device or resource busy (-16) Apr 16 16:30:54 PFema systemd[1]: accesspoint@wlan0.service: Control process exited, code=exited, status=240/LOGS_DIRECTORY Apr 16 16:30:54 PFema iw[4326]: command failed: No such device (-19) Apr 16 16:30:54 PFema systemd[1]: accesspoint@wlan0.service: Failed with result 'exit-code'. Apr 16 16:30:54 PFema systemd[1]: Failed to start accesspoint with hostapd.

If you have any tips or an idea on what is happening. I would gladly take it. To give a better idea of the function I am searching for, I am trying to enable my RPI to be accessed wirelessly from a phone. And when the connection is made, the RPI will show a dashboard on a web browser of datas and such.

Thanks in advance for your help.

EDIT: With further research, now i can see the RPI AP from my phone but cannot connect to it apparently, the password is wrong... But still accesspoint@wlan0.service fails to load.

Searme
  • 31
  • 4

0 Answers0