Thank you! At least I’m not alone. I know this sounds as not a big deal with physical access to the router, but it would be better to make it boot with usb inserted.
I have physical access but usually, when we need it most we would not have the access!! So, I am not going to use it.
From the wiki:
Device will boot OpenWRT from USB but not from eMMC / network interface never comes up
If you are able to boot from USB and flash the OpenWRT image, but a network interface never comes up when the router reboots from eMMC, it may be necessary to zero the eMMC before flashing:
dd if=/dev/zero bs=512 seek=7552991 of=/dev/mmcblk0 count=33
dd if=/dev/zero bs=1M of=/dev/mmcblk0
This problem is (tentatively) known to occur after a factory reset to the stock firmware from OpenWRT.
You have to clear the eMMC. Instructions in the wiki.
That isn't the issue here. The problem is that once OpenWrt is installed on the OnHub you can not reboot the device with anything plugged into the usb port. It will halt the boot up. The OnHub is always in developer mode. This is the only way for OpenWrt to work on these devices. Therefore, when it boots up it is looking for a boot image and looks to the usb port first, then internal. All this is happening before OpenWrt is running.
Just the same, when you screw it up like this, the only way to recover and make it work properly is to zero the eMMC and start over from scratch following the wiki instructions exactly. He probably has to use this too:
In the beginning of all this, I spent a lot of time and gave up again and again. Give it some time. Clear your head. Start over from scratch.
It doesn't break anything. All you have to do is remove the offending usb device and the OnHub will boot up just fine again. It just makes the usb port unusable for anything on these devices. For example: printer, samba, etc...
Perhaps, you can clarify. I have a fully functional ONHUB. It is configured to reboot every day at 5:00 AM using touch /etc/banner, sleep, and reboot. On most days, it works fine. Some days, when I connect, use and forget to remove the USB, at 5:00 AM, it hangs expecting a usb device to be a boot device. When I remove it and power cycle, it works perfectly as an openwrt device.
Are you suggesting that if we erase the eMMC, this problem will go away?
Pls clarify your experience and what caused you to scratch your head in suspicion?
Perhaps I don't quite understand what you are doing or trying to do. Do you want the OnHub to operate normally without a USB inserted, or do you want the entire OpenWrt system to boot and operate from a plugged in USB for some reason I don't understand. Tell me what your goal is here. What kind of setup do you want if everything was the way you want it to be.
Most people use the USB just to install OpenWrt onto the built-in memory of the OnHub (the eMMC memory). This is all thoroughly explained in the wiki I linked to. When you follow the wiki instructions, the OnHub works as an OpenWrt router without the need of a USB. You can plug extra storage or a printer into the USB. I guess I'm just completely confused concerning what it is you are doing or even want to do or why.
Thanks for responding.
I have a OnHub, fully functional with Openwrt.
If I plug in a USB device to this, it is properly recognized as either a storage or a wifi card or a printer.
If there is a power failure, and then restored when I am away from the router, the router will experience a unattended power cycle.
When it starts to boot, when I am not there, it will see that a USB device is plugged in. And it does not matter if it is a storage USB or a Wifi dongle USB, it will try to boot from it and then hang since there is no OS on that USB device.
We don't like this behavior of OnHub because then USB is only usable for ephemeral use case.
I hope I am able to explain.
I want to use Onhub with an attached USB mSata drive that is storage for KSBD on the Openwrt. And, it should work fine when it reboots when no one is around.
Pls advise.
OpenWrt on the Onhub is only possible by running the device in developer mode. That means that during the intital boot stage coreboot will scan the USB port. When it finds a valid USB drive with an properly configured operating system / firmware it will boot from the USB stick. If it finds nothing plugged into the USB port it will proceed to boot from the operating system on the internal emmc storage. If it finds another USB device without an operating system it will hang and do nothing.
Once linux / OpenWrt has booted it will take control of the USB port and any USB device can be used as normal.
So rebooting the Onhub with something plugged into the USB port which does not contain a working firmware / operating system will cause it to hang.
One possible work around which may work is to use an USB hub to split the port into multiple USB ports. If you then run OpenWrt from an USB stick and have it permanently plugged in this may work but I have not tried this.
The whole thing of zeroing out the emmc has nothing to do with the boot process. This was a fix / work around to remove any data from emmc to avoid any possible network issues when re-flashing an Onhub.
So you can try to install OpenWrt on the beginning of your msata drive and create a new partition on the free space at the end to use as storage.
Or you could try to add an USB hub and run OpenWrt from a permanently plugged in USB stick and plug the msata drive into another port of the USB hub. I'm not sure this will work but is something you could try / experiment with.
An excellent explanation. Specially:
I will test out the mSATA when I am back home with a 250MB partition and also, when I can find (burried somewhere) the USB hub and it behavior).
While a slight disappointing, it is a heroic outcome for devices that are still making their way into electronic waste despite housing a decent heft.
@agarg, any reason why you want to reboot your OnHub every day at 5.00AM? I have OpenWrt routers that are up and running for years without any hiccup.
Maybe an uninterruptable power supply is the answer in this situation. I completely missed his point and you're right that zeroing the eMMC has nothing to do with the issue. But more likely, using the OnHub in this way is not the best way to go about it. I think @agarg should configure his home system differently to attach the sata drive and printer and not bother trying to make the OnHub do so much when the same things can be accomplished without it. I give him credit for discovering an issue that seems obvious that we never even thought about until he brought it up.
I have often wondered about this as these are not MS Windows based where memory leaks (some due to apps) were common some 20 years ago. I am retired and not sure of the status now.
I saw there was a mention of this on OpenWrt site also and I saw no harm of reboot when I am asleep. I can easily take that off but wont be able to convince Pacific Gas and Electricity that electricity outage is not good for citizens!!!
Here is something from the OpenWrt site:
Perhaps, I will take it off.
@KSofen : Are you suggesting that I have my whole house on Battery. The earlier regulation from Pacific Gas and Electricity required that Solar equipment manufactures use "Break" connection from the grid "Before make" connections to the house. As a result, there a one second outage when the electric supply from the grid is interrupted.
When you allude about configuring my home system differently, do you mean that I leave the USB port unused? BTW, I am thinking of the same thing by using another openwrt device that I have unused and spare.
One thing to note is that in order for the OnHub to boot from the plugged usb device the developer button on the bottom must be pressed. If not it will not boot.
Don't reduce the issue to absurdity. Use the UPS on the OnHub. Your issue was that it hangs up on reboot because of a drive or a printer plugged into the USB when there's a power loss. A UPS fixes that issue.
APC UPS Battery Backup and Surge Protector, 600VA/300 Watts Backup Battery Power Supply
And yes, you don't need to use the OnHub USB just because its there. Plug it into your computer or use a NAS or buy a modern printer with Airprint. It's just a bit silly to depend on an end-of-life router hacked to work again for the purposes you describe. No one would expect such a setup to be reliable or depend on it to be reliable.
If you must use the OnHub as you describe. You can try the $79 UPS and plug the power cord from the OnHub into that to keep it powered through the outages. If you want to rewire your whole home to keep using the OnHub USB, it's going to cost about $20,000:
So don't be silly. The OnHub is not worth such effort. I feel silly spending months getting the darn thing to work at all.
The old man needs more sleep lol!