lakinduakash / linux-wifi-hotspot

Feature-rich wifi hotspot creator for Linux which provides both GUI and command-line interface. It is also able to create a hotspot using the same wifi card which is connected to an AP already ( Similar to Windows 10).
BSD 2-Clause "Simplified" License
3.2k stars 296 forks source link

Failed to run hostapd (OpenSUSE) #218

Closed p1839251 closed 1 year ago

p1839251 commented 2 years ago

Hello, I looked through the issues I found here but I didn't find a solution to the problem. Hopefully this isn't a duplicate of an already reported issue.

I installed linux-wifi-hotspot on OpenSUSE Tumbleweed but it won't work. At first I tried the GUI method, but I couldn't select anything from the dropdown menu of Wifi interface. (I'm not sure if this is a bad sign of anything) Alright, I thought I would give it a go to the CLI method.

These are my devices

# ip link show
1: lo
2: enp3s0
3: wlp2s0

And this is what I did and got back from the terminal:

# create_ap wlp2s0 enp3s0 MyAccessPoint
Config dir: /tmp/create_ap.wlp2s0.conf.H7pLbtfl
PID: 2717
Network Manager found, set ap0 as unmanaged device... DONE
Creating a virtual WiFi interface... ap0 created.
Sharing Internet using method: nat
Setting /usr/sbin/dnsmasq to complain mode.
Warning: profile dnsmasq represents multiple programs
Warning: profile dnsmasq represents multiple programs
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp2s0.conf.H7pLbtfl/hostapd_ctrl
Configuration file: /tmp/create_ap.wlp2s0.conf.H7pLbtfl/hostapd.conf
Could not open configuration file '/tmp/create_ap.wlp2s0.conf.H7pLbtfl/hostapd.conf' for reading.
Failed to set up interface with /tmp/create_ap.wlp2s0.conf.H7pLbtfl/hostapd.conf
Failed to initialize interface

Error: Failed to run hostapd, maybe a program is interfering.
If an error like 'n80211: Could not configure driver mode' was thrown
try running the following before starting create_ap:
    nmcli r wifi off
    rfkill unblock wlan

Doing cleanup.. done

I have these packages installed: bash 5.1.12-3.1 util-linux 2.37.2-1.1 procps 3.3.17-5.2 hostapd 2.9-9.1 iproute2 5.15-1.1 iw 5.16-1.1 haveged 1.9.14-6.1 (I don't have iwconfig)

lakinduakash commented 2 years ago

Hi, Can you send the output of iw dev?

p1839251 commented 2 years ago

sure thing Here you are:

I do hope it didn't collapse

# iw dev
phy#0
        Interface wlp2s0
                ifindex 3
                wdev 0x1
                addr 72:c7:b0:56:5f:2c
                type managed
                txpower 14.00 dBm
                multicast TXQ:
                        qsz-byt qsz-pkt flows   drops   marks   overlmt hashcol tx-bytes        tx-packets
                        0       0       0       0       0       0       0       0               0
lakinduakash commented 2 years ago

That might be a driver issue. Can you send me the driver details as well using lspci -nnk | grep -A3 0280.

Few drivers face these issues. I'm finding a way to support all the drivers.

p1839251 commented 2 years ago
# lspci -nnk | grep -A3 0280
03:00.0 Network controller [0280]: Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express) [168c:002b] (rev 01)
        Subsystem: AzureWave AW-NE785 / AW-NE785H 802.11bgn Wireless Full or Half-size Mini PCIe Card [1a3b:1089]
        Kernel driver in use: ath9k
        Kernel modules: ath9k

fwiw I can start hostapd manually and connect to it, though I don't get an IP address, as I neither set bridge nor NAT up

# systemctl start hostapd

# systemctl status hostapd
● hostapd.service - Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
     Loaded: loaded (/usr/lib/systemd/system/hostapd.service; disabled; vendor preset: disabled)
     Active: active (running) since Wed 2021-12-08 12:04:30 CET; 3s ago
   Main PID: 7042 (hostapd)
      Tasks: 1 (limit: 3274)
        CPU: 83ms
     CGroup: /system.slice/hostapd.service
             └─7042 /usr/sbin/hostapd /etc/hostapd.conf

dec 08 12:04:30 suse systemd[1]: Started Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator.
dec 08 12:04:30 suse hostapd[7042]: Configuration file: /etc/hostapd.conf
dec 08 12:04:30 suse hostapd[7042]: wlp2s0: interface state UNINITIALIZED->COUNTRY_UPDATE
dec 08 12:04:30 suse hostapd[7042]: Using interface wlp2s0 with hwaddr 0a:05:6d:c4:58:fd and ssid "MyAccessPoint"
dec 08 12:04:30 suse hostapd[7042]: wlp2s0: interface state COUNTRY_UPDATE->ENABLED
dec 08 12:04:30 suse hostapd[7042]: wlp2s0: AP-ENABLED

# systemctl stop hostapd

# create_ap wlp2s0 enp3s0 MyAccessPoint
Config dir: /tmp/create_ap.wlp2s0.conf.inZbFGSK
PID: 7048
Network Manager found, set ap0 as unmanaged device... DONE
Creating a virtual WiFi interface... ap0 created.
Sharing Internet using method: nat
Setting /usr/sbin/dnsmasq to complain mode.
Warning: profile dnsmasq represents multiple programs
Warning: profile dnsmasq represents multiple programs
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp2s0.conf.inZbFGSK/hostapd_ctrl
Configuration file: /tmp/create_ap.wlp2s0.conf.inZbFGSK/hostapd.conf
Could not open configuration file '/tmp/create_ap.wlp2s0.conf.inZbFGSK/hostapd.conf' for reading.
Failed to set up interface with /tmp/create_ap.wlp2s0.conf.inZbFGSK/hostapd.conf
Failed to initialize interface

Error: Failed to run hostapd, maybe a program is interfering.
If an error like 'n80211: Could not configure driver mode' was thrown
try running the following before starting create_ap:
    nmcli r wifi off
    rfkill unblock wlan

Doing cleanup.. done
lakinduakash commented 2 years ago

Can you check this /tmp/create_ap.wlp2s0.conf.inZbFGSK/hostapd.conf file path exist when you start the hotspot? I want to confirm is it a permission error or something else. This path may vary when you restart. So please check the output.

p1839251 commented 2 years ago

This wasn't the easiest thing to do because of the automatic cleanup process. I was constantly trying and this is what I finally got:

-rw------- 1 root root 235 dec   17 00.21 dnsmasq.conf
-rw------- 1 root root 205 dec   17 00.21 hostapd.conf
-rw------- 1 root root   7 dec   17 00.21 nat_internet_iface
-r--r--r-- 1 root root   5 dec   17 00.21 pid
-r--r--r-- 1 root root   4 dec   17 00.21 wifi_iface

I didn't have much time to closely examine the files as they get removed pretty quickly

lakinduakash commented 2 years ago

Oh, thanks friend, I will check. Even I'm struggling to find what's the issue. Need to establish proper debugging mechanism.

lakinduakash commented 1 year ago

This is fixed, please check latest release