Usb power is off on boot

Hi!
I've just installed default recommended from wiki OpenWrt 24.10.0 (r28427-6df0e3d02a) on my mikrotik hap ac (RB962UiGS-5HacT2HnT).
Next I wanted to use usb stick to set up extroot, installed all possible usb-related packages with no results.
After some searching, I've tried usb drive with led indicator and found out that usb power is turned off and managing by /sys/class/gpio/usb-power/value, but only until reboot.
So what is wrong with usb power and how to permanently turn it on to use with extroot?
Will it be enough to put "echo 1 > /sys/class/gpio/usb-power/value" to "/etc/rc.local" or should it be turned on somehow before?

Check if /etc/config/system has a block to configure that GPIO. This is the preferable way to set up GPIOs.

No gpio there:


config system
        option hostname '###'
        option timezone '###'
        option ttylogin '0'
        option log_size '128'
        option urandom_seed '0'
        option compat_version '1.0'
        option zonename '###'
        option log_proto 'udp'
        option conloglevel '8'
        option cronloglevel '7'

config timeserver 'ntp'
        list server '0.openwrt.pool.ntp.org'
        list server '1.openwrt.pool.ntp.org'
        list server '2.openwrt.pool.ntp.org'
        list server '3.openwrt.pool.ntp.org'

How to add my "echo 1 > /sys/class/gpio/usb-power/value" to "/etc/config/system"?

Just as an example, this is the USB power configuration for my (completely different) router:

config gpio_switch 'usb_power'
        option name 'Power USB Port'
        option gpio_pin 'usb_power'
        option value '1'

config gpio_switch 'lte_power'
        option name 'Power LTE modem'
        option gpio_pin 'lte_power'
        option value '1'

Hope this helps!

It works with "usb-power" instead of "usb_power", thanks.
On another forum i found advice to edit /etc/init.d/boot (S10boot). Is the "/etc/config/system" more preferable than "/etc/init.d/boot" to use with extroot?

Both "/etc/init.d/boot (S10boot)" and "/etc/config/system" works for regular mount but not with extroot:

root@hapacopenwrt:~# block info; uci show fstab; logread | sed -n -e "/- preinit -/,/- init -/p"
/dev/mtdblock8: UUID="daef4e7b-13195aa1-fde24068-8c6f6158" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock9: MOUNT="/overlay" TYPE="jffs2"
fstab.@global[0]=global
fstab.@global[0].anon_swap='0'
fstab.@global[0].anon_mount='0'
fstab.@global[0].auto_swap='1'
fstab.@global[0].auto_mount='1'
fstab.@global[0].delay_root='5'
fstab.@global[0].check_fs='0'
fstab.extroot=mount
fstab.extroot.uuid='a99d779b-f27f-458e-8aa7-10022febd69a'
fstab.extroot.target='/overlay'
fstab.rwm=mount
fstab.rwm.device='/dev/mtdblock9'
fstab.rwm.target='/rwm'
Wed Apr  2 20:34:47 2025 user.info kernel: [    4.548948] init: - preinit -
Wed Apr  2 20:34:47 2025 kern.notice kernel: [    8.570269] random: crng init done
Wed Apr  2 20:34:47 2025 kern.info kernel: [   10.564761] Atheros AR8216/AR8236/AR8316 mdio.0:00: Port 1 is up
Wed Apr  2 20:34:47 2025 kern.info kernel: [   10.572872] eth0: link up (1000Mbps/Full duplex)
Wed Apr  2 20:34:47 2025 kern.notice kernel: [   14.916626] jffs2: notice: (475) jffs2_build_xattr_subsystem: complete building xattr subsystem, 49 of xdatum (30 unchecked, 18 orphan) and 57 of xref (18 dead, 0 orphan) found.
Wed Apr  2 20:34:47 2025 user.info kernel: [   14.947964] mount_root: loading kmods from internal overlay
Wed Apr  2 20:34:47 2025 user.info kernel: [   15.364356] kmodloader: loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
Wed Apr  2 20:34:47 2025 kern.notice kernel: [   15.832034] SCSI subsystem initialized
Wed Apr  2 20:34:47 2025 kern.info kernel: [   16.006328] usbcore: registered new interface driver usb-storage
Wed Apr  2 20:34:47 2025 user.info kernel: [   16.013711] kmodloader: done loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
Wed Apr  2 20:34:47 2025 user.info kernel: [   16.280852] block: attempting to load /tmp/overlay/upper/etc/config/fstab
Wed Apr  2 20:34:47 2025 user.info kernel: [   16.290680] block: extroot: device not present, retrying in 5 seconds
Wed Apr  2 20:34:47 2025 user.err kernel: [   21.484445] block: extroot: cannot find device with UUID a99d779b-f27f-458e-8aa7-10022febd69a
Wed Apr  2 20:34:47 2025 user.info kernel: [   21.493871] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
Wed Apr  2 20:34:47 2025 user.info kernel: [   21.501825] block: extroot: device not present, retrying in 5 seconds
Wed Apr  2 20:34:47 2025 user.err kernel: [   26.693473] block: extroot: cannot find device with UUID a99d779b-f27f-458e-8aa7-10022febd69a
Wed Apr  2 20:34:47 2025 user.info kernel: [   26.703327] mount_root: switching to jffs2 overlay
Wed Apr  2 20:34:47 2025 kern.warn kernel: [   26.714417] overlayfs: upper fs does not support tmpfile.
Wed Apr  2 20:34:47 2025 user.warn kernel: [   26.725815] urandom-seed: Seeding with /etc/urandom.seed
Wed Apr  2 20:34:47 2025 kern.info kernel: [   26.811216] eth0: link down
Wed Apr  2 20:34:47 2025 user.info kernel: [   26.840569] procd: - early -
Wed Apr  2 20:34:47 2025 user.info kernel: [   26.843775] procd: - watchdog -
Wed Apr  2 20:34:47 2025 user.info kernel: [   27.597505] procd: - watchdog -
Wed Apr  2 20:34:47 2025 user.info kernel: [   27.601711] procd: - ubus -
Wed Apr  2 20:34:47 2025 user.info kernel: [   27.793694] procd: - init -

The things that happen before extroot is mounted have to be read from the internal filesystem. Did you modify the files there or only the copies on the USB?

I have modified files on internal filesystem.
And on step 5 of wiki:

5. Transferring data

Transfer the content of the current overlay to the external drive.

> mount ${DEVICE} /mnt
> tar -C ${MOUNT} -cvf - . | tar -C /mnt -xf -