You are not logged in.

#1 2016-03-20 19:26:00

luqo33
Member
Registered: 2016-03-20
Posts: 4

Making wireless connection persistent, problem with rfkill

Hello,

It's been my first installation of Arch. The most pressing problem that I still cannot solve is this:

Each time I log-in to the live system, I have to take the following steps in order to establish internet connection through WiFi:

1. rfkill unblick all
2. Turn on the wifi switch on my HP Comaq nx7400
2. ip link set <interface> up
3. wpa_supplicant -B -Dwnext -i <interface> -c /etc/wpa_supplicant.conf <- in there I've configured my wireless, password, encryption, etc.
4. dhcpcd <interface>

Only then I'm able to tonnect to the internet.

I need to make these settings persistent. I've read through a lot of topics that touched upon the same problem but I was not able to find a solution to my problem.

I tried to use netctl to make it persistent - creating and enabling a profile that loaded my config file /etc/wpa_supplicant.conf for the <interface>.

However, after startup, there is not internet access and I have to go though ALL steps outlined above again.

I tried adding a service that would "rfkill unblock all" at boo, but the service is failing with this message:

Can't open RFKILL control device: No such file or directory

What is the way to make the wireless connection that uses a given profile, needs wpa_supplicant, and relies on wifi being "rfkill unblocked" available after each reboot?

Offline

#2 2016-03-20 20:54:04

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,680
Website

Re: Making wireless connection persistent, problem with rfkill

luqo33 wrote:

I tried to use netctl to make it persistent - creating and enabling a profile that loaded my config file /etc/wpa_supplicant.conf for the <interface>.

However, after startup, there is not internet access

Please post the relevant configuration files and any relevant journalctl entries or error messages.

Are you sure that there are no conflicting networking .services enabled (or started)?

luqo33 wrote:

I tried adding a service that would "rfkill unblock all" at boo, but the service is failing

Please post your .service configuration file.

You could try this custom unit file for systemd:
https://gist.github.com/Head-on-a-Stick … ad6b5723b0

Save it as /etc/systemd/system/network-wireless@.service and enable it with:

# systemctl enable network-wireless@<interface>

Replace <interface> with the actual name of the interface.

EDIT: Make sure that there are no other networking .services enabled with `systemctl list-unit-files|grep enabled`, never have multiple networking .services enabled for any given interface.

The unit file simply runs your commands in sequence once the network interfaces become available wink

The physical switch would have to be toggled to the active state before the system started, obviously.

Last edited by Head_on_a_Stick (2016-03-20 21:08:30)

Offline

#3 2016-03-20 21:24:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: Making wireless connection persistent, problem with rfkill

luqo33 wrote:

I tried adding a service that would "rfkill unblock all" at boo, but the service is failing...

What service file did you use?  You should use the one include in the rfkill package.  How did you enable it (for what interface(s))?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2016-03-21 18:46:13

luqo33
Member
Registered: 2016-03-20
Posts: 4

Re: Making wireless connection persistent, problem with rfkill

@Head_on_a_Stick's unit file solved the problem! I'm pasting it here in case the gist goes missing:

[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes

ExecStart=/usr/bin/rfkill unblock all
ExecStart=/usr/bin/ip l set %i up
ExecStart=/usr/bin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant.conf
ExecStart=/usr/bin/dhcpcd %i

ExecStop=/usr/bin/ip l set %i down
ExecStop=/usr/bin/ip a flush %i
ExecStop=/usr/bin/ip r flush %i

[Install]
WantedBy=multi-user.target

I'm convinced that I couldn't get wireless settings to persist for one or more of these reasons:
1. I had conflicting network services enabled,
2. My custom unit file for systemd was very similar, but lacked these keys: "Wants", "Before", "BindsTo", "After". Consequently rfkill and other Exec statements were probably triggered before the devices were ready.

@Trilby, I used a very minimal custom rfkill unit file (sorry won't be able to paste here as it's been long hobe), then tried the one in the package, but this did not work either - it was probably because I did not launched it properly  by providing my <interface> to systemctl enable command. I'm really not sure as I'm still trying to wrap my head around all this new stuff. All in all, I'm happy that @Head_on_a_Stick's custom unit file did the job!

Thanks so much for your help.

Last edited by luqo33 (2016-03-21 20:44:30)

Offline

Board footer

Powered by FluxBB