You are not logged in.

#1 2013-08-21 09:40:00

rainbowgoblin
Member
Registered: 2013-08-14
Posts: 12

How to start wifi on boot?

I've tried reading the appropriate documentation on this, but I'm not sure what I'm missing.

I've got a wireless interface that's appropriately configured for wpa_supplicant: I've got a file /etc/wpa_supplicant/wpa_supplicant.conf that will allow me to connect to the network by running:

wpa_supplicant -B -i wlp3s0 -c /etc/wpa_supplicant/wpa_supplicant.conf

I've also appropriately configured a file to set up a systemd service so that I can start my interface with:

systemctl  start wpa_supplicant@wlp3s0.service

Then I've also run:

systemctl enable wpa_supplicant@wlp3s0.service

But when I restart my computer, wlp3s0 doesn't start (unless I run the systemctl start... command again).

I thought I understood the difference between the start and enable commands to systemctl. Does start run a service once, immediately, while enable starts the service at boot up? If not, what do I need to do to ensure my wifi service starts on its own?

Offline

#2 2013-08-21 11:19:55

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: How to start wifi on boot?

Take a look at the logs to see if there's an error message.


All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.

Offline

#3 2013-08-21 11:26:53

wrm
Member
From: Europe
Registered: 2005-06-09
Posts: 19

Re: How to start wifi on boot?

Hi,

First, difference between start and enable:
Enable - makes service start at boot, does not start it.
Start - starts service currently, leaving it at the same state for boot as it was (it doesn't enable or disable it).

Now for automatic WiFi configuration I'd suggest either using netctl https://wiki.archlinux.org/index.php/Netctl or networkmanager https://wiki.archlinux.org/index.php/Network_manager.

I'm using networkmanager, it also has a service which connects to WiFi network in range automatically at boot. netctl can also do it, but it's console based (no gui).

Last edited by wrm (2013-08-21 11:27:41)


knowledge is p0wer..

Offline

#4 2013-08-21 11:45:56

Hydranix
Member
Registered: 2013-02-10
Posts: 55

Re: How to start wifi on boot?

I prefer to use my own service for networking just because it tends to be more stable (for me at least).

Prequsites:
udev rule to name my wireless card asus0
an immutible file /etc/nameservers with my favorite nameservers to survive dhcp clobber when i'm mobile.
(pacman -Sy --needed net-tools wireless_tools wpa_supplicant)
(wpa_passphrase "{SSID}" "{WPA2-PSK}" > /etc/wpa && chattr +I /etc/wpa)


/etc/systemd/system/wifi.service
[Unit]
Description=HNx Wireless Networking

[Service]
Type=oneshot
RemainAfterExit=yes

ExecStart=/usr/sbin/ip link set dev asus0 up
ExecStart=/usr/bin/wpa_supplicant -Dwext -Iasus0 -c/etc/wpa -B
ExecStart=/usr/sbin/ifconfig asus0 10.0.0.1/24
ExecStart=/usr/sbin/route add default gw 10.0.0.100
ExecStart=/usr/sbin/cp /etc/nameservers /etc/resolv.conf

ExecStop=/usr/bin/killall -s SIGKILL wpa_supplicant
ExecStop=/usr/sbin/ip addr flush dev asus0
ExecStop=/usr/sbin/ip link set dev asus0 down

[Install]
WantedBy=multi-user.target

Offline

#5 2013-08-22 17:51:54

muthuh
Member
From: Ireland
Registered: 2013-08-20
Posts: 11

Re: How to start wifi on boot?

Have you tried using netctl?
Works fine for me, quite easy setup too, just read and understand it ;)
Good luck.
Ps. I use it along with wifi-menu, another simple yet effective command line tool. KISS everybody, KISS.

Last edited by muthuh (2013-08-23 09:25:41)

Offline

#6 2013-08-22 17:58:34

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: How to start wifi on boot?

If you want to really use the basic commands like that, and want to avoid a totally custom service file, you should be able to use just the wpa_suppicant@.service along with the dhcpcd@.service.  Though it sounds like the wpa_supplicant@.service is being run before the network device is full initalized.  Maybe adding "BindsTo=sys-subsystem-net-devices-%i.device" to the unit might help.  Just remember not to edit the unit in /usr directly, but instead either copy the unit to /etc/systemd/system and edit it there, or even better use the drop-in replacement method.

Really though, I think it would probably be easiest to use netctl for this, as that is what it was written for.  Alternatively, you could use some other network management daemon, such as NetworkManager, wicd, or connman (or even Trilby's swifer, though I am not sure he still maintains that).

Offline

#7 2013-08-22 18:33:34

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,163
Website

Re: How to start wifi on boot?

I believe that this is what you are referring to for swifer. Last update was new year, so fairly recent.

Last edited by clfarron4 (2013-08-22 18:33:53)


Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository

Offline

#8 2013-09-06 03:44:15

rainbowgoblin
Member
Registered: 2013-08-14
Posts: 12

Re: How to start wifi on boot?

Sorry for the delay. I've been unexpectedly without internet at home for a couple weeks.

@WonderWoofy: Thanks. I didn't quite understand what you were saying, but it pointed me to https://wiki.archlinux.org/index.php/Wi … 2Fservices, and the network-wireless@.service script solved my problem. I still don't quite understand why I have to enable a network-wireless service, rather than just wpa_supplicant, but your suggestion that wpa_supplicant is starting too soon makes sense. Another thing I noticed when I ran systemctl --all was that it looks like wpa_supplicant is trying to start for a device called wlan0:

wpa_supplicant@wlan0.service                                                             error  inactive dead      WPA supplicant daemon (interface-specific version)

I know that udev used to name wifi cards wlanX, but this is a new system, with up-to-date udev, and its wifi card has always been called wlp3s0. Not sure what this is about.

I have no problem with using netctl, but this is a desktop, my network doesn't need to be flexible. Just need to start the one card, with wpa_supplicant and dhcp. I may start using netctl at some point, but I like to understand why a particular method doesn't work before jumping on to a better one.

Offline

#9 2013-09-06 04:53:07

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: How to start wifi on boot?

Have you tried to set up any other network management service/daemon?  Some of the others will actually use wpa_supplicant@.service in order to do what they do.  I know NetowrkManager works this way.  You should check the output of systemctl list-units --type=service to see if there is anything that might be fighting with what you wish to use.

Last edited by WonderWoofy (2013-09-06 04:53:23)

Offline

Board footer

Powered by FluxBB