2

I really need help on this matter.

I have a PC with Lubuntu 14.10 and a Wireless USB stick TP-Link TL-WN722N and I want to create a wireless hotspot that automatically gets started upon wireless USB plug in. After following the instructions

I have installed all the necessary programs needed and created the following script to start the hotspot in one move:

#!/bin/bash

#first stop everything that could be run
service isc-dhcp-server stop
service hostapd stop
sleep 3

#start running things!
#Don't let network manager take over control of wifi
nmcli nm wifi off
#unblock wifi which was turned of
rfkill unblock wifi
#give static ip to wlan interface
ifconfig wlan0 up 10.0.0.1 netmask 255.255.255.0
#start dhcp server and hotspot services
service isc-dhcp-server start
#service hostapd start
hostapd -d /etc/hostapd/hostapd.conf

I have given the proper execute permissions and if I run this file from the terminal myself the hotspot works perfectly!

Now in order to make the file run usb hot plug, I created a udev rule with the following content:

SUBSYSTEM=="net", KERNEL=="wlan0",ACTION=="add", RUN+="/pathToMyScript.sh"

The script executes on usb hot plug, but hostapd service fails to start. It fails with things like:

'nl80211: Failed to set channel (freq=2412): -16 (Device or resource busy)'
'Could not set channel for kernel driver'
'Interface initialization failed'

I believe, it has something to do with what is also being run by udev rules. I changing my rule's priority to different levels like 39 (to be loaded first), 70, 79,80,99 (last loaded) but unfortunately with no result.

I point out again that If I start the script manually it starts correctly.

I appreciate your help and suggestions.

Thank you

mitsos1os
  • 121

0 Answers0