What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Solved lighttpd / upsdrvctl on stock

Seda

New Around Here
This will be my first thread, apologies if it's in the wrong place; but it relates to a GT-BE98 running stock ASUSWRT. Firmware version is 3.0.0.6.102_37839

I'm having an issue where on the GT-BE98 I can't seem to get lighttpd or upsdrvctl to start properly on boot. Both services "start" but are non-functional until restarted after the router is first booted. Logging into the router via ssh and restarting the services works.
Scripts to start swap (s01swap) and netdata (s60netdata) work just fine.

lighttpd is configured on port 81. NUT is configured to communicate with an Eaton 3S. After the router is booted, I log in via SSH and restart S15upsd and S99lighttpd and then they will work straight away. I would like to not need to do this.

Has anyone else encountered this? I've searched (been a lurker for a long time) but can't find anything that appears relevant - all the other threads with vaguely related issues appear to refer to modded firmware.

To try and narrow it down, I tested this on a GT-AX11000 running 3.0.0.4.388_24403 and the same problem happened. However, on a RT-AC5300 running 3.0.0.4.386_48439 everything works as expected, but I had previously customised that router in other ways and may be missing something there I haven't applied to the others. (The RT-AC5300 performs well enough to do everything but it has a damaged radio; 5GHz-2 doesn't seem to work - it does have a MAC address just always Channel 0, or I'd just use that at the location in question.)

If anyone has any advice I would greatly appreciate it.
 
Congratulations. You have discovered how much Asus has neutered their routers since the AC5300. For now the Merlin firmware is the only way to add features.
 
Congratulations. You have discovered how much Asus has neutered their routers since the AC5300. For now the Merlin firmware is the only way to add features.
Netdata, the Entware mount, and Swap start just fine? It all works on stock firmware, so the features are "added" but they won't start automatically on boot.

Is there a way to perhaps trigger a restart a minute after the router is booted? I tried a sleep 60s delay, but that didn't work. Is it something ASUS did to startup on routers after the RT-AC5300, or just did to routers on newer firmware than the RT-AC5300 has? Why can netdata start but lighttpd can't?
 
Stock firmware doesn't support Entware or custom scripts. So whatever you're doing is non-standard and we can't begin to guess how you're doing this.
 
Stock firmware doesn't support Entware or custom scripts. So whatever you're doing is non-standard and we can't begin to guess how you're doing this.
Apologies for not including those details, here's how I did it;

1. Attach USB stick
2. SSH into the router and:
# mkfs.ext3 /dev/sda -L "Core"
(yes i used whole device)

3. Mount that filesystem
Code:
mkdir -p /tmp/mnt/Core
mount /dev/sda /tmp/mnt/Core

4. Set up the incredibly dodgy automount

Code:
# cd /tmp/mnt/Core/
# mkdir asusware.arm/etc asusware.arm/etc/init.d asusware.arm/lib asusware.arm/lib/ipkg asusware.arm/lib/ipkg/info entware
# echo -e "#!/bin/sh\nmount -o bind /tmp/mnt/Core/entware /opt\n/opt/etc/init.d/rc.unslung start" > asusware.arm/etc/init.d/S50entware
# echo "Enabled: yes" > asusware.arm/lib/ipkg/info/entware.control

5. Reboot

# ls -ld /tmp/opt

this will show that your drive is mounted, for example:

Proteus@Proteus:/tmp/home/root# ls -ld /tmp/opt
lrwxrwxrwx 1 Proteus root 26 Jan 1 2024 /tmp/opt -> /tmp/mnt/Core/asusware.arm

6. Install Entware
Code:
# cd /opt
# wget -O - http://bin.entware.net/aarch64-k3.10/installer/generic.sh | sh

7. Reboot

Entware should now work, e.g.

# opkg install lighttpd nano nut nut-upsc rsync usbids usbutils

9. Reboot to confirm its still there
Code:
# opkg list-installed
 
Try wrapping your mount code in { sleep 10; your-code } & in S50entware
In your code Asus scripts can still be messing with /opt mount while you're mounting Entware

Unlikely that this is the cause but I personally had some troubles with Asus scripts messing up with my Entware installation
 
Last edited:
Try wrapping your mount code in { sleep 10; your-code } & in S50entware
In your code Asus scripts can still be messing with /opt mount while you're mounting Entware

Unlikely that this is the cause but I personally had some troubles with Asus scripts messing up with my Entware installation
Thank you so much - I never thought of adding sleep to that file.

This solved the problem, it works flawlessly now!


Code:
#!/bin/sh
mount -o bind /tmp/mnt/Core/entware /opt
/opt/etc/init.d/rc.unslung start
sleep 10s; /tmp/mnt/Core/entware/etc/init.d/S99lighttpd restart
sleep 10s; /tmp/mnt/Core/entware/sbin/upsdrvctl start
 
Apologies for not including those details, here's how I did it;

1. Attach USB stick
2. SSH into the router and:
# mkfs.ext3 /dev/sda -L "Core"
(yes i used whole device)

3. Mount that filesystem
Code:
mkdir -p /tmp/mnt/Core
mount /dev/sda /tmp/mnt/Core

4. Set up the incredibly dodgy automount

Code:
# cd /tmp/mnt/Core/
# mkdir asusware.arm/etc asusware.arm/etc/init.d asusware.arm/lib asusware.arm/lib/ipkg asusware.arm/lib/ipkg/info entware
# echo -e "#!/bin/sh\nmount -o bind /tmp/mnt/Core/entware /opt\n/opt/etc/init.d/rc.unslung start" > asusware.arm/etc/init.d/S50entware
# echo "Enabled: yes" > asusware.arm/lib/ipkg/info/entware.control

5. Reboot

# ls -ld /tmp/opt

this will show that your drive is mounted, for example:

Proteus@Proteus:/tmp/home/root# ls -ld /tmp/opt
lrwxrwxrwx 1 Proteus root 26 Jan 1 2024 /tmp/opt -> /tmp/mnt/Core/asusware.arm

6. Install Entware
Code:
# cd /opt
# wget -O - http://bin.entware.net/aarch64-k3.10/installer/generic.sh | sh

7. Reboot

Entware should now work, e.g.

# opkg install lighttpd nano nut nut-upsc rsync usbids usbutils

9. Reboot to confirm its still there
Code:
# opkg list-installed
Thank you for sharing this post. Others may find it useful.

I am curious, I also use NUT on my router. I run Merlin though. With my AC86U, to get all the components of NUT running AND talking to my UPS, I had to load the input-core.ko, hid.ko, and the usbhid.ko kernel modules. With the AX86U-Pro, I had to the load the usbcore.ko and usbhid.ko modules (the hid.ko module is built into the AX86U-PRO kernel). I am curious to know if the stock firmware already has these modules loaded, or if upsdrvctl alone does not require the extra modules.

I am using upsdrvctl, upsd, and upsmon to communicate and monitor my system UPS (and email me when issues or power outages occur). I also had to do some scripting to get everything to work as Entware's version of NUT expects the root user to be named root whereas in Asu, the root user is your router userid.

Cheers mate
 
Thank you for sharing this post. Others may find it useful.

I am curious, I also use NUT on my router. I run Merlin though. With my AC86U, to get all the components of NUT running AND talking to my UPS, I had to load the input-core.ko, hid.ko, and the usbhid.ko kernel modules. With the AX86U-Pro, I had to the load the usbcore.ko and usbhid.ko modules (the hid.ko module is built into the AX86U-PRO kernel). I am curious to know if the stock firmware already has these modules loaded, or if upsdrvctl alone does not require the extra modules.

I am using upsdrvctl, upsd, and upsmon to communicate and monitor my system UPS (and email me when issues or power outages occur). I also had to do some scripting to get everything to work as Entware's version of NUT expects the root user to be named root whereas in Asu, the root user is your router userid.

Cheers mate
I'm not sure if there's any difference with the RT-AX86U-Pro; I own a GT-BE98, GT-AX11000, RT-AC5300, and used to run this on an RT-AC3200, and an RT-AC87U. All of them worked with the same configuration (minus the newer firmwares not allowing NUT/Lighttpd do run at startup until the fix above).

I never had to manually load any module, I only ever had to install the Entware packages, e.g;

Code:
opkg install nut-driver-usbhid-ups

Just in case it helps, this is the configuration I am using. Note that I do not have NUT itself notify anything; I have another server which periodically grabs the UPS status and makes it available via a web interface on lighttpd.

nut.conf
Code:
MODE=standalone
ups.conf
Code:
[eaton3s]
driver = usbhid-ups
port = auto
user = Proteus
upsd.conf
I have no settings applied in this file.
upsd.users
Code:
[monuser]
password=pass
upsmon primary
upsmon.conf
Code:
MONITOR eaton3s@localhost 1 monuser pass primary
S15upsd
Code:
#!/bin/sh

ENABLED=yes
PROCS=upsd
ARGS="-u Proteus"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

. /opt/etc/init.d/rc.func
 
Interesting. It has been a few years since I set up NUT. I will have to play some now and see what what part of NUT complained until I loaded the kernel modules. It is possible too, I suppose that you some other Asus generic feature enabled that loaded the modules.

You had to change the userid ID as well, except you did it with the ARGS argument in the init.d startup directory. Since I had to load additional modules, I just wrote my own startup script and called it from the init.d directory. Mind you, I also wanted to adjust some UPS parameters as well via NUT (which is lost on my UPS after a power cycle), so a script was a good way to go.

Thanks again for sharing. I'll have to do some playing now.

Cheers
 
Similar threads
Thread starter Title Forum Replies Date
G NextDNS on Stock firmware ASUSWRT - Official 5

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top