Erratic hotspot problems

Hi all, :wave:

I´ve encountered some intermittent problems when using my PC as a hotspot.

Here´s the scenario:

I have a Linux desktop PC (Linux LIte 6.2) and a Linux laptop (Linux Lite 6.4). The desktop is my main computer and I set up a hotspot with it so that the PC provides the hotspot for the laptop.
The laptop can then access the internet via wlan (or wi-fi) as it connects to the PC´s hotspot this way.

Now to the problem:

Sometimes - but by no means always - the laptop cannot connect to the hotspot described above. I don´t know why that is. :thinking:

Often times it works well, but sometimes it doesn´t. Both devices are very near to one another, so physical distance cannot be the problem.

Plus: the laptop “sees” the hotspot as a potential wifi connection. It´s just that it doesn´t connect to it.

I tried to investigate by having a look at the desktop´s log messages. I used lnav for that.
I stumbled upon this entry:

wpa_supplicant[790]: Note: nl80211 driver interface is not designed to be used with ap_scan=2; this can result in connection failures.

I´ve no idea whether this is hint to the problem. It might be. :thinking:

I looked around on the entire system. There seems to be no “wpa_supplicant.conf”.

But I found this hint on : ubuntuusers

If a WLAN access point is to be operated on a Linux computer, hostapd is required, not wpa-supplicant.

I guess this could apply to me then.

So it appears that my Linux distribution may rely on the hostapd package to set up a wireless access point (hotspot) instead of wpa_supplicant.

On the other hand

… I found out it shouldn´t be too difficult to establish a hotspot on Ubuntu systems
(Hotspot auf PC einrichten › Howto › Archiv › Wiki › ubuntuusers.de):

I did it this way:

  • started nm-connection-editor which gave me a GUI for settings

  • added a Wi-Fi connection

  • chose “Hotspot”

the Wi-Fi tab looks like this now:

Connection name: hotspot        
SSID : hotspot
Mode: Hotspot
Band: Automatic
Channel: default
Device: [empty]
Cloned MAC address: [empty]
MTU: automatic

the Wi-Fi security tab:

Security: WPA & WPA2 Personal
Password: [my password]

That´s it.

When I enable the netis WIFI dongle on my desktop PC I get the entry “Connect to hidden Wi-Fi network” and under “Connection” I use the entry “hotspot” and then click on “connect”.

BTW:

I found on my desktop PC this config file:

/etc/NetworkManager/system-connections/hotspot.nmconnection

and it looks like this:

sudo batcat hotspot.nmconnection
───────┬────────────────────────────────────────────────────────────────────────
       │ File: hotspot.nmconnection
───────┼────────────────────────────────────────────────────────────────────────
   1   │ [connection]
   2   │ id=hotspot
   3   │ uuid=e8a39b7e-66b7-4624-a743-95869a0ed2f8
   4   │ type=wifi
   5   │ autoconnect=false
   6   │ timestamp=1674062032
   7   │ 
   8   │ [wifi]
   9   │ mode=ap
  10   │ ssid=hotspot
  11   │ 
  12   │ [ipv4]
  13   │ method=shared
  14   │ 
  15   │ [ipv6]
  16   │ addr-gen-mode=stable-privacy
  17   │ method=disabled
  18   │ 
  19   │ [proxy]

I cannot see anything wrong in it… :question:

Well, as I said, the phenomenon of the laptop not being able to connect to the hotspot is intermittent.
Mostly it works. Yesterday it didn´t … at first.

After the laptop failing to conenct to the hotspot I tried providing my Android smartphone as a hotspot.
That worked. The laptop immediately connencted to it. :smiley:

Right after that experiment I thought: Why not give it a try with the desktop hotspot once more?
This time it went well. The laptop connected to the desktop-hotspot in a jiffy. :smiley:

I have no explanation for that behaviour. :thinking:
Does anybody of you kind folks care to venture a guess?

To be clear: I do not necessarily want to change anything in my configuration as it seems to work … most of the time.
I don´t want to take any chances and making things worse.
But I certainly would like to know what´s going on…

Thanks so much in advance.

Many greetings from Rosika :slightly_smiling_face:

Hi Rosika,
Its in /etc/wpa_supplicant… look in the laptop, thats where you need it… it controls wifi permissions, ie it tells the laptop how to connect to the hotspot

Be warned, configuring wpa_supplicant.conf is one of the most frustrating exercises in Linux. Some apps will actually modify wpa_supplicant.conf, and that can make behaviour rather inconsistent.

Start with a minimal config that works… there is an itsFOSS article on that. I will find it for you tomorrow… then add fine tuning to that.

You must be close to getting it right… it connects to the phone ok

Regards
Neville

1 Like

Hi Neville, :wave:

thanks for the suggestion. I´ll look it up next time I start the laptop.

I see.
Well, in actual fact I installed barrier after I had set up the hotspot. It may very well be that the hotspot problem presented itself after that… :thinking: .

What I still cannot understand is why the hotspot connection works most of the time… and only sometimes it fails…

Thanks a lot, Neville.

Many greetings from Rosika :slightly_smiling_face:

1 Like

Hi Rosika,
This is a good resource on WiFi

Here is what I have in Gentoo wherre I hand configured WiFi

/etc/wpa_supplicant/wpa_supplicant.conf has

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
update_config=1

network={
	ssid="my sid"
	psk="my password"
}

/etc/conf.d/wpa_supplicant has

wpa_supplicant_args="-B  -Dwext -iwlp0s20u9 -c/etc/wpa_supplicant/wpa_supplicant.conf"

I had to use the wext driver

That is for wifi to connect to a modem.
A hotspot may require some variation.

I made the following comment when the above was posted

Now I have a minimal config that works… all the examples you read are full of unnecessary sophistication… need to get rid of all that and just get the essentials.
I have seen wpa_supplicant.conf files that are dozens of lines long. Mine is 6 lines. It is easier to do that and then add things later if you need fancy features.

I still thing starting minimal is the best approach.

Regards
Neville

It was not an Abhishek article, it came from here

1 Like

Hi Neville, :wave:

thank you very much for looking that up for me and thanks indeed for providing the 2 links.

In the course of my investigations (other topics) I also stumbled upon baeldung resources. I think they provide really good information.

I´ll look up what the links have to say. :+1:

O.K., I see you´re referring to wpa_supplicant here…

But what about the statement made by ubuntuusers: :question:

Wouldn´t be that a hint to install/use hostapd rather than wpa_supplicant :question:

Thanks a lot and many greetings from Rosika :slightly_smiling_face:

H Rosika,
I am out of my depth there.
Never heard of hostapd… i looked it up
Hostapd is for the computer running the hotspot, it seems.

Where do you think the problem is… in the desktop (hotspot) or in the laptop.
My wpa_supplicant setup would be for the laptop… ie for the client.

Sorry I may have been off track there.
Regards
Neville

1 Like

No, no, you´re quite right, Neville.

I wish I knew.

I think it has to be the laptop (client), by I´m not sure.
I would guess so as the laptop always “sees” the hotspot entry as a possible available connection. So the desktop provides it.

On the other hand:

This “error” message is delivered in the log-files by the desktop (host)… :thinking:

This is a pretty complex “problem”, it seems.

Perhaps it´s best to wait for another connenction failure and then I can look up the log-files in the laptop.
This might provide us with some further clues… :thinking: .

Thanks so much, Neville, for your help. :heart:
Many greetings from Rosika :slightly_smiling_face:

Hi Rosika,
You have to start there.

This is interesting but not a solution

Perhaps it´s best to wait for another connenction failure and then I can look up the log-files in the laptop.

Good idea. You nee info.

Regards
Neville

2 Likes

Thanks, Neville, for the link, :heart:

I´ll have a good look at it.

Right.
In fact last time I copied the system logs of the laptop to my desktop (with the help of barrier) to have them available there. But these are the logs of a successful hotspot connection … as it worked well last time . :wink:

So we´ll have to wait.

Thanks again and many greetings.

Rosika :slightly_smiling_face:

2 Likes

Hi Rosika,
I do not see why you need to use a hotspot to communicate between 2 machines
I think you can just use a simple local private network
If you want to try do this

  • disable the hotspot in your desktop
  • in the desktop give the wireless interface a static IP address …something like 192.168.xx.1
  • in the laptop give the wireless interface a static IP address… like 192.168.xx.2
  • thats it, they both belong to the network 192.168.xx.0… they should talk … try a ping
  • you could put the ip addresses in /etc/hosts so you could use hostnames

There is no ‘connect’ with a static network, no authorisation, they are always connected.
You only need wpa_supplicant when there is authorization like with a modem or an hotspot

I must admit I have not tried this… I use ethernet rather than wifi. It should behave the same as an ethernet link… I dont see why wifi would be different. Maybe someone can correct me here?

Regards
Neville

I think what I am talking about is called adhoc

2 Likes

Hi Neville, :wave:

O.K., I should´ve made my personal setup clearer in the first place. Sorry. :slightly_frowning_face:

It´s not just that I want some sort of “communication” between the two machines.
The main reson for providing a hotspot to the laptop is to give it internet access.

Unlike most of you (I guess) my scenario is a bit different as I don´t have a “central” router to which all machines (PC, laptop, smartphone) would connect (either via LAN or WLAN).

I have a 4G stick for mobile connection and this one is connected to the PC.

So if I want to install any packages or perform updates on the laptop I would have to eiher disconnect the stick from the PC and connect it to the laptop (awkward :neutral_face: ) or
setup a hotspot on the PC and provide it to the laptop.

With the additional installation of barrier on both machines it´s easy to copy files etc. as barrier supports clipboard exchange as well.

So what you suggested, Neville, won´t probably work, right?

In the laptop (with the hotspot) another range of ip addresses is used:

ip a on the laptop says: 10.42.0.126 .

Thanks for the link, Neville. I´ll look it through.

Cheers from Rosika :slightly_smiling_face:

I think you misunderstood me.
You want to link your 2 machines, so the laptop can access internet
The ideal would be an ethernet link… but you dont have that… so I thought you could do the same thing with wifi… I think it is called ad-hoc wifi.
If it works, the laptop would automatically route all its internet requests to the desktop …
just like a guest VM automatically routes all its internet traffic to the host.

I started testing it… Got my main desktop setup for adhoc and gave it an ip address.
Then the other small desktop was tied up compiling gentoo… I had to wait. Will finish testing it tomorrow.

Hang on till I test it
Neville

2 Likes

Oh, I see. Neville.

Yes, I think I misunderstood you.
Thanks for testing. :heart:

BTW:

I just powered up the laptop and again: the hotspot provided by the PC worked immediately… or rather: the laptop connected immediately to it. :wink: .
That´s what I said in the beginning: it mostly works…

Thank you so much, Neville.

Many greetings from Rosika :slightly_smiling_face:

2 Likes

Just had a thought about your 2 PC’s. I don’t know how far apart they are, but I believe an Ethernet cable connected to the 2 PC would allow you to bridge the internet connection form the desktop to the laptop.

3 Likes

Hi Howard, :wave:

thanks for the suggestion.

Well, the two machines are pretty close to one another. So the cable solution should work.
I´d have to buy one first though.

So if everything else fails, I´d consider that.

But, as I said, yesterday and today I didn´t run into any difficulties with my hotspot setup.
I was just wondering why I at some point in the recent past would have encountered any connection problem in the first place… :thinking:

Thanks again, Howard.

Have a nice day and cheers from Rosika :slightly_smiling_face:

I did not realise you had ethernet ports in both machines… .
Howards suggestion is the best option

2 Likes

Hi Neville; :wave:

I actually had to look it up, as I never used the laptop´s ethernet port before. :wink:
The manual says:

If your notebook has an Ethernet network connection, you can connect it to a network.
Connect one end with the RJ45 connector to your notebook’s network interface and the other end to another computer or hub/switch.

I´m not quite sure what is meant with “…the other end to another computer”.
Does it mean I can/should connect the PC with the laptop using the ethernet ports of both devices (with RJ45 plug) ?

Many greetings from Rosika :slightly_smiling_face:

Hi Rosika,
Yes , that is what it means. If both computers have an RJ45 plug, you can run an ethernet cable between the two computers. If you have more than 2 computers , you need to connect each of them to an ethernet hub or switch.

The only possible problem would be if one of the computers did not have drivers for its ethernet port. That would be unusual in an old computer.

Regards
Neville

2 Likes

Hi @Rosika ,
I am having trouble doing the test.
I got the wireless port up in adhoc mode in the large desktop. It comes up automatically.
But in the smaller desktop, I have a wifi dongle , and it will not bring the interface up in adhoc mode.
I can see the interface with ip addr , so it has drivers, but it stays DOWN even when I click on it and say connect.
I suspect issues with Network Manager.
We might abandon this approach.

Regards
Neville.

2 Likes

Hi Neville, :wave:

Thanks for the confirmation, Neville.

Sorry, I don´t quite understand. What is a “frover”? Couldn´t find anything suitable in my translation app… :thinking: .

Thanks for trying it out, Neville. :heart:

The settings in my nm-connection-editor-GUI under WIFI (and here: Mode) are:
client, hotspot, ad-hoc.
I used hotspot and it works well (i.e. 9 out of 10 cases, more or less).

Many greetings from Rosika :slightly_smiling_face:

2 Likes