Posts: 5
Joined: Thu Nov 27, 2014 12:44 am

Headless mode with WiFi only

Thu Nov 27, 2014 12:47 am

I have Pidora 2014-R3 installed on my RPI. however I am having a problem that wlan0 will only connect when eth0 is plugged in. I am wondering if anyone have some solutions to this? Thanks.


Posts: 5
Joined: Thu Nov 27, 2014 12:44 am

Re: Headless mode with WiFi only

Fri Dec 05, 2014 10:18 pm

I have managed to trouble shoot my problem.

The problem has something to do with D-Bus which is something I am not familiar at all, but I was able to get NetworkManager to properly connect to an Wifi AP by disableing DBus control interface on wpa_supplicant

Code: Select all

vi /usr/share/dbus-1/system-services/fi.w1.wpa_supplicant1.service
[D-BUS Service]
#remove the -u flag in wpa_supplicant (-u = enable DBus control interface)
#Exec=/usr/sbin/wpa_supplicant -B -u -f /var/log/wpa_supplicant.log -c /etc/wpa_supplicant/wpa_supplicant.conf -P /var/run/
Exec=/usr/sbin/wpa_supplicant -B -f /var/log/wpa_supplicant.log -c /etc/wpa_supplicant/wpa_supplicant.conf -P /var/run/
and now the device will user NetworkManager to connect to a per-configed AP

Posts: 14
Joined: Mon Dec 29, 2014 6:30 am

Re: Headless mode with WiFi only

Wed Dec 31, 2014 7:15 pm

Thank you for your post. This saved me a ton of time, I'm sure.

Do you have any idea why removing the "-u" flag makes the difference for connecting to wireless when there is a wired ethernet plugged in versus when it's not present?

Posts: 14
Joined: Mon Dec 29, 2014 6:30 am

Re: Headless mode with WiFi only

Thu Jan 01, 2015 9:56 pm

Interestingly, I didn't have to do anything with the wpa_supplicant/d-bus file.

Once I have everything working with /boot/headless, I did this:

Ensured the sshd daemon is enabled first. Then,

Code: Select all

[[email protected] ~]# rm /boot/headless 
 rm: remove regular file ‘/boot/headless’? y
 [[email protected] ~]# 
 [[email protected] ~]# systemctl set-default
Then I went ahead and rebooted.

After a very short time, the wireless US dongle blue light went on.

The only weird part was that the dhcp name was not set correctly, even though I have DHCP_HOSTNAME=mypi set in the ifcfg- file.

Best regards,


Posts: 4
Joined: Sun Jun 16, 2013 4:36 pm

Re: Headless mode with WiFi only

Sun Jan 25, 2015 2:59 pm

@NaniHikaru - Thank kindly for your work in discovering this. I have been trying to get headless WiFi to work for months and this was exactly the solution I needed. Best Regards, KK

Posts: 2
Joined: Thu Jan 29, 2015 5:32 pm

Re: Headless mode with WiFi only

Fri Jan 30, 2015 1:09 am

Although the issue seems to be resolved I just wanted to add that there is no need to defy NetworkManager (NM).

As a NM plagued RHEL/CentOS/Fedora user myself I also fiercely fought NM and disabled it whenever seemed to interfere and mess up with my well devised static network setup of NICs in the /etc/sysconfig/network-scripts/ifcfg-* config files.
But always the WLAN NICs baulked at such a consistent configuration scheme, for of all the WLAN specific parameters which were documented in e.g. /usr/share/doc/initscripts-*/sysconfig.txt
there were none that treated WPA encryption but only WEP.
That was why I made sure to always put a NM_CONTROLLED=no line in my ifcfg-* files and also used to script my own wpa_supplicant WLAN kind of init script which worked well, but obviously not as intended by the distro maintainers.

Until lately, when I came across the RHEL 7 Networking Guide and read for the first time how the legacy network SysV init script, systemd and NM were all meant to peacefully cooperate so that either old school SysV network initialization would still be supported as well as the new systemd way together with NM.

You need to know that RedHat made a bold transition from RHEL 6 with SysV Init to RHEL 7 with systemd, something they had testbed for a few releases with their Fedora community offspring.
And I guess they need to make sure that all the veteran enterprise sysadmins can still employ their legacy configurations despite systemd and NM, should they ever be willing to shift to RHEL 7 and beyond.

Now in above mentioned guide I read that NM has a nifty command line interface called nmcli which is fully scriptable but also has an interactive edit mode.
Because it has tabulator parameter completion (similar to Bash'es tab command completion) you luckily don't have to memorize every conceivable parameter and its correct syntax.
Also the parameter completion is context sensitive so that you can hardly choose any wrong parameter and are only offered those left which make sense in the respective context.
The icing on the cake is an integrated online help by appending the word help to any command parameter combination
as well as a describe command while you are in edit mode which gives a terse explanation of parameter's meaning and feasible values.
Thanks to the excellent CLI of the nmcli command I hardly had to refer to the man page.

Below you can see a dump of my static WLAN NIC NM configuration which I saved under the connection name HomeWLAN,
and which also displays all the possible parameters in a kind of object attribute notation,
most of which luckily don't need to be set at all.
Note, that the pre-shared (WPA) key in 802-11-wireless-security.psk isn't displayed in the dump, I guess for privacy reasons.
But when you configure the key for your WLAN access point you can either assign it as clear text string or copy and paste the hashed key as the wpa_passphrase command would output it.
Note that "ipv4.method: manual" indicates that I assigned a static IP for my WLAN NIC which is out of the DHCP range of my Internet router/WLAN AP.
You can even bind several IP addresses (i.e. secondary IPs or multi-homed) since the ipv4.addresses accepts an array of IPs which is denoted by the curly braces.

Code: Select all

[[email protected]:~]
# nmcli connection show configured HomeWLAN                          HomeWLAN
connection.uuid:                        802e2a46-05b1-48e9-bb10-e0369440f4cf
connection.interface-name:              wlan0
connection.type:                        802-11-wireless
connection.autoconnect:                 yes
connection.timestamp:                   1422577390                   no
connection.permissions:                                --
connection.master:                      --
connection.slave-type:                  --
connection.gateway-ping-timeout:        0
802-11-wireless.ssid:                   loonybin
802-11-wireless.mode:                   infrastructure                   --                0
802-11-wireless.bssid:                  --
802-11-wireless.rate:                   0
802-11-wireless.tx-power:               0
802-11-wireless.mac-address:            7C:DD:90:44:3D:BC
802-11-wireless.cloned-mac-address:     --
802-11-wireless.mtu:                    auto
802-11-wireless.seen-bssids:            34:81:C4:BE:70:5F
802-11-wireless.hidden:                 no
802-11-wireless-security.key-mgmt:      wpa-psk
802-11-wireless-security.wep-tx-keyidx: 0
802-11-wireless-security.auth-alg:      --
802-11-wireless-security.proto:         wpa,rsn
802-11-wireless-security.leap-username: --
802-11-wireless-security.wep-key0:      --
802-11-wireless-security.wep-key1:      --
802-11-wireless-security.wep-key2:      --
802-11-wireless-security.wep-key3:      --
802-11-wireless-security.wep-key-flags: 0 (none)
802-11-wireless-security.wep-key-type:  0 (unknown)
802-11-wireless-security.psk:           --
802-11-wireless-security.psk-flags:     0 (none)
802-11-wireless-security.leap-password: --
802-11-wireless-security.leap-password-flags:0 (none)
ipv4.method:                            manual
ipv4.addresses:                         { ip =, gw = }
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv6.method:                            auto
ipv6.ignore-auto-routes:                no
ipv6.ignore-auto-dns:                   no
ipv6.never-default:                     no
ipv6.may-fail:                          yes
ipv6.ip6-privacy:                       -1 (unknown)
ipv6.dhcp-hostname:                     --
What makes configuration via nmcli especially painless is that you can start by just defining a new connection and then step by step populate necessary parameters/attributes either through the modify command, or easier yet, by setting them in the interactive edit mode.
Once you have assigned all necessary attributes this way you can issue verify and check that NM successfully associates your WLAN NIC to your AP and binds either the IP statically or polls one from the AP's DHCP server.
For the latter just let ip4.addresses unassigned.
When all is set and done you issue a save (permanent) and exit.

Finally, you can also verify that NM has stored the new connection's settings in a legacy ifcfg-* file,
or in my case:

Code: Select all

[[email protected]:~]
# cat /etc/sysconfig/network-scripts/ifcfg-HomeWLAN 

So I now let NM do the NICs initialization on system boot, and this works like a charm.
You of course have to let NM remain enabled, as is the default on a freshly installed Fedora or Pidora.

Code: Select all

[[email protected]:~]
# systemctl list-unit-files -a|grep -i network
dbus-org.freedesktop.NetworkManager.service enabled 
NetworkManager-dispatcher.service           enabled 
NetworkManager-wait-online.service          disabled
NetworkManager.service                      enabled                       static                              static  
And because I also want my RasPi be running in headless mode, I made the multi-user target be the default "run-level" (in quotes as there are no real runlevels on a systemd Init system anymore).

Code: Select all

[[email protected]:~]
# systemctl get-default
[[email protected]:~]
# systemctl is-enabled sshd.service 
Sorry, if my reply has been a bit lengthy.
I just wanted to encourage people to give NM a try.

Posts: 5
Joined: Thu Nov 27, 2014 12:44 am

Re: Headless mode with WiFi only

Wed Feb 18, 2015 8:40 pm

Sorry for the late reply, life's been busy.

So I have figured out what really is going on.

The main issue is CPU TIME.

On my first fix of removing the -u basically tells the wpa_supplicant to use the DBUS for communication, however the process always hangs because it just timed out from 100% cpu usage.

So I have decided to try something else. I used HTOP to figure out why the system hangs at 100% all the time, and the two process are rsyslogd and crond. I suspect this has to do with SD card Write?? Gonna do more investigation there.

So i disabled the two services

Code: Select all

sudo systemctl disable rsyslog.service
sudo systemctl disable crond.service
and rebooted, now it's no longer stuck at 100% and nmcli works nicly through D-BUS and i have everything connected properly.

Return to “Pidora / Fedora”