I want to set up a WiFi Access Point with Hostapd while using Torizon. I have followed this article but found that connmanctl is not installed.
The output of
connmanctl enable wifi is
-sh: connmanctl: command not found.
Is it possible to install connmanctl? If not, is there another way to set up an Access Point?
The article you are referencing is only valid for our BSP 2.8. In our newer BSPs including Torizon we use Network Manager which has
nmcli. The article about general networking on Torizon can be found here: https://developer.toradex.com/knowledge-base/networking-with-torizoncore
However I can see this won’t help you too much here since we don’t have any info on access point mode configurations in that article yet. So in the meantime let me describe roughly what the steps are.
- So all the parts about hostapd in the article you are referencing are still valid for Torizon.
- I believe the equivalent of
connmanctl enable wifi for Network manager would be
nmcli nm wifi on
NOTE There is currently a known issue with wifi access point mode on i.MX8X on Torizon there is a workaround described here: https://developer.toradex.com/software/torizon/release-details?view=all&key=TOR-979
NOTE There is another issue after you workaround the first issue, where access point interface does not always get created properly there is another workaround described here: https://developer.toradex.com/software/torizon/release-details?view=all&key=TOR-980
Thank you for bringing awareness to lack of documentation on this topic I’ll work to see that resolved. Hopefully the workarounds work for you, otherwise we are working on fixing them up internally. Meaning proper fixes should be coming in the next release of Torizon.
Thanks for your reply!
I have done the workarounds but
nmcli nm wifi on returns
Error: argument 'nm' not understood.. I have tested to do
nmcli r wifi on instead. Is that equivalent?
I still have some errors when trying to start hostapd. This is the error:
Job for hostapd.service failed because the control process exited with error code. The output of
systemctl status hostapd.service is:
It seems there may also be related issues with hostapd service starting up properly. It seems one possible workaround is after you have created your hostapd config file, you’ll want to reboot the system with
sudo reboot -f. It’s important that it’s a forced reboot from the command line as other reboots seem either ineffective or less consistent.
Unfortunately, the forced reboot did not solve the problem. I get the same error as before. Have you managed to set up an access point on the Colibri IMX8?
I’ve got it working once on the i.MX8 which is similar to the i.MX8X. Though I say “once” as it seems to depend on whether the AP interface comes up correctly.
What is the output of
iw dev on your device? For access point mode there should be a uap0 interface which is the access point interface you want to use for hostapd… Unfortunately for me and I imagine your case as well it sometimes doesn’t appear. Though rebooting the system seems to randomly change the name of the interfaces that get brought up, sometimes uap0 comes up which is what you want. This is the 2nd known issue that I linked earlier. There’s no consistent workaround other than rebooting till you get the uap0 interface.
Good news is that we currently have a fix internally and reviewing it. If the fix is good it should be a part of the next monthly Torizon release, however you can get access to it earlier by accessing our nightly feeds via the Easy Installer tool.
Thanks for your great guidance!
The Access Point is now up but I can’t connect to it from other devices because the IP-address can’t be found. Apparently it seems like there is not a DHCP server configured. I have written
DHCPServer=yes in the hostapd.network file as suggested but it is still not possible to connect to the Access Point.
I am happy to hear that you managed to get it up. Unfortunately I missed the last line of my /etc/hostapd.conf saying “own_ip_addr=192.168.8.1” in my previous comment. I changed my original comment, please update your conf accordingly.
Beside that, it actually should work. I didn’t change anything else and I am able to connect and e.g. access the running portainer container on 192.168.8.1:9000. There is no need for a separate dhcp-service, because systemd-networkd provides us this functionality with the configuration of /etc/systemd/network/hostapd.network. If you really think you miss the dhcp functionality, you could also check if this service is running with
sudo systemctl status systemd-networkd, but it should be default.
By the way, I used our 4.0.0-devel-202004 Monthly Release for my tests. If your setting still doesn’t work, it’s probably worth it to restart with a clean reinstall of the latest monthly release (through the CI feed in Toradex Easy Installer) and check that. You may did some changes in the past where you are not aware of anymore?
Unfortunately, after I made a reinstall to 4.0.0-devel-202004 the access point is not working. These are the files that I’m using:
This is what I get:
I have also tested to change the hostapd.service file AFTER to:
After=multi-user.target according to revision 17 in this article but that returns this:
I believe the issue is with your
Below is my file:
Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
ExecStart=/usr/sbin/hostapd /etc/hostapd.conf -P /run/hostapd.pid -B
For Torizon you don’t need to add the dependencies to the uap device file as this doesn’t exist on Torizon I believe which is why you’re getting dependency failures.
Yes, I have tested that and I posted the error I got in the last picture in my previous post. There is an error found in the
Apologies, I misunderstood the content of your post.
Here’s the contents of my
It seems identical to yours. Perhaps try remaking the file and recopying the contents. Sometimes the hostapd.conf file can be finicky with how it handles white space which can lead to read errors.
If the errors continues could you also provide the output of
sudo journalctl -xe, as this may have more information on what is exactly wrong with your
The problem is solved. Thanks!
I found that there were line-ending characters in the hostapd.conf file. The access point is now up and running.
Make sure you have the mwifiex.conf (you need to add that manually because of the mentioned issue):
colibri-imx8x-06494206:~$ cat /etc/modprobe.d/mwifiex.conf
options mwifiex driver_mode=0x3
The hostapd.conf can be added as explained in the article:
colibri-imx8x-06494206:~$ cat /etc/hostapd.conf
The hostapd.network can be added as explained in the article as well:
colibri-imx8x-06494206:~$ cat /etc/systemd/network/hostapd.network
To change the hostapd.service in ‘/lib/systemd/system/hostapd.service’ on the running Torizon instance as explained in the article you need to make a little hack and change the file in the deployed ostree. This should generally be avoided because this is not the intended workflow of ostree, but in this case you can quickly change a little configuration to check if your system would work with that: Instead of changing the hostapd.service direclty in ‘/lib/…’ (which is read-only), you can change it in ‘/ostree/deploy/torizon/deploy/.0/lib/systemd/system/hostapd.service’. After a reboot, it will be replicated to ‘/lib/systemd/system/hostapd.service’.
Now you should be able to run hostapd if the module started properly with the interface
uap0 (which randomly happens or not, as described from @jeremias.tx). After booting the module, you can check if there is the required interface with
iw dev. If there is no
uap0 but an interface called
mlan0 there is no other way than reboot and try again currently with the existing known issues TOR-980 and TOR-979.
If this all still doesn’t work, there is most probably a wrong configuration. Could you then send the output of
sudo systemctl status hostapd.service and after executing
sudo systemctl restart hostapd.service the output of
sudo journalctl -xe?
Glad to hear you have resolved this issue.