You are not logged in.

#1 2024-06-26 15:00:34

gabtram
Member
Registered: 2023-04-11
Posts: 64

[Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

Hi to all,

how are you? I hope you well!
So i write to you after read this pages:
https://wiki.archlinux.org/title/Network_configuration/
https://wiki.archlinux.org/title/Wpa_supplicant

I haven't need a wireless connection before..but lastly i'm bringing my laptop with me and some time i need to connect with a wireless connection.
So i configure all.
Finding the right card, was wlp2s0 but it changes to wlan0.

gab@archmusic ~ $ sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
[sudo] password for gab:
Successfully initialized wpa_supplicant
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured

ctrl_iface exists and seems to be in use - cannot override it
Delete '/run/wpa_supplicant/wlan0' manually if it is not used anymore
Failed to initialize control interface '/run/wpa_supplicant'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.

wlan0: CTRL-EVENT-DSCP-POLICY clear_all
wlan0: CTRL-EVENT-DSCP-POLICY clear_all
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
gab@archmusic ~ :( $ wpa_gui
gab@archmusic ~ $ ip link
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether xxxxxxxxxxxxxx brd xxxxxxpermaddr xxxxxxxxxxxxxxx
gab@archmusic ~ $ ip link show interface
Device "interface" does not exist.
gab@archmusic ~ :( $ ip link show wlan0
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether xxxxxxxxxxxxxx brd xxxxxxpermaddr xxxxxxxxxxxxxxx
gab@archmusic ~ $ sudo iw dev interface scan | less
gab@archmusic ~ $ sudo iw dev wlan0 scan | less
gab@archmusic ~ $ wpa_cli
wpa_cli v2.10
Copyright (c) 2004-2022, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.



Interactive mode

Could not connect to wpa_supplicant: (nil) - re-trying

Don't understand why wpa_supplicant start, sure i made something waht but how?
I besides installed wpa_gui and it clear can't find network and adapters. I configured the wpa_supplicant.conf file as i read in the manual.

Have some ideas?

Last edited by gabtram (2024-06-27 14:00:39)

Offline

#2 2024-06-27 07:46:21

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,875

Re: [Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

Already configured and the fact it's called wlan0 instead of wlp2s0 suggests you installed and are probably using iwd instead of wpa_supplicant at some point. Might want to double check that. In doubt post the full

find /etc/systemd -type l -exec test -f {} \; -print | awk -F'/' '{ printf ("%-40s | %s\n", $(NF-0), $(NF-1)) }' | sort -f
sudo journalctl -b

https://wiki.archlinux.org/title/List_o … n_services

Offline

#3 2024-06-27 08:56:16

gabtram
Member
Registered: 2023-04-11
Posts: 64

Re: [Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

Hi,

thanks for your response.

This is the output

gab@archmusic ~ :( $ find /etc/systemd -type l -exec test -f {} \; -print | awk -F'/' '{ printf ("%-40s | %s\n", $(NF-0), $(NF-1)) }' | sort -f
sudo journalctl -b| curl -F 'file=@-' 0x0.st
dbus-org.freedesktop.nm-dispatcher.service | system
dbus-org.freedesktop.timesync1.service   | system
gcr-ssh-agent.socket                     | sockets.target.wants
getty@tty1.service                       | getty.target.wants
gnome-keyring-daemon.socket              | sockets.target.wants
NetworkManager.service                   | multi-user.target.wants
NetworkManager-wait-online.service       | network-online.target.wants
p11-kit-server.socket                    | sockets.target.wants
pipewire-pulse.socket                    | sockets.target.wants
pipewire-session-manager.service         | user
pipewire.socket                          | sockets.target.wants
remote-fs.target                         | multi-user.target.wants
systemd-timesyncd.service                | sysinit.target.wants
wireplumber.service                      | pipewire.service.wants

http://0x0.st/XmQe.txt

Yesterday, following instructins on screen, i was able to clean my configuration file witch

sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/run/wpa_supplicant
update_config=1
p2p_disabled=1

network..

then installing dhcpcd to give a static ip to my card and then start wpa_gui.
It seems was working yesterday  i don't understand some things:
I installed dhcpcd to manage dchp client ip cause i noticed on my fritxbox that the ip of the laptop was changing after 2 minutes. I configured it with "dhcpcd.conf"
I receive a message from gui that said me that the adapter wlan 0 scan correctly wireless network, find my network, insert psk and assign the static ip i configured. But the fritzbox don't assign it and i can't connect.
Besides if i ping my router can't arrive to it.   

Another thing don't understand why

nmcli device status

said me wifi is disconnected?

I have this script that update an icon and said me if i'm connected or not. i would like to use it also fro my wi-fi signal if connected.

    CONNAME=$(nmcli -a | grep 'Wired connection' | awk 'NR==1{print $1}')
    if [ "$CONNAME" = "" ]; then
        CONNAME=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -c 5-)
    fi

    PRIVATE=$(nmcli -a | grep 'inet4 192' | awk '{print $2}')
    PUBLIC=$(curl -s https://ipinfo.io/ip)

    printf "%s" "$SEP1"
        if [ "$CONNAME" != "" ]; then
            printf " %s" # %s" "$CONNAME" ########"$PRIVATE" "$PUBLIC"?
        else
            printf " %s"
        fi
    printf "%s" #"$SEP2"

 

Thanks!

Last edited by gabtram (2024-06-27 09:15:52)

Offline

#4 2024-06-27 09:32:50

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,236

Re: [Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

dbus-org.freedesktop.nm-dispatcher.service | system
NetworkManager.service                   | multi-user.target.wants
NetworkManager-wait-online.service       | network-online.target.wants

You're using NetwokrManager to control your network setup .

NM can use wpa-supplicant IF NM controls wpa_supplicant  .
Also dhcpcd and NM conflict .

Do you prefer staying with NM ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2024-06-27 09:40:43

gabtram
Member
Registered: 2023-04-11
Posts: 64

Re: [Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

I prefer to stay with Network Manager.
So how can i do?
Unistalling dhcpcd and then? How can i instruct Network Manager to use wpa_supplicant to connect to wifi?

If i try to uninstall dhcpcd

$ sudo pacman -Rcns dhcpcd

checking dependencies...
:: networkmanager optionally requires dhcpcd: alternative DHCP client

Packages (1) dhcpcd-10.0.8-1

Total Removed Size:  0.45 MiB

:: Do you want to remove these packages? [Y/n]

Last edited by gabtram (2024-06-27 09:43:03)

Offline

#6 2024-06-27 10:13:33

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,236

Re: [Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

NM can use dhcpcd as dhcp c;lient  , but you're also using systemd-timesyncd .

systemd-timesyncd only works well with systemd-networkd* .
To use NM with dhcpcd you will need to use another ntp client, see https://wiki.archlinux.org/title/System … ronization for options.

nmcli seems to be the most popular tool for creating/changing connections, see https://wiki.archlinux.org/title/NetworkManager#Usage



* systemd-anything tends to fail when asked to cooperate with non-systemd-foo , especially when non-systemd-foo is NOT linux-specfiic like dhcpcd.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#7 2024-06-27 12:45:16

gabtram
Member
Registered: 2023-04-11
Posts: 64

Re: [Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

Hi,

thanks lone wolf.
I'd like to find the best solution.
If i understand well:
NM + wpa supplicant allow us to connect to wifi
In my case wpa supplicant can't manage dhcp so installed dhcpcd but im 'using also the systemd process timesyncd.

Now you send me a list of ntp client but i don't know quite nothing about it smile
Can you suggest me a way?
How can i create a connection with nmcli?
I'm using the gui of wpa_cli that is quite well for example

Anyway thanks so much for your interest in this topic.

Bye
Gabriele

Offline

#8 2024-06-27 13:20:16

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,875

Re: [Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

You should not be using wpa_supplicant directly and not wpa_cli or wpa_gui either, as they will talk to wpa_supplicant instead of NetworkManager. If you want to stick to NetworkManager either pick one of it's graphical frontends or stick to nmcli/nmtui.

As for time synchronisation, don't worry about that. systemd-timesyncd works just fine in conjunction with NetworkManager as well. NetworkManager will also handle dhcp with an internal implementation by default.

I'd suggest you stick to nmtui for a somewhat intuitive NetworkManager interface, it will allow you to scan for access points and connect to them directly.

Last edited by V1del (2024-06-27 13:21:02)

Offline

#9 2024-06-27 13:59:00

gabtram
Member
Registered: 2023-04-11
Posts: 64

Re: [Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

Thanks! @Vdel it was so simply! And i instead i went through staff and staff that i don't need.
Sorry but i didn't understand it first.

So now i can uninstall wpa_supplicant, dhcpcd and other thingsa.

Thanks so much

Offline

#10 2024-06-27 14:04:16

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,307

Re: [Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

No, do NOT uninstall wpa_supplicant, NM is using it. You just don't need to be using it directly.

Last edited by Scimmia (2024-06-27 14:04:29)

Offline

#11 2024-06-28 07:21:55

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,236

Re: [Solved] Wi-fi network scan and auth. Use NM with nmtui or cli

@gabtram

Sorry for confusing you .
Noticing that you had installed dhpcpcd by yourself and were looking for 'the best solution' made me assume you wanted to look at the entire network stack.
After you committed to NM I should have suggested you to accept NM defaults and focus on configuring wifi.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB