Hello, everyone.
I hope I'm at the right place.
In short:
Yesterday I installed Diversity and vnStat on a Merlin 386.5_2 Asus-AC86U router.
Later, an "Entware not found" error showed up.
The router has 2 USB drives attached: SSD and a larger HDD.
This is now solved, solution at the bottom of this post.
Details:
I was able to run the installation via amtm with only the SSD connected and everything worked nicely. That's until I attached a second USB drive and rebooted. Disconnecting the second drive and rebooting fixes the problem but I'd like to have both drives on.
As far as I can tell, initially the SSD was sda and HDD was sdb. The router will randomly switch sda/sdb after reboot and I don't see a way to control this.
The mount points stay the same, i.e. the SSD is always mounted at tmp/mnt/ssd (regardless if it appears as sda1 or sdb1), so the paths should be ok.
However, when SSD becomes sdb and the HDD becomes sda, the dn-vnstat webUI falls apart and errors come up. Or maybe it's just confused by the presence of 2 USB drives.
The errors I can see in the router log look like this:
...
Jun 1 02:41:20 dn-vnstat: Entware not found, sleeping for 10s (attempt 9 of 10)
Jun 1 02:41:30 dn-vnstat: Entware not found, sleeping for 10s (attempt 10 of 10)
Jun 1 02:41:40 dn-vnstat: Entware not found and is required for dn-vnstat to run, please resolve
...
Maybe the problem is not in dn-vnstat but I have to start from somewhere.
Any advice how to debug this further?
Root cause and solution
If there is a drive with an asusware.arm folder, it will steal the /opt symlink and break Entware.
The symlink should point to the correct path.
So delete or rename that folder.
This is a feature of the original Asus router firmware designed for the Download Master application.
Apparently, such a problem is unlikely to happen with a single drive attached because the Entware installation will detect it. As the second drive wasn't plugged in initially, the detection was bypassed.
It might be possible to add a script that restores the stolen symlink or something to that effect. Or, at least detect the problem and print a proper message in the system log to notify the user what the issue is and what could be done about it. Something like this:
	
	
	
		
The above can be put in a separate script in /jffs/scripts, e.g. "check-usb" (so it doesn't interfere with other code).
It can then be called and sent to background from post-mount like this:
Looking at the log, it seems this problem doesn't always happen. You can put a USB device with an asusware.arm folder on it and have it take away the opt symlink. Then you can put another device with such a folder and have the correct opt link preserved. Go figure.
				
			I hope I'm at the right place.
In short:
Yesterday I installed Diversity and vnStat on a Merlin 386.5_2 Asus-AC86U router.
Later, an "Entware not found" error showed up.
The router has 2 USB drives attached: SSD and a larger HDD.
This is now solved, solution at the bottom of this post.
Details:
I was able to run the installation via amtm with only the SSD connected and everything worked nicely. That's until I attached a second USB drive and rebooted. Disconnecting the second drive and rebooting fixes the problem but I'd like to have both drives on.
As far as I can tell, initially the SSD was sda and HDD was sdb. The router will randomly switch sda/sdb after reboot and I don't see a way to control this.
The mount points stay the same, i.e. the SSD is always mounted at tmp/mnt/ssd (regardless if it appears as sda1 or sdb1), so the paths should be ok.
However, when SSD becomes sdb and the HDD becomes sda, the dn-vnstat webUI falls apart and errors come up. Or maybe it's just confused by the presence of 2 USB drives.
The errors I can see in the router log look like this:
...
Jun 1 02:41:20 dn-vnstat: Entware not found, sleeping for 10s (attempt 9 of 10)
Jun 1 02:41:30 dn-vnstat: Entware not found, sleeping for 10s (attempt 10 of 10)
Jun 1 02:41:40 dn-vnstat: Entware not found and is required for dn-vnstat to run, please resolve
...
Maybe the problem is not in dn-vnstat but I have to start from somewhere.
Any advice how to debug this further?
Root cause and solution
If there is a drive with an asusware.arm folder, it will steal the /opt symlink and break Entware.
The symlink should point to the correct path.
So delete or rename that folder.
This is a feature of the original Asus router firmware designed for the Download Master application.
Apparently, such a problem is unlikely to happen with a single drive attached because the Entware installation will detect it. As the second drive wasn't plugged in initially, the detection was bypassed.
It might be possible to add a script that restores the stolen symlink or something to that effect. Or, at least detect the problem and print a proper message in the system log to notify the user what the issue is and what could be done about it. Something like this:
		Bash:
	
	#!/bin/sh
#Check for potential conflict with asusware.arm
#Keyword to search for
name="asusware.arm"
#Set path if not provided
path=$1
if [ -z "$1" ]; then
   path="/"
fi
#Wait for concurrent processes to complete
sleep 7
#Determine if Entware is installed
#-type option not recognized by built-in find
opkgpath=$(find / -name opkg 2>&1| grep /bin/opkg | head -1) #Get first match
entpath=""
#logger -t check-usb "Found opkg path: $opkgpath"
#Check if output is a file
if [ -f $opkgpath ]; then
   entpath=${opkgpath/"/bin/opkg"/""} #Determine Entware path
fi
#Entware found, now check for conflict
#if [ -d $entpath ]; then #Doesn't work with empty string
if [ -d $entpath ] && [ -z ${entpath##*"entware"*} ]; then
   logger -t check-usb "Entware found in $entpath"
   logger -t check-usb "Looking for $name in $path"
   #asusdir=$($entpath/bin/find $path -type d -iname $name 2>&1) #Run find command from Entware
   asusdir=$(find $path -iname $name 2>&1) #using built-in find   
   #Print output if any
   if [ "${#asusdir}" != "0" ]; then
      logger -t check-usb "$asusdir"
   fi
   #
   if [ -d "$asusdir" ]; then
      logger -t check-usb "WARNING: Incompatible asusware directory found at $asusdir"
      logger -t check-usb "Please delete or rename $name to avoid possible conflict with Entware."
      logger -t check-usb "opt path: $(readlink -f /opt)"
      if [ $(readlink -f /opt) != $entpath ]; then
         #Try to restore the original path
         rm /tmp/opt
         ln -s $entpath /tmp/opt
         logger -t check-usb "opt path reset to: $(readlink -f /opt)"
      fi
   else
      logger -t check-usb "No $name conflict found."
   fi
fi
logger -t check-usb "USB device check completed."
echo "USB device check completed. See log for details."It can then be called and sent to background from post-mount like this:
/jffs/scripts/check-usb $1 &Looking at the log, it seems this problem doesn't always happen. You can put a USB device with an asusware.arm folder on it and have it take away the opt symlink. Then you can put another device with such a folder and have the correct opt link preserved. Go figure.
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
	
 
 
		 
 
		 
 
		