Hostapd startup fails after reboot

I have been successful at setting up AP mode on our Verdin AM62 module by following the Wifi Access Point Mode guide.

Step 5 in the guide is a little confusing indicating to execute the following command to change the hostapd permissions:

sudo mount -o remount, rw /usr/

This actually remounts the /usr partition as read-write instead of read-only. I assume this is so hostapd / systemd-networkd can store DHCP lease info.

The problem is that after a reboot /usr is mounted as read-only again which seems to cause hostapd to fail, or at least the SSID doesn’t show up in the list of available APs on my laptop. If I remount /usr as read-write and restart hostapd it works again until the next reboot.

How do I address the problem with /usr getting mounted read-only on subsequent boots?

Here’s output from tdx-info:

------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           6.6.58-7.1.0-gf874412b7190 #1-Torizon SMP PREEMPT Fri Dec  6 14:07:48 UTC 2024
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/f3e8eace2362cfd69fe527293cf3f705d48ce1c6781b1052c56459592e6a30dc/0
Distro name:              NAME="Torizon OS"
Distro version:           VERSION_ID=7.1.0-build.4
Distro variant:           VARIANT="Docker"
Hostname:                 verdin-am62-15601305
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin AM62 WB on Verdin Development Board
Toradex version:          0075 V1.2A
Serial number:            15601305
Processor arch:           aarch64
------------------------------------------------------------

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for your detailed explanation and the tdx-info output. You’re correct in your observations:

  • On Torizon OS, both /usr and / partitions are mounted read-only by design to enhance system reliability and protect against corruption.
  • Remounting /usr as read-write is only temporary; it will revert to read-only after the next reboot (Torizon OS Details).

Why is This Happening?

When operating in Wi-Fi Access Point (AP) mode, services like hostapd and sometimes systemd-networkd may try to store state data (such as DHCP leases) under directories in /usr, /var, or /etc. On TorizonCore, writable locations are intentionally limited to avoid filesystem corruption and to make the system more reliable.

Best Practice on Torizon OS

You should not make /usr persistently writable on Torizon OS, as this undermines its reliability model. Instead, you should configure these services to store any runtime or state data in directories that are designed to be writable.

Writable Locations

  • /var (partially ephemeral, but certain subfolders persist between reboots)
  • /etc (may be writable, but should only be used for configuration)
  • /tmp (tmpfs, always ephemeral)
  • /home
  • /data (created for persistent application data)

(Writable Filesystem Structure Reference)

Solution: Configure Services to Use Writable Paths

  1. DHCP Leases Directory

    • Make sure hostapd and dnsmasq (if used) store their leases in /var or /data.

    • For dnsmasq, specify:

      dhcp-leasefile=/var/lib/misc/dnsmasq.leases
      

      Ensure /var/lib/misc exists and is writable.

    • For hostapd, state files can be directed to /var as well:

      wpa_psk_file=/var/lib/hostapd/wpa_psk.conf
      

      Create this directory if it does not exist.

  2. Systemd Overlays

  3. Hostapd Specifics

    • If hostapd is logging or writing to /usr, review its configuration and move any state or runtime files to /var or /data.
    • Consult the relevant conf files and set writable locations as explained above.

Guide References

Summary

Remounting /usr as writable is not recommended and will revert after reboot. Instead, update your service configurations so all runtime and state data is stored under /var, /data, or other writable locations. If any default paths target /usr, override them through configuration files or systemd service override files to use a writable path.

If needed, let me know which exact service or files are causing issues after the reboot, and I can help you with the precise configuration steps!

Best regards,
Toradex AI Assistant.

Hey @koverly,

Right below step five there is this note for keeping the changes persistent.

AP will not survive a reboot.

The Hostapd service starts by default after the network target. This target is loosely defined and means “start after the network stack is up”. That service will fail because the network device (uap0 by default) is not up yet, or not every time. To fix this we can tell systemd that the hostapd.service file depends on a device, named sys-subsystem-net-devices-uap0.device on Torizon OS. To make it persist do the following steps:

-Eric

Hi @eric.tx,
So is remounting /usr as read-write unnecessary then?

I have already made the changes you referenced below step 5. Was remounting /usr as read-write only to allow editing /usr/lib/systemd/system/hostapd.service, and it doesn’t matter if its mounted read-only on reboot?

Perhaps the problem is that the wifi device on the Verdin AM62 is mlan0 and not uap0 and the changes to /usr/lib/systemd/system/hostapd.service must be modified accordingly?

Like this:

[Unit]
Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
BindsTo=sys-subsystem-net-devices-mlan0.device
After=sys-subsystem-net-devices-mlan0.device

Thanks,
-Ken

Hi @eric.tx,
You can disregard my previous message. I was confused about mlan0 vs uap0 but did some reading and understand uap0 is intended for access point mode.

hostapd is surviving a reboot now. Thanks for your assistance.

-Ken

l

Eric Singer
Toradex