Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] wpa_supplicant connects but no IP is assigned
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
bifi.ftw
n00b
n00b


Joined: 05 Nov 2015
Posts: 24

PostPosted: Thu Apr 19, 2018 4:37 pm    Post subject: [solved] wpa_supplicant connects but no IP is assigned Reply with quote

Greetings everybody,

Some time ago I was already able to connect to wireless networks, however, not anymore.
Also I can use my laptop as a hotspot, therefore I am confident that my general setup (drivers, etc.) works.

As described in the title wpa_supplicant connects to the desired network but no IP is recieved, consequently not internet connection is available

For unknown reasons wpa_cli/wpa_gui only works as root, otherwise the error message "Could not connect to wpa_supplicant: (nil) - re-trying" is prompted.

I'm not sure which information to append, so please let me know if additional information is required.


/etc/conf.d/net
Code:
# Network group
dns_domain_lo="linuxnetwork"

# Use dhcp client
modules_enp4s0f1="dhcp"
modules_wlp3s0="wpa_supplicant"

# dhcp or fixed ip
config_enp4s0f1="dhcp"
config_wlp3s0="dhcp"

# Exclude DNS from DHCP
dhcp_enp4s0f1="release nodns"
dhcp_wlp3s0="release nodns"

# DNS server
dns_servers_enp4s0f1="37.58.63.27 46.101.70.183"
dns_servers_wlp3s0="37.58.63.27 46.101.70.183"



/etc/wpa_supplicant/wpa_supplicant.conf
Code:
ctrl_interface=DIR=/var/run/wpa_supplicant
ctrl_interface_group=wheel
update_config=1

network={
   ssid="morningstar"
   scan_ssid=1
   psk="***"
   proto=RSN
   key_mgmt=WPA-PSK
   priority=5
   disabled=1
}

network={
   ssid="eduroam"
   proto=RSN
   key_mgmt=WPA-EAP
   pairwise=CCMP
   auth_alg=OPEN
   eap=PEAP
   identity="***
   anonymous_identity="anonymous@mwn.de"
   password=***
   ca_cert="/etc/ssl/certs/Deutsche_Telekom_Root_CA_2.pem"
   subject_match="radius.lrz.de"
   phase2="auth=MSCHAPV2"
}



Message when starting wpa_gui
Code:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-b


Output of wpa_cli when connecting with home wifi
Code:

> select_network morningstar
OK
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-RESULTS
<3>SME: Trying to authenticate with 4c:eb:42:4d:6b:57 (SSID='morningstar' freq=2442 MHz)
<3>Trying to associate with 4c:eb:42:4d:6b:57 (SSID='morningstar' freq=2442 MHz)
<3>Associated with 4c:eb:42:4d:6b:57
<3>CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
<3>WPA: Key negotiation completed with 4c:eb:42:4d:6b:57 [PTK=CCMP GTK=CCMP]
<3>CTRL-EVENT-CONNECTED - Connection to 4c:eb:42:4d:6b:57 completed [id=0 id_str=]


Thank you to anybody helping me out.

bifi.


Last edited by bifi.ftw on Mon Apr 23, 2018 8:25 am; edited 1 time in total
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Apr 19, 2018 5:52 pm    Post subject: Re: wpa_supplicant connects but no IP is assigned Reply with quote

bifi.ftw wrote:
For unknown reasons wpa_cli/wpa_gui only works as root, otherwise the error message "Could not connect to wpa_supplicant: (nil) - re-trying" is prompted.

bifi.ftw ... is user in the group 'wheel'? ... you won't be able to connect to the socket, and wpa_cli/wpa_gui will fail for this reason. Otherwise, XDG_RUNTIME_DIR or '/tmp/runtime-b' is QT related it's not used by wpa_supplicant ... and so I doubt this has anything to do with it.

bifi.ftw wrote:
/etc/conf.d/net:
modules_enp4s0f1="dhcp"
modules_wlp3s0="wpa_supplicant"

I'm not sure there is a dhcp client called 'dhcp' that should be 'dhcpcd' or 'dhclient' (for example) :

/etc/conf.d/net:
modules_enp4s0f1="dhcpcd"
modules_wlp3s0="!plug wpa_supplicant dhcpcd"
config_enp4s0f1="dhcp"
config_wlp3s0="dhcp"

... so I think that's the root of your problem.

HTH & best ... khay
Back to top
View user's profile Send private message
bifi.ftw
n00b
n00b


Joined: 05 Nov 2015
Posts: 24

PostPosted: Fri Apr 20, 2018 6:57 am    Post subject: Reply with quote

Thanks for your reply.

I switched to dhcpcd (which was uninstalled, during boot I now get my IP assign by dhcpcd.
However, I still get no IP address assigned when I'm trying to connect to a wifi network, the problem remains unchanged.

New /etc/conf.d/net
Code:

# Network group
dns_domain_lo="linuxnetwork"

# Use dhcp client
modules_enp4s0f1="dhcpcd"
modules_wlp3s0="!plug wpa_supplicant dhcpcd"
#modules_enp4s0f1="dhcp"
#modules_wlp3s0="wpa_supplicant"

# dhcp or fixed ip
config_enp4s0f1="dhcp"
config_wlp3s0="dhcp"

# Exclude DNS from DHCP
dhcp_enp4s0f1="release nodns"
dhcp_wlp3s0="release nodns"

# DNS server
dns_servers_enp4s0f1="37.58.63.27 46.101.70.183"
dns_servers_wlp3s0="37.58.63.27 46.101.70.183"



Regarding the 'wheel'-group:
Code:

wheel:x:10:root,bifi


bifi is in, it but it still doesn't work.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri Apr 20, 2018 9:58 am    Post subject: Reply with quote

bifi.ftw wrote:
I switched to dhcpcd (which was uninstalled, during boot I now get my IP assign by dhcpcd. However, I still get no IP address assigned when I'm trying to connect to a wifi network, the problem remains unchanged.

bifi.ftw ... hmmm ... ok, I think I see why, you have the old syntax in wpa_supplicant.conf, change to the following:

/etc/wpa_supplicant/wpa_supplicant.conf:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

I'm not sure this would effect dhcp assignment, but it's probably the cause of not being able to connect to the socket. You should check owner/group of /run/wpa_supplicant/wlp3s0 ... it should be 'root wheel' but I suspect yours is currently 'root root'.

Should that not fix things then please post the output of the following:

Code:
# egrep '^[^#]' /etc/rc.conf
# egrep '^[^#]' /etc/dhcpcd.conf
# rc-status default
# wpa_cli status
# iw dev wlp3s0 station dump

You're welcome & best ... khay
Back to top
View user's profile Send private message
bifi.ftw
n00b
n00b


Joined: 05 Nov 2015
Posts: 24

PostPosted: Fri Apr 20, 2018 10:28 am    Post subject: Reply with quote

I did not check with the old syntax, but after the change of wpa_supplicant.conf /run/wpa_supplicant/wlp3s0 is "root wheel".
The problem still remains.

egrep '^[^#]' /etc/rc.conf
Code:
rc_shell=/sbin/sulogin
unicode="YES"
rc_tty_number=12


egrep '^[^#]' /etc/dhcpcd.conf
Those are the vanilla settings, I did not modify anything.
Code:
hostname
duid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option interface_mtu
require dhcp_server_identifier
slaac private


rc-status default
Note: for testing I start /etc/init.d/wpa_supplicant manually, my wifi card is not started on boot, hope that's not the problem.
Code:
Runlevel: default
 dbus                                                                                       [  started  ]
 metalog                                                                                    [  started  ]
 net.enp4s0f1                                                                               [  started  ]
 consolekit                                                                                 [  started  ]
 netmount                                                                                   [  stopped  ]
 xdm                                                                                        [  started  ]
 cronie                                                                                     [  started  ]
 local                                                                                      [  started  ]


wpa_cli status
Code:

Selected interface 'wlp3s0'
bssid=4c:eb:42:4d:6b:57
freq=2442
ssid=morningstar
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
address=ac:fd:ce:e5:0a:1f


iw dev wlp3s0 station dump
Code:

Station 4c:eb:42:4d:6b:57 (on wlp3s0)
   inactive time:   3939 ms
   rx bytes:   5709
   rx packets:   41
   tx bytes:   1584
   tx packets:   15
   tx retries:   0
   tx failed:   0
   beacon loss:   0
   rx drop misc:   1
   signal:     -39 [-39] dBm
   signal avg:   -39 [-39] dBm
   tx bitrate:   130.0 MBit/s MCS 15
   rx bitrate:   54.0 MBit/s
   authorized:   yes
   authenticated:   yes
   associated:   yes
   preamble:   long
   WMM/WME:   yes
   MFP:      no
   TDLS peer:   no
   DTIM period:   3
   beacon interval:100
   short preamble:   yes
   short slot time:yes
   connected time:   292 seconds


Thank you for your kind help.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri Apr 20, 2018 2:17 pm    Post subject: Reply with quote

bifi.ftw ...

if starting wpa_supplicant "manually" then any configuration from /etc/conf.d/net isn't applied ... you would need to start net.wlp3s0 for this to occur (and have dhcpcd run).

As for wpa_supplicant, I should have asked to see the full permission/ownership of the directories above (though I don't expect this to be the problem).

Code:
# ls -ld /run{,/wpa_supplicant{,/wlp3s0}}

Also, is selinux or grsec in use?

Again, you're welcome & best ... khay
Back to top
View user's profile Send private message
bifi.ftw
n00b
n00b


Joined: 05 Nov 2015
Posts: 24

PostPosted: Fri Apr 20, 2018 6:36 pm    Post subject: Reply with quote

Since I usually don't need a wifi connection I figured I don't need my wifi card active or is setting it up on boot and letting it scan every x seconds two different things?

I don't need a wifi connection 90% of the time so I don't want it to be scanning all the time.
If that's not the case anyway should I just add net.wlp3s0 to boot level in rc?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri Apr 20, 2018 7:08 pm    Post subject: Reply with quote

bifi.ftw wrote:
Since I usually don't need a wifi connection I figured I don't need my wifi card active or is setting it up on boot and letting it scan every x seconds two different things? I don't need a wifi connection 90% of the time so I don't want it to be scanning all the time. If that's not the case anyway should I just add net.wlp3s0 to boot level in rc?

bifi.ftw ... you don't need to add it to the 'default' runlevel (and definitely not 'boot'), simply start net.wlp3s0 in stead of wpa_supplicant.

There are various ways you could manage this, ie via 'plug' (ie, sys-apps/ifplugd) ... which would allow for switching between ethernet and wireless on the basis of there being a cable connected, or not. Or by using dhcpcd's 10-wpa_supplicant (and possibly your rfkill key). Or you could create runlevels for 'eth' and 'wlan' and so switch between them with 'rc <runlevel>'.

best ... khay
Back to top
View user's profile Send private message
bifi.ftw
n00b
n00b


Joined: 05 Nov 2015
Posts: 24

PostPosted: Mon Apr 23, 2018 8:29 am    Post subject: Reply with quote

khayyam, thank you for you patient help.
This did the trick, wpa_gui now also works as non-root.

For everybody reading this who also does not get an ip assigned after successfully connecting to a wifi network:
check if you start wifi-card with /etc/init.d/net.wlan0 and not /etc/init.d/wpa_supplicant because otherwise your config in /etc/conf.d/net does not get applied (obviously).
Back to top
View user's profile Send private message
Semantika
n00b
n00b


Joined: 19 Feb 2018
Posts: 20

PostPosted: Fri May 11, 2018 2:35 am    Post subject: Reply with quote

Hello Khayyman,

I am having the same problem with wpa_gui, but I don't get what you mean by:

"f starting wpa_supplicant "manually" then any configuration from /etc/conf.d/net isn't applied ... you would need to start net.wlp3s0 for this to occur (and have dhcpcd run). "

That means that I have to
Code:
/etc/init.d/wpa_supplicant start
but then, what do you mean by saying /etc/conf.d/net is not applied.
The second part of your comment means that I have to have net.wlp3s0 and dhcpcd at the default runlevel?
The description of bifi actually applies very well to the problem I am having.

Thanks a lot for your help.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri May 11, 2018 8:34 am    Post subject: Reply with quote

Semantika wrote:
[...] but then, what do you mean by saying /etc/conf.d/net is not applied. The second part of your comment means that I have to have net.wlp3s0 and dhcpcd at the default runlevel?

Semantika ... if /etc/init.d/wpa_supplicant is started "netifrc" isn't in use (and so the configuration in /etc/conf.d/net isn't applied). So, for "netifrc" (ie, net.wlp3s0, or whatever your interface is named) you would have something like the following (for wpa_supplicant and dhcpcd):

/etc/conf.d/net:
modules_wlp3s0="!plug wpa_supplicant dhcpcd"
wpa_supplicant_wlp3s0="-Dnl80211 -qq"
config_wlp3s0="dhcp"

You would then only need 'net.wlp3s0" in the runlevel, as wpa_supplicant, and dhcpcd, would be started as a result.

HTH & best ... khay
Back to top
View user's profile Send private message
Goverp
Veteran
Veteran


Joined: 07 Mar 2007
Posts: 1973

PostPosted: Fri May 11, 2018 10:39 am    Post subject: Reply with quote

I've just been battling the same issues with a new laptop. (There was a hardware problem with the rtl8723de wifi that obscured the problem, eventually solved by setting the module parameter for antenna 2.)

I followed the wiki entry, and got it all to work by removing net.wlan0 from default or any other runlevel, and commenting out its config from /etc/conf.d/net, and adding both dhcpcd and wpa_supplicant to default runlevel. As I write this, /etc/init.d/net.wlan0 status is "stopped".

FWIW, I set the GROUP to "users", as I don't care who sets the wifi - there's only me here.

I get the wpa_gui in the system tray (using KDE), and it selects networks and runs like it should. I've also installed dhcpcd_ui, but not yet played with it. I'm not sure if its needed, but I've yet to plug an ethernet cable in to see what happens!
_________________
Greybeard
Back to top
View user's profile Send private message
Semantika
n00b
n00b


Joined: 19 Feb 2018
Posts: 20

PostPosted: Fri May 11, 2018 8:43 pm    Post subject: Reply with quote

Hey, thanks a ton khayyam and Goverp, I have managed to make it work, I made the changes in /etc/config.d/net and then removed the net interface from the default runlevel, leaving dhcpcd and wpa_supplicant. Everything works just fine.

:D :D :D
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat May 12, 2018 1:47 am    Post subject: Reply with quote

Semantika wrote:
Hey, thanks a ton khayyam and Goverp, I have managed to make it work, I made the changes in /etc/config.d/net and then removed the net interface from the default runlevel, leaving dhcpcd and wpa_supplicant. Everything works just fine.

Semantika ... you're welcome, but I think you've missed my meaning, the "changes" you've made to /etc/conf.d/net are only applied if using /etc/init.d/net.* ("netifrc"). So, having "removed the net interface" those changes play absolutely no role in it working.

best ... khay
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