'The insanity of wifi, iwd, wpa_supplicant, iw, ip, dhcpcd'
This will be a bit long, but for people interested in the subject line, it may be worth looking at.
I've been trying to decide between wpa_supplicant and iwd. Although one (iwd) is intended to be a replacement for another (wpa_supplicant), it doesn't actually work that way. As a good example of that, I tried booting a Microsoft Surface laptop from my USB with and Arch installation on it. Turns out that the Surface could not use iwd to connect to the wifi network I was on, but wpa_supplicant did it instantly and easily.
On the other hand, using a laptop with Arch installed in a public library that uses a user/password access to its wifi only through a browser, wpa_supplicant cannot function, but iwd works extremely well.
Exasperated by these differences, I have been trying a variety of options. At the library, for example, wpa_supplicant's conf file successfully connects (or so it reports). But it turns out not to be true (no connection is found when trying to log in from the browser. So I thought that I shouldn't need wpa_supplicant (since the SSID doesn't require a password...again the login is through a browser with a dynamically assigned username and password).
I used iw, ip, and dhcpcd to get connected and then went into the browser. Iw says I'm connected, but dhcpcd doesn't get me an ip address...it just says it's sending master commands (or some such thing). And the browser won't let me login.
The only thing that works is iwd. Start that, establish a connection to the SSID (again, no password), start the browser, and logged in and connected in a flash.
I know that I can use netctl to automate this whole process...or any number of other managers. But it seems to me that it shouldn't be so confounding to use these basis tools. For me, a Linux user for decades and an Arch user for more than one decade, it's a pet peeve of mine that this is so difficult. Together with the silly Bluetooth stuff (bluetoothctl? really?).
About this post
- Posted
- Archived
- Score
- 194 · 100% up
- Kind
- Text
- ID
- eusuif
85 comments
Deleted before we saved it.
Very familiar with NetworkManager and all the others. I mentioned in my original post that I know I can use netctl (which I prefer to NetworkManager). My complaint about the poor performance of the more basic approaches stands.
I have never not been able to connect to wifi using one of the three methods I mentioned: wpa_supplicant, iwd, or iw/dhcpcd. And I prefer all of those to netctl and NetworkManager. I just think that it would be better if one of either iwd or wpa_supplicant worked in all fairly normal circumstances
typical Linux user: insisting on using something more difficult and then complaining that it doesn't work, instead of just using what works and making your life easier
This. Network Manager works for like 90% of cases.
I'd go higher.
It's also a complex software suite.
For simple configurations, sure.
Once you are beyond trivial cases (i.e. one interface, dirt simple routing), I have never seen it work properly (source: 1,000s of datacenter and cloud hosts). It's literally the first thing I disable.
Using anything other than NetworkManager to connect to a secured AP, especially from the CLI, is about as fun as smashing your hand with a hammer.
have you tried
wifi-menu?iwdmakes it extremely easy when you're usingiwctl.Connman isn't toooo bad, especially once you have a profile written. Biggest thing is that the documentation is lacking.
But it uses wpa_supplicant by default so you still get the same issues, no?
can someone tell me why NM reconnects when i restart the X session? that is the biggest reason i prefer iwd over it
My guess is you have a 'user connection' configured rather than a 'system connection'. A user connection is for your user alone and the configuration is stored in your homedir (ie. ~/.config or whatever), so the connection isn't activated until you are logged in and is deactivated upon logout. A system connection is managed by the system, so the connection is activated at system startup and stays connected until shutdown. A system connection is available to all users on the system.
When editing the connection in your desktop gui, there should be an option that says something like "All users may connect to this network" (I'm using KDE Plasma), which is a confusing way to say 'make this a system connection'.
Y’all don’t use iwd with network manager? I found when using network manger with iwd as the WiFi- Backend honestly made things faster and better
I ask as someone not an expert in Linux - is NetworkManager the default in any distro? Is it whats linked to 'network settings' in the menu/tray icon? Does it work independent of DE?
Or is it something a user needs to install in which case most people won't since they won't even know its there.
Yes. it's the standard and default on desktop distros.
Can you help me configuring express vpn with Network Manager by any chance? The eVPN manual is kinda shit.
Generally any help with vpn + NM is appreciated.
You're really confusing a few things.
Here are the two setups you can use for 99% of networks:
There is no need in the present day to run dhcpcd directly unless systemd-networkd fails to work. (e.g I setup bonded network on a server and for whatever reason it caused systemd-networkd's DHCP to not work so I had to use dhclient).
I'm not confused and I understand that the captive portal is separate. I only resorted to iw as an alternative to iwd, which, as I said in the beginning, worked perfectly. We're in agreement (and I thought I had made myself clear, but obviously didn't): wpa_supplicant or iwd (Ive been using networkd and resolved for a while now) will get the job done. What we may not agree about is that I don't think it should require two things instead of one, especially in light of the fact that iwd was developed to replace wpa_supplicant. I have written scripts for both iwd and wpa_supplicant. When one doesn't work, I use the other. As I said, I know I can connect (and, by the way, I can always also use netctl). My comments were intended as a sigh of exasperation that I need to have two scripts for two programs, instead of just one.
Why are you using dhcpcd in addition to systemd-networkd?
I use a script to circumvent bluetoothctl, but I still think it's another example of a piece of software that could be much better than it is. As with Wifi, my complaint is not that I can't get these things to work...I can and do all the time. Nor is it that a script can't be written to circumvent the flaws in the software or to speed things up or reduce the amount of effort. I write my scripts in Python and they are very effective at doing all of that.
But bluetooth and wifi are essential component of working with computers. Imagine, for example, if every time you booted, you had to run scripts to get your screen to light up and show graphics, or scripts to make your keyboard work. I consider wifi and bluetooth as integral to pcs and laptops as keyboards and display screens (I tend not to use a mouse very much, so I'm not including that).
I'm beginning to agree with what others are hinting at. You have gaps in your understanding and knowledge and are blaming the underlying technologies for that. The best technologies in the world will fail if applied incorrectly.
Step back, breathe, look at things from a different viewpoint.
FYI - I've created incredibly complex and secure wireless networks leveraging WPA/2, 802.11x, captive-portal/MAC-filtering, etc. iwd handles them all. You're doing something wrong.
I'm not sure what you're saying here. You haven't described what you tried or any problems you encountered, just "it didn't work".
IWD is indeed a replacement for wpa_supplicant. It should be able to connect to most any wireless network wpa_supplicant can save for perhaps some extremely esoteric security profiles.
If you want help, ask a question.
Sounds like a captive portal to me.
iw is not equivalent to IWD/wpa_supplciant. It does not support wpa/wpa2 whatsoever. Associating with a station is not the same as authenticating.
On the contrary, both iwd and wpa_supplicant expose the underlying configurations of wpa personal and enterprise configs in a fairly straightforward way. Those configurations are frequently not simple leading to frustrations on other platforms when users try to connect with whatever interface the UI designer decided to expose (Does username mean my EAP Identity? How do I select MSCHAPv2 here?).
That doesn't make wpa user friendly, but it does make the utilities much simpler to use for anyone who is already familiar with wpa. Frankly, that's exactly the kind of design I'd expect a "Linux user for decades" to really appreciate.
My appreciation of Linux is profound, but not because I think it's a user friendly operating system. My commitment to it comes from my love of the fact that there is virtually no issue that I can't resolve, given the time and patience to work on it.
I didn't ask for help because I don't need it. I'm on WiFi in each of the instances I mention. In the case of the library, I tried is precisely because the said did not require a password. Only after connecting to their WiFi and using a browser are you asked for a username and password. And iwd worked fine for that. It didn't work with a Microsoft Surface, though. I noted my Linux experience to remove any suggestion that these flaws were simply a reflection of my inexperience. They aren't. I'm fact, as I've said repeatedly, in each case, I connected to the WiFi device and to the internet. I just would prefer if it didn't require as much attention as I had to give to it.
Wait, what. That is quite the difficult read to be honest.
If I understand that correctly, you seem to be trying to connect to a captive portal. For that my go-to config file, whose content I found on the AL forums, for wpa_supplicant is this:
Then firing up wpa_supplicant with that config makes your browser show a popup after a few seconds or after you tried to visit a website so the router and your wifi chip shake hands or whatever this magic is called. Not trying to be funny here. So that is something that has at least been working for the hotels' networks I have been using in the last 1.5 yrs.
edit Forgot a few words
I am unfamiliar with 'pairwise=NONE', which may make a difference. I'll give that a try with the library situation. Thank you. Not incidentally, the library's SSID includes a hyphen, which required me to convert it to hex before putting it in the ssid line of wpa_supplicant.conf. That, too, it seems to me, shouldn't be necessary. Iwd accepts 'special' characters. But wpa_supplicant is troubled by them.
Thanks again for the 'pairwise' line. I will hope that it works.
... are you sure? I could swear when one hotel's SSID included a funny character all I had to do was to escape the character.
Since I sent off the other reply so fast, meh. But here is another bit.
The default values for the options should be, if I'm not mistaken, sufficient. However I started to hate it and got angry and think "rather safe than sorry" is better and I will use them until Linus assures me otherwise.
Not sure if I understood you:
So your only objection against iwd is that it didn't work out of the box with a Microsoft Surface laptop?
or is there anything else? I mean if it's just this, why not just using wpa_supplicant during installation and iwd later? (as it seems to fix your library wifi issues)
My objection is that if iwd is intended to replace and improve upon wpa_supplicant, then it should work under the same circumstances. But it didn't with the Surface, which isn't exactly an exotic brand. It's absolutely right that, between the two, I've never encountered a WiFi situation I couldn't handle. My complaint is that it shouldn't take two.
did you report your issues with the Surface? IWD is not that old.. and you tried running it on a live ISO.. maybe there has been other issues (kernel issues etc).
Note that you used the word "intended". An intention or a plan do not represent the current status.
Yeah the issue is that the library uses a captive portal. So your wifi will connect and that's why wpa supplicant looks like it's working because it is connected but the captive portal won't hand out a DHCP address unless the captive portal steps have been satisfied by logging in or agreeing to the terms of the wifi. This is all expected behavior.
Captive portals are picky. Often needing a non SSL web page to get a proper redirect. I like http://nossl.com to force the captive page to fire after I've connected if it doesn't auto popup. Once you hit that I agree button it works fine but you must authenticate and then your devices mac address gets the green light for DHCP.
Try connecting with wpa_supplicant and then opening that nossl web address to see if you get the terms. I feel like wpa_supplicant has a problem where it doesn't keep trying for DHCP after the initial connection and that's why captive portals are a pain with it but I'm not 100% sure.
This is a great response. Thank you. I will give the nossl site a try next time I go to the library.
Well if you want something that isn't NetworkManager there is ConnMan. It can do a lot, and with a comfy cli.
I'm perfectly OK playing with wpa_supplicant, iw and dhclient.
But for desktops, installing NetworkManager is pretty important. So you can actually work on the stuff you're there for.
Understood. When I was a working person, I would not have bothered playing around with these things. As a retired person, this stuff is now my hobby. I used to use a full fledged Gnome; now I have slimmed down to an Openbox Arch install with lots of keyboard cli programs. I try to avoid the mouse and I try to avoid bloat. But these are just fun personal goals and preferences. Not recommendations.
By any chance were you not taking the DNS address offered by the library’s Dhcpd?
Sometimes they’ll give you a fake domain to use as their portal, and you’ll only be able to connect if you’re using their DNS server.
I run an ad-blocking cloud DNS (Pihole NextDNS - highly recommended, btw). But when I try to login at Starbucks or hotels, I often have to turn off that DNS for a minute so I can pop up their portal.
i didn't consider this and, as I'm not at the library, I can't tell you if you're right. I'll try to explore this one next time I'm there. Thanks for the suggestion.
When you install arch, make sure you do not enable any kind of networking services, just start them. Only install network manager and dhcpcd on your system. when you login to your install, enable networkmanager and install whatever desktop you want to install. (most of them works out of the box with network manager) . Restart. And that does the job. I had the same confusing routine with iwd and other various network services until I found the right way to install them from the start.
+1 for Network Manager and OpenVPN.
Honestly, I try to avoid dealing with wi-fi until after I have my graphical environment set up. If I must use wi-fi before that point, I just do the bare minimum to get it running and set it up correctly with the GUI.
I use ‘sudo wpa_supplicant -B -wlp2s0b1 -c/etc/wpa_supplicant.conf’ followed by ‘sudo dhcpcd’ everytime I want to connect to my network. I must wait a like 5-10 seconds before issuing the dhcpcd command for it to register an ip, I figure because the connection to the network is still ongoing otherwise? Anyways this has been the easiest for me although I’m sure there’s probably a service to enable to make it automatic...
As others have noted, if you enabled systemd-networkd, you won't need to run dhcpcd.
Deleted before we saved it.
Sounds like the situation is mostly fine. iwd is the future, but you have some hardware that doesn't support it. For any piece of software, I'm sure I could find a piece of hardware that won't work with it.
I guess it is a little weird that the Microsoft Surface, which is I think a fairly popular laptop, doesn't work with Linux. But it is targeted specifically at Windows, being MS hardware and all, so maybe we don't have to judge them for picking some weird WiFi hardware.
iwd has a dhcp client built in but wpa_supplicant doesn't... so it's not surprising that you couldn't access the portal after connecting to the access point with wpa_supplicant but you could with iwd, as you suggest that you only manually run dhcpcd when using iw.
Deleted before we saved it.
While you were being a h4x0r by insisting to use very low level tools then complain about them, you forgot to find a justification of why not use one of the multiple perfectly functional wrappers like nm-cli/wifi-menu.
Sorry for the omission. I have used wifi-menu often in the past. It's very good.
Iwd doesn't work reliably even on a simple setup. Wpa supplicant + network manager works 100% always.
This is why so many people can't use Linux....