Failed to connect to non-global ctrl_ifname: (nil) error: No such file or directory (How to Fix)

The solution
This means that you must let wpa_supplicant run in the background.
run in the background

Reproduced in: https://www.cnblogs.com/eat-too-much/p/8301497.html

Read More: