First to shine a light on this mish/mash of different commands. On Raspbian there are three concurrent network environments installed: old style debian networking with ifupdown
is configured in etc/network/interfaces
but it is deprecated. The default networking environment of Raspbian is managed by dhcpcd and configured in /etc/dhcpcd.conf
. Old style networking is configured to give dhcpcd precedence but if it is used it partial overwrites settings from dhcpcd.
And there is a third network environment sleeping in the background: systemd-networkd that is managed with files in directory /etc/systemd/network/
. It is there because it is build-in to systemd, the default init system of Raspbian. It is not very good to manage mobile devices but with static devices it is very powerful. To use it you have to completely switch over to systemd-networkd and disable both other networking systems.
And to make it a bit more confusing: all three networking systems using wifi manager wpa_supplicant
as helper, each in an other way.
First of all you have to decide what networking system you want to use. The services of all three systems are managed by systemd, of course. With
rpi ~$ systemctl <command> networking.service
you manage old style networking service. With
rpi ~$ systemctl <command> dhcpcd.service
you manage dhcpcd service, and with
rpi ~$ systemctl <command> systemd-networkd.service
You manage that service. wpa_supplicant is only good managed and integrated in systemd when using systemd-networkd with:
rpi ~$ systemctl <command> [email protected]
I don't know how good it can be managed with networking by using
rpi ~$ systemctl <command> wpa_supplicant.service
but with dhcpcd the wpa_supplicant service is definitely not manageable with systemd. With dhcpcd the command
rpi ~$ systemctl status wpa_supplicant.service
shows you that it is disabled but in real it is active to manage wifi.
Now to come to debugging. If you really want to do that in general you can look at www/Software/systemd/Debugging. For systemd-networkd only you can improve its log level by setting an environment variable for this service.
rpi ~$ sudo systemctl edit systemd-networkd.service
and insert this into the empty editor, save and quit it:
[Service]
Environment=SYSTEMD_LOG_LEVEL=debug
This will improve the log messages from systemd-networkd into the journal. You can get them with:
rpi ~$ journalctl --boot --unit=systemd-networkd
Don't forget to disable improved logging with:
rpi ~$ sudo rm -r /etc/systemd/system/systemd-networkd.service.d/
For debugging wpa_supplicant you do it the best in the forground because you have a lot of output. First look what command is executed by the service with:
rpi ~$ systemctl cat [email protected]
You will find a line something like:
ExecStart=/sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -Dnl80211,wext -i%I
Replace placeholder %I with wlan0, add the debug option -d
and start it:
rpi ~$ sudo systemctl stop [email protected]
rpi ~$ sudo /sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-wlan0.conf -Dnl80211,wext -iwlan0 -d