Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 690808 - net-misc/netifrc does not support iwd
Summary: net-misc/netifrc does not support iwd
Status: UNCONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: netifrc (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: netifrc Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-27 08:49 UTC by Hans Fernhout
Modified: 2020-08-18 14:26 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Basic /lib/netifrc/net/iwd.sh script (iwd.sh,1.09 KB, text/plain)
2019-08-09 20:13 UTC, Hans Fernhout
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Fernhout 2019-07-27 08:49:00 UTC
When trying to get netifrc to use iwd instead of wpa_supplicant with:

modules_wlan0="iwd"
config_wlan0="dhcp"

in /etc/conf.d/net, it turns out that netifrc still tries to start wpa_supplicant. 

On a system where wpa_supplicant is not installed:
#rc-service net.wlan0 start
net.wlan0              | * Bringing up interface wlan0
net.wlan0              | *   Starting wpa_supplicant on wlan0 ...
net.wlan0              | *   start-stop-daemon: /sbin/wpa_supplicant does not exist                                                                     [ !! ]
net.wlan0              | * ERROR: net.wlan0 failed to start
#

On a system where wpa_supplicant is installed, netifrc happily starts the interface with wpa_supplicant, instead of with iwd.

On close examination it looks like iwd is not yet supported: in /lib/netifrc/net there is a wpa_supplicant script, but no iwd script.
Comment 1 Hans Fernhout 2019-08-09 20:13:37 UTC
Created attachment 586390 [details]
Basic /lib/netifrc/net/iwd.sh script

The attached iwd.sh seems to work reasonably well for both static IP addresses and DHCP. It works when it is simply installed in /lib/netifrc/net.

It requires in /etc/conf.d/net something like this (for interface wlp4s0 on phy0):
modules_wlp4s0="iwd"
config_wlp4s0="dhcp"
#config_wlp4s0="192.168.178.222/24"
iwd_wlp4s0="phy0"

Only issue observed so far is that on stopping the interface it complains with the following texts,probably because iwd already brings the interface down:
net.wlp4s0             |RTNETLINK answers: No such file or directory
net.wlp4s0             |Error talking to the kernel
Comment 2 Hypoon 2020-04-02 16:10:43 UTC
Has there been any update regarding using iwd in Gentoo? The wiki (https://wiki.gentoo.org/wiki/Iwd) refers to this bug, but does not acknowledge the iwd.sh script as a potential solution.
Comment 3 Hans Fernhout 2020-04-09 06:37:57 UTC
Hypoon, maybe you can try the script? Please confirm the results back here. Thanks.
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2020-05-31 05:26:42 UTC
(In reply to Hans Fernhout from comment #1)
> Created attachment 586390 [details]
> Basic /lib/netifrc/net/iwd.sh script
> 
> The attached iwd.sh seems to work reasonably well for both static IP
> addresses and DHCP. It works when it is simply installed in /lib/netifrc/net.
> 
> It requires in /etc/conf.d/net something like this (for interface wlp4s0 on
> phy0):
> modules_wlp4s0="iwd"
> config_wlp4s0="dhcp"
> #config_wlp4s0="192.168.178.222/24"
> iwd_wlp4s0="phy0"
> 
> Only issue observed so far is that on stopping the interface it complains
> with the following texts,probably because iwd already brings the interface
> down:
> net.wlp4s0             |RTNETLINK answers: No such file or directory
> net.wlp4s0             |Error talking to the kernel

I don't have a setup for reproducing this. Can you capture it the interface going down with --verbose, so we can see exactly which command(s) trigger the message.

There is prior work for cases where the interface vanished underneath netifrc.
Comment 5 Larry the Git Cow gentoo-dev 2020-05-31 05:29:53 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=c0f36e9995b6e07b6691fa0c2d5c3a13223f9815

commit c0f36e9995b6e07b6691fa0c2d5c3a13223f9815
Author:     Hans Fernhout <hfern@fernhout.info>
AuthorDate: 2020-05-31 05:27:16 +0000
Commit:     Robin H. Johnson <robbat2@gentoo.org>
CommitDate: 2020-05-31 05:29:36 +0000

    net/iwd: add iwd helper
    
    Bug: https://bugs.gentoo.org/690808
    Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>

 net/iwd.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
Comment 6 Hans Fernhout 2020-05-31 15:15:35 UTC
(In reply to Robin Johnson from comment #4)
> I don't have a setup for reproducing this. Can you capture it the interface
> going down with --verbose, so we can see exactly which command(s) trigger
> the message.
> 
> There is prior work for cases where the interface vanished underneath
> netifrc.

Not sure where you did your commit and if it is available for me, but I tried it out with my original iwd helper script, and it works fine now. No error message on stop any more. 

Maybe the error on stop had something to do with https://bugs.gentoo.org/642774 ? Same error message. That bug is listed as in progress, but has a commit, so maybe it is solved?

Once this is available for Gentoo users I will document the steps also in https://wiki.gentoo.org/wiki/Iwd#netifrc.
Comment 7 Cid Kramer 2020-06-05 18:28:26 UTC
This script works for me mostly.

I downloaded the "iwd.sh" script from the netifrc.git repo:
https://gitweb.gentoo.org/proj/netifrc.git/tree/net/iwd.sh?id=c0f36e9995b6e07b6691fa0c2d5c3a13223f9815

and dropped it in "/lib/netifrc/net/".

In my "/etc/conf.d/net" I just put:
> modules_wlp2s0="iwd"

Finally in order for "/etc/init.d/net.lo" to load iwd I had to create this symlink:
> ln -s /usr/libexec/iwd /usr/local/bin

I get this warning/error on start:
> start-stop-daemon: fopen '/run/iwd-wlp2s0.pid': No such file or directory

But everything seems to working correctly as far as I can tell.
Comment 8 Hans Fernhout 2020-06-05 19:29:11 UTC
Thanks for the feedback and reporting your test results.
Not sure why you would need the symlink: the script provides the complete path to the iwd executable: local iwds=/usr/libexec/iwd .

It works beautifully for me now with:
1) symlinking net.wlan0 to net.lo in /etc/init.d
2) adding the following to /etc/conf.d/net:
modules_phy0="iwd debug"
iwd_wlan0="phy0 debug"
config_wlan0="dhcp"

Adding the debug parameter may give additional information at startup and/or in syslog.

Note that in my setup I have prevented interface renaming because iwd tends to delete the interface and create it fresh: 
# touch /etc/udev/rules.d/80-net-name-slot.rules

If with these changes the error still exists, can you then attach the syslog output with the debug setting please? Thanks.
Comment 9 Cid Kramer 2020-06-05 21:07:39 UTC
I have set up everything as you specified:
1) net.wlan0 symlink
2) conf.d/net settings
3) udev rules

I found I also needed to have this in 'conf.d/net':
> modules_wlan0="iwd debug"

And I had to keep my symlink for '/usr/libexec/iwd' in '/usr/local/bin'. It's something to do with how '/etc/init.d/net.lo' calls '_program_available()'. I think something here is failing which prevents the module from loading and 'iwd_pre_start()' being called.

The error still exists, where should I look for the debug messages?
Comment 10 Hans Fernhout 2020-06-06 02:51:32 UTC
Not sure why you refer to /etc/init.d/net.lo calling something.

The service should be started with:
#rc-service net.wlan0 start

Please attach the relevant portion of your syslog, from the moment where you start the service. The location of your syslog file might depend on which logger you have installed and how you have configured it. Syslog-ng puts it in /var/log/messages.
Comment 11 Cid Kramer 2020-06-06 12:06:13 UTC
Sorry, it's my first rodeo so bear with me.

I'm running the service with:
>rc-service net.wlan0 start

I'm just refering to the script it symlinks to. I noticed while doing some debugging by echoing the loaded modules that at some point in the script 'iwd' gets dropped from the list and I think it has something to do with '_program_available()'. Perhaps that's a seperate issue.

This is what I got from /var/log/messages, I'm using sysklogd, it doesn't appear to show any errors or debug messages:
>Jun  6 13:30:05 thiyl syslogd[2099]: syslogd v2.1.2: restart.
>Jun  6 13:30:05 thiyl crond[2127]: (CRON) STARTUP (1.5.4)
>Jun  6 13:30:05 thiyl crond[2127]: (CRON) INFO (Syslog will be used instead of sendmail.)
>Jun  6 13:30:05 thiyl crond[2127]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 75% if used.)
>Jun  6 13:30:05 thiyl crond[2127]: (CRON) INFO (running with inotify support)
>Jun  6 13:30:05 thiyl dhcpcd[2184]: dev: loaded udev
>Jun  6 13:30:05 thiyl dhcpcd[2184]: no interfaces have a carrier
>Jun  6 13:30:05 thiyl dhcpcd[2184]: forked to background, child pid 2207
>Jun  6 13:30:05 thiyl dhcpcd[2207]: eth0: waiting for carrier
>Jun  6 13:30:05 thiyl dhcpcd[2207]: wlan0: waiting for carrier
>Jun  6 13:30:05 thiyl dhcpcd[2207]: wlan0: carrier acquired
>Jun  6 13:30:05 thiyl dhcpcd[2207]: DUID 00:06:13:4d:16:4c:29:c9:13:b3:a9:9c:89:3f:e5:db:ee:38
>Jun  6 13:30:05 thiyl dhcpcd[2207]: wlan0: IAID ea:ac:a3:14
>Jun  6 13:30:05 thiyl dhcpcd[2207]: wlan0: adding address fe80::865:e2ca:c4ed:5141
>Jun  6 13:30:05 thiyl dhcpcd[2207]: wlan0: carrier lost
>Jun  6 13:30:05 thiyl dhcpcd[2207]: wlan0: deleting address fe80::865:e2ca:c4ed:5141
>Jun  6 13:30:06 thiyl dhcpcd[2448]: sending commands to master dhcpcd process
>Jun  6 13:30:06 thiyl dhcpcd[2207]: control command: dhcpcd -m 3 wlan0
>Jun  6 13:30:06 thiyl dhcpcd[2207]: wlan0: carrier acquired
>Jun  6 13:30:06 thiyl dhcpcd[2207]: wlan0: connected to Access Point `thiylwifi'
>Jun  6 13:30:06 thiyl dhcpcd[2207]: wlan0: IAID ea:ac:a3:14
>Jun  6 13:30:06 thiyl dhcpcd[2207]: wlan0: adding address fe80::260e:2565:a959:9495
>Jun  6 13:30:07 thiyl dhcpcd[2207]: wlan0: soliciting an IPv6 router
>Jun  6 13:30:07 thiyl dhcpcd[2207]: wlan0: rebinding lease of 192.168.178.168
>Jun  6 13:30:07 thiyl dhcpcd[2207]: wlan0: probing address 192.168.178.168/24
>Jun  6 13:30:12 thiyl dhcpcd[2207]: wlan0: leased 192.168.178.168 for 864000 seconds
>Jun  6 13:30:12 thiyl dhcpcd[2207]: wlan0: adding route to 192.168.178.0/24
>Jun  6 13:30:12 thiyl dhcpcd[2207]: wlan0: adding default route via 192.168.178.1
>Jun  6 13:30:20 thiyl dhcpcd[2207]: wlan0: no IPv6 Routers available
>Jun  6 13:30:20 thiyl dbus-daemon[2157]: [system] Activating service name='org.freedesktop.login1' requested by ':1.1' (uid=0 pid=2575 comm="/bin/login --      ") (using servicehelper)
>Jun  6 13:30:20 thiyl dbus-daemon[2157]: [system] Successfully activated service 'org.freedesktop.login1'