Donnerstag, 11. April 2013

Setting up RaspberryPi with ArchLinux to automatically connect to WLAN

Got a RaspberryPi.
After simply dd'ing the ArchLinux onto an SD card, booting was possible, and composite output was working. Neat.
Plug in a wlan usb stick. Try to configure it like it was described here, but things just didn't work out fine. Problem was, the wlan0 device wasn't yet existing, when the boot process reached the starting of the wlan connection. Fail followed.

What kind of saved me, after I understood what to do, was this thread.
However, what I did was slightly different:
I called
systemctl --full
and search for the line providing something like this:
sys-devices-pci0000:00-0000:00:1c.1-0000:02:00.0-bcma0:0-net-wlan0.device
Then i put that into the file to After and BindTo
[edit]
Had to change my approach. Before, I changed the file /etc/systemd/system/network.service, but that kind of didn't work nicely. Probably, because network.service is not netcfg. The change in netcfg file below just adds two lines which tells Arch to wait with this netcfg service until the wlan is up and running:
After=sys-subsystem-net-devices-wlan0.device
BindsTo=sys-subsystem-net-devices-wlan0.device
so that we get the resulting file:
cat /etc/systemd/system/multi-user.target.wants/netcfg\@Stadtkater.service 
[Unit]
Description=Netcfg networking service for profile %i
Before=network.target
Wants=network.target
After=sys-subsystem-net-devices-wlan0.device
BindsTo=sys-subsystem-net-devices-wlan0.device

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/netcfg check-iface %i
ExecStop=-/usr/bin/netcfg down %i
KillMode=none

[Install]
WantedBy=multi-user.target
Not sure what I did there exactly and what's the difference between After and BindTo, but it worked and the raspberry pi connects now to the wlan after a fresh start. So now i can ssh and don't have to use a crappy TV signal anymore :)

Keine Kommentare:

Kommentar veröffentlichen