Ask Your Question
0

How can I enable wpa_supplicant on boot?

asked 2014-12-10 15:47:44 -0600

ThisSuitIsBlackNot gravatar image

I'm trying to enable wpa_supplicant on boot in Fedora 20. I created /etc/wpa_supplicant/wpa_supplicant.conf and am able to connect to my wireless network manually by running

wpa_supplicant -B -i wlan0 -Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf

(I can confirm that I'm connected by running iwconfig)

I'm brand new to systemd and can't figure out how to get this to happen on boot. I've found guides for other distros that use systemd that say all you need to do is

systemctl enable wpa_supplicant@wlan0

but when I run that command, I get

Failed to issue method call: No such file or directory
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-12-12 11:16:39 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I also posted this question on Unix & Linux Stack Exchange; user Braiam suggested that if wpa_supplicant@wlan0 doesn't exist, I may need to create it myself, and also pointed me to a page in the Arch Linux wiki describing how to do so. I had to tweak things slightly for Fedora, but the following worked for me:

  1. Create a systemd unit, /etc/systemd/system/network-wireless@.service:
[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/sbin/ip link set dev %i up
ExecStart=/usr/sbin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.conf
#ExecStart=/usr/sbin/dhclient %i

ExecStop=/usr/sbin/ip link set dev %i down

[Install]
WantedBy=multi-user.target

Note that I had to change the paths to ip and wpa_supplicant from /usr/bin/ to /usr/sbin/ for my system. I also changed dhcpcd to dhclient, since I don't have dhcpcd installed.

  1. Create a symbolic link in /etc/systemd/system/multi-user.target.wants/:
ln -s /etc/systemd/system/network-wireless@.service \
      /etc/systemd/system/multi-user.target.wants/network-wireless@wlan0.service

I had to do this because running

systemctl enable network-wireless@wlan0.service

as described in the Arch Linux wiki failed with

Failed to issue method call: No such file or directory
  1. Start the service:
systemctl daemon-reload
systemctl start network-wireless@wlan0.service

Now I'm able to connect to my wireless network on boot. I haven't figured out how to configure DHCP properly (hence the dhclient line being commented out in my systemd unit), but that's a different question.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-12-10 15:47:44 -0600

Seen: 3,923 times

Last updated: Dec 12 '14