Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] laptop does not rejoin wifi
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
o5gmmob8
Guru
Guru


Joined: 17 Oct 2003
Posts: 583

PostPosted: Wed Apr 02, 2025 1:45 pm    Post subject: [SOLVED] laptop does not rejoin wifi Reply with quote

I turn off my WIFI nightly when I'm asleep for the perception of reducing the attack surface (separate topic).

My phones and tablets all reconnect fine, but my Gentoo laptop does not unless I restart the networking service. It seems like the wifi service is a single shot service meaning whatever it sees at the time it starts is what it uses and does not appear to attempt connecting after that.

I have symlinked my wifi interface to net.lo and configured my wifi to use wpa_supplicant and DHCP. I have briefly tried to migrate toward iwd, but didn't have much luck.

I would prefer not to write a script(s) to monitor the network status and restart wifi if it does not have an IP. Is there another utility that I can use that would support this functionality? Or perhaps, I'm missing a configuration?

EDIT:
I use ifplugd for the ethernet and see that I should be able to use that for wifi too:
https://wiki.gentoo.org/wiki/Handbook:AMD64/Networking/Dynamic


Last edited by o5gmmob8 on Sun Apr 06, 2025 12:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 2116

PostPosted: Wed Apr 02, 2025 2:28 pm    Post subject: Reply with quote

o5gmmob8 wrote:
I use ifplugd for the ethernet and see that I should be able to use that for wifi too:
https://wiki.gentoo.org/wiki/Handbook:AMD64/Networking/Dynamic

Note that ifplugd uses the ancient, deprecated WEXT method for wifi support. This may not be a reliable source of info and could get dropped from the kernel at any point.
(ifplugd itself is ancient and hasn't been updated in 20 years)

Edit: Notably WiFi-7 devices, 802.11be the successor to 802.11ax, will never work with wireless extensions at all even in a compatibility mode.


Last edited by grknight on Wed Apr 02, 2025 2:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
o5gmmob8
Guru
Guru


Joined: 17 Oct 2003
Posts: 583

PostPosted: Wed Apr 02, 2025 2:33 pm    Post subject: Reply with quote

Ah ok, should I use something else then for both wired and wireless?

I can write a shell script, but there must be something out there that I have not stumbled upon that also does the same thing, but better.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23345

PostPosted: Wed Apr 02, 2025 3:38 pm    Post subject: Reply with quote

There is sys-apps/netplug, which is considerably more recent at only 15 years since its last update (2010-06-26). ;) I cannot comment on whether it can handle your wireless as desired.
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 506
Location: Gainesville, FL, USA

PostPosted: Wed Apr 02, 2025 5:58 pm    Post subject: Reply with quote

Try the easy things first. Is wpa_supplicant configured to scan for networks? Be sure this line is near the top of /etc/wpa_supplicant/wpa_supplicant.conf:
Code:
ap_scan=1


I can tell you I don't get an automatic connection unless I specify that directive.
Back to top
View user's profile Send private message
o5gmmob8
Guru
Guru


Joined: 17 Oct 2003
Posts: 583

PostPosted: Thu Apr 03, 2025 12:11 am    Post subject: Reply with quote

Ah, good catch. I was looking at scan_ssid=1 for each network.

Which one is preferred?
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 506
Location: Gainesville, FL, USA

PostPosted: Thu Apr 03, 2025 5:16 am    Post subject: Reply with quote

It's taken a pretty good dive into the wpa_supplicant source code, but now I've got an answer.

Yes, you want ap_scan=1. This setting instructs wpa_supplicant to do the scanning; the other legal values, 0 and 2, leave the scanning to the driver. Many drivers (including evidently yours) do not have a scanning function. The scan_ssid setting applies only for drivers that can do the scanning.


There is no nice, cogent documention for these settings: they are described in block comments in the source files. Here is where to look:

* Global settings for the network interface (ap_scan, update_config, etc.): comments describing the members of struct wpa_config declared in wpa_supplicant/config.h. The names of the members of this structure are the same as the corresponding keyword in the configuration value. These comments often don't show the legal values; for this, consult the entries in the global_fields array in wpa_supplicant/config.c.

* Per-network settings (ssid, psk, etc): see the members of struct wpa_ssid declared in wpa_supplicant/config_ssid.h. Just as for the global settings, look to the entries of ssid_settings in wpa_supplicant/config.c to find the legal values for these entries.
Back to top
View user's profile Send private message
o5gmmob8
Guru
Guru


Joined: 17 Oct 2003
Posts: 583

PostPosted: Thu Apr 03, 2025 10:23 am    Post subject: Reply with quote

I switched from scan_ssid=1 to ap_scan=1 at the global level and that did not seem to work. This morning, my machine did have an ip address, so scan_ssid at the ssid level did appear to work.

EDIT:
I tried again back with my original configuration that appeared to have worked last night and it presently looks like it also did not work.

My router runs ifconfig wlan* down and then ifconfig wlan* up nightly. I did the same now manually, but for whatever reason, it seems the laptop doesn't want to get an IP now.
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 506
Location: Gainesville, FL, USA

PostPosted: Thu Apr 03, 2025 12:27 pm    Post subject: Reply with quote

o5gmmob8 wrote:
I switched from scan_ssid=1 to ap_scan=1 at the global level and that did not seem to work. This morning, my machine did have an ip address, so scan_ssid at the ssid level did appear to work.

It seems to be a question of what hardware you have and what its driver will do. You've hit on what works for your setup.
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 767

PostPosted: Thu Apr 03, 2025 1:32 pm    Post subject: Reply with quote

o5gmmob8 wrote:
I did the same now manually, but for whatever reason, it seems the laptop doesn't want to get an IP now.
Are you 100% this is a wireless connection issue and not your dhcp client messing up? Use wpa_cli status to check the status of the wifi side, look for wpa_state=COMPLETED. Once you are sure the wifi is "working" then move on to dhcpcd/dhclient.
Back to top
View user's profile Send private message
o5gmmob8
Guru
Guru


Joined: 17 Oct 2003
Posts: 583

PostPosted: Thu Apr 03, 2025 7:03 pm    Post subject: Reply with quote

Code:
Failed to connect to non-global ctrl_ifname: (nil)  error: No such file or directory


Code:
/etc/init.d/net.wlp3s0 status
* status: inactive



Code:
dmesg -T
[Thu Apr  3 06:30:37 2025] wlp3s0: authenticate with e8:9f:80:aa:46:f0 (local address=)
[Thu Apr  3 06:30:37 2025] wlp3s0: send auth to  (try 1/3)
[Thu Apr  3 06:30:37 2025] wlp3s0: authenticated
[Thu Apr  3 06:30:37 2025] wlp3s0: associate with  (try 1/3)
[Thu Apr  3 06:30:37 2025] wlp3s0: RX AssocResp from (capab=0x11 status=0 aid=1)
[Thu Apr  3 06:30:37 2025] wlp3s0: associated


I tested this in the morning, but don't recall the precise timing. I will try again now.

EDIT:
It automatically connected to my upstairs wifi AP when I restarted the service. I ran wpa_cli disconnect to disconnect from it and it did, but should I expect it to automatically connect to the best AP at that point in time then?

EDIT:
I've used networkmanager in the past and believe that it will likely work in this case, but I feel it is a bit heavier and wanted a nuts and bolts type system. I'll give that a try and see what happens.
Back to top
View user's profile Send private message
o5gmmob8
Guru
Guru


Joined: 17 Oct 2003
Posts: 583

PostPosted: Sun Apr 06, 2025 12:14 pm    Post subject: [solved] Reply with quote

I ended up migrating to iwd and as advertised, I think that works better in the sense, it is quicker to associate. I am using netifrc with iwd as the backend and it seems to work reliably, I don't need network manager which I think is overkill. I run a tiling WM, so I try to avoid fluff.

I tested turning my router wifi on and off and my laptop was able to quickly associate without any intervention on my behalf. Additionally, using dhcpcd allows me to easily hook into the events it triggers (as does network manager), so I can take action when the laptop joins a wifi network.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum