Init systems => OpenRC => Topic started by: shako on 06 September 2022, 15:46:33
Title: custom eth0 wpa_supplicant service
Post by: shako on 06 September 2022, 15:46:33
Hi everyone,
I want to only rely on wpa_supplicant for managing internet connections, so I got rid of NetworkManager and transferred all my connections in my wpa_supplicant.conf. Then, I obviously added wpa_supplicant and dhcpcd to runlevel default in OpenRC (I use Artix OpenRC).
However, the "default" wpa_supplicant OpenRC daemon (shipped through "wpa_supplicant-openrc") doesn't seem to work for my wired connection (despite working flawlessly for each other wireless connection in my wpa_supplicant.conf).
In order to connect to the internet through my wired connection, I have to stop the wpa_supplicant and dhcpcd services, kill every instance of them running, and then run:
Then, it connects. To make sure it's actually connecting to my wired network, i commended-out all other networks from my wpa_supplicant.conf and disabled wifi via rfkill.
How may I "automate" connection to my wired network when I turn on my laptop? Do I have to write a custom OpenRC script? What I would like to happen, is my laptop always connecting to the wired connection if available, switching to wireless if it's not. I know there are a few people in the forum actively using wpa_supplicant to manage connections, so feel free to share any hint or suggestion. I'm here to learn :)
Title: Re: custom eth0 wpa_supplicant service
Post by: shako on 06 September 2022, 16:03:28
EDIT: I inspected the wpa_supplicant service conf file in /etc/conf.d/wpa_supplicant. It doesn't seem to pass any flag to wpa_supplicant as it is, but nonethless this seems to be sufficient to manage wireless networks:
I want to only rely on wpa_supplicant for managing internet connections, so I got rid of NetworkManager and transferred all my connections in my wpa_supplicant.conf. Then, I obviously added wpa_supplicant and dhcpcd to runlevel default in OpenRC (I use Artix OpenRC).
However, the "default" wpa_supplicant OpenRC daemon (shipped through "wpa_supplicant-openrc") doesn't seem to work for my wired connection (despite working flawlessly for each other wireless connection in my wpa_supplicant.conf).
In order to connect to the internet through my wired connection, I have to stop the wpa_supplicant and dhcpcd services, kill every instance of them running, and then run:
Then, it connects. To make sure it's actually connecting to my wired network, i commended-out all other networks from my wpa_supplicant.conf and disabled wifi via rfkill.
How may I "automate" connection to my wired network when I turn on my laptop? Do I have to write a custom OpenRC script? What I would like to happen, is my laptop always connecting to the wired connection if available, switching to wireless if it's not. I know there are a few people in the forum actively using wpa_supplicant to manage connections, so feel free to share any hint or suggestion. I'm here to learn :)
I have basically done the exact same thing, got rid of connman and use something much simpler that basically acts as a frontend for wpa_supplicant.
I have a program that will automatically connect to a wifi network either based on priority, whatever it finds in /etc/wpa_supplicant or just giving it a manual SSID.
And the best part: it's a shell script program, meaning it's completely init independent.
Would you be interested in seeing it?
Title: Re: custom eth0 wpa_supplicant service
Post by: shako on 07 September 2022, 07:41:05
I have basically done the exact same thing, got rid of connman and use something much simpler that basically acts as a frontend for wpa_supplicant.
I have a program that will automatically connect to a wifi network either based on priority, whatever it finds in /etc/wpa_supplicant or just giving it a manual SSID.
Would you be interested in seeing it?
Yes totally! Thank you! :D
EDIT: it seems like the default wpa_supplicant init script is intended to only manage wireless networks, so at least the reason for failure is now clear.
Title: Re: custom eth0 wpa_supplicant service
Post by: Lancia on 08 September 2022, 12:37:53