What's new

Entware Problem mounting opt / installing entware

  • 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!

Simpistic

Occasional Visitor
So I have an AX3000-v2 (didn't know I wanted Merlin/Entware until I got it) and I am trying to install Entware on it..
I followed the official guide but I can't seem to get the script to mount the UDB drive (formatted to NTFS) on boot.

when I create the mount manually I do manage to install Entware though it seems to override the contents of the opt folder with the content of the USB drive (was only able to do it with bind)
Code:
mkdir /tmp/opt
mount /dev/sda2 /tmp/opt
mount --bind /tmp/opt /opt

Would overriding the opt folder cause problems in the future ?

I am kinda new to this stuff, have a bit of experience with linux but I am by no means and expert, would really appreciate the help on the matter.
 
So I have an AX3000-v2 (didn't know I wanted Merlin/Entware until I got it) and I am trying to install Entware on it..
Merlin doesn't make firmware for the V2 only the V1.

I followed the official guide but I can't seem to get the script to mount the USB drive (formatted to NTFS) on boot.

when I create the mount manually I do manage to install Entware though it seems to override the contents of the opt folder with the content of the USB drive (was only able to do it with bind)
Code:
mkdir /tmp/opt
mount /dev/sda2 /tmp/opt
mount --bind /tmp/opt /opt

Would overriding the opt folder cause problems in the future ?
The original /opt directory is normally empty so this does not cause a problem.

However, I believe the script_usbmount function is no longer supported so it will not automatically mount /opt any more.
 
The original /opt directory is normally empty so this does not cause a problem.

However, I believe the script_usbmount function is no longer supported so it will not automatically mount /opt any more.
That's a shame, is there any other way to install Entware persistently or at least be able to install custom packages ?

Merlin doesn't make firmware for the V2 only the V1.
Yeah I managed to have a look around and saw that v2 has different hardware and that you can't just install the v1 firmware.
Is it just because it will take a lot of time and effort to make another build for v2, or is there some other hardware/software limitation that prevents the creation of build for v2?
 
That's a shame, is there any other way to install Entware persistently or at least be able to install custom packages ?
Not that I know, but I don't use stock firmware so perhaps there are workarounds that I'm not aware of. What packages are you wanting to install?

Is it just because it will take a lot of time and effort to make another build for v2,
Yes. RMerlin is one person doing this in his spare time so he limits himself to the most popular models. There are other considerations as well, like the availably of the GPL code.
 
Not that I know, but I don't use stock firmware so perhaps there are workarounds that I'm not aware of. What packages are you wanting to install?
Well, I would like to start with installing tailscale so I would be able to access the router from a remote location and configure a wireguard interface with multiple peers, from what I've seen in the GUI you can only set 1 peer and interface at a time..
 
However, I believe the script_usbmount function is no longer supported so it will not automatically mount /opt any more.
And the workaround for this is here (more updated version here) - still works - been using it for a some time.
Even build a mini-script "ecosystem" with it, including Entware support.
The moment you setup stable Entware setup you don't really need Merlin firmware for scripting and extra apps.
 
And the workaround for this is here (more updated version here) - still works - been using it for a some time.
Even build a mini-script "ecosystem" with it, including Entware support.
The moment you setup stable Entware setup you don't really need Merlin firmware for scripting and extra apps.
I followed your guide and it does indeed mount the drive to the opt folder on boot, but it is still read only and doesn't let me install entware..
 
I followed your guide and it does indeed mount the drive to the opt folder on boot, but it is still read only and doesn't let me install entware..
Have you tried
Code:
mount --bind /tmp/mnt/sda/entware /opt
 
Have you tried
Code:
mount --bind /tmp/mnt/sda/entware /opt

But that will only work manually, I thought that using your guide, it will allow Entware to be mounted automatically on boot such that if I installed Tailscale I would be able access the router remotely (Is that even possible or am I just wasting time here?)
I would also like to setup cloudflare ddns since asus doesn't support it out of the box..
 
See if those will help you out (you still need workaround on the USB drive):

(untested code, taken from my Entware installer)

Update TARGET_PATH with the path to your USB drive, you need it to be labeled or it can randomly be /tmp/mnt/sda or /tmp/mnt/sdb even if you only plug one thing.
Update INSTALL_URL to the installer path of your choice, this one I've been using on my AX58U v2.

Entware will be installed to "entware" directory on the drive.

After fresh reboot and your USB drive mounted by the router:

Save this as /tmp/install.sh:
Bash:
#!/bin/sh

set -e

TARGET_PATH="/tmp/mnt/MYUSBDRIVE"
INSTALL_URL="http://bin.entware.net/armv7sf-k3.2/installer"

[ ! -d "$TARGET_PATH" ] && { echo "Target path does not exist: $TARGET_PATH"; exit 1; }

[ ! -d "$TARGET_PATH/entware" ] && mkdir -v "$TARGET_PATH/entware"

umount /opt || true # asusware might be mounted here, get rid of it
mount --bind "$TARGET_PATH/entware" /opt && echo "Mounted $TARGET_PATH/entware on /opt"

for DIR in bin etc lib/opkg tmp var/lock; do
    if [ ! -d "/opt/$DIR" ]; then
        mkdir -pv /opt/$DIR
    fi
done

chmod 777 /opt/tmp
PATH=/opt/bin:/opt/sbin:$PATH

wget "$INSTALL_URL/opkg" -O /opt/bin/opkg && chmod 755 /opt/bin/opkg
wget "$INSTALL_URL/opkg.conf" -O /opt/etc/opkg.conf

opkg update
opkg install entware-opt

for FILE in passwd group shells shadow gshadow; do
    if [ -f "/etc/$FILE" ]; then
        ln -sfv "/etc/$FILE" "/opt/etc/$FILE"
    else
        [ -f "/opt/etc/$FILE.1" ] && cp -v "/opt/etc/$FILE.1" "/opt/etc/$FILE"
    fi
done

[ -f /etc/localtime ] && ln -sfv /etc/localtime /opt/etc/localtime

echo "Installation complete!"

Then run it:
Bash:
sh /tmp/install.sh

If it ran without any error then it installed Entware correctly.

Update TARGET_PATH with the path to your USB drive, you need it to be labeled or it can randomly be /tmp/mnt/sda or /tmp/mnt/sdb even if you only plug one thing.

Save this as /jffs/startup.sh:
Bash:
#!/bin/sh

TARGET_PATH="/tmp/mnt/MYUSBDRIVE"

if mount | grep -q "on /opt "; then # asusware might be mounted here, get rid of it
   sleep 10 # asusware will make /opt mount busy for few secs, wait a bit... increase this as needed
   umount /opt
fi

[ ! -f "$TARGET_PATH/entware/etc/init.d/rc.unslung" ] && { logger -s "Entware folder not found on $TARGET_PATH"; exit 1; }
mount --bind "$TARGET_PATH/entware" /opt && logger -s "Mounted $TARGET_PATH/entware on /opt"
/opt/etc/init.d/rc.unslung start

You could probably just replace (from the workaround) asusware.arm/etc/init.d/S50usb-mount-script with this one and don't bother with setting script_usbmount at all.

Make it executable:
Code:
chmod 755 /jffs/startup.sh

Add it to script_usbmount var:
Code:
nvram set script_usbmount="/bin/sh /jffs/startup.sh"
nvram commit

Reboot now?
 
Last edited:
I tried both of them and still after I reboot "opgk" command is not recognized.
We have the exact same model of router (AX3000 v2), does yours work after a reboot or do you also need to manually mount / install Entware after every reboot? (is there something I am missing?, is what I am asking even possible without a custom Merlin firmware? )
 
You're definitely doing something wrong because it works on my end. Maybe the USB drive is at fault here? You should debug if the workaround even works, sometimes you have to install Download Master once first (then wipe the drive, not uninstall) to have some nvram vars initialized/set.
 
Last edited:
You're definitely doing something wrong because it works on my end. Maybe the USB drive is at fault here? You should debug if the workaround even works, sometimes you have to install Download Master once first (then wipe the drive, not uninstall) to have some nvram vars initialized/set.
I saw you mentioned it before but I just couldn't find it in my router for some reason :
1699466975989.png



The thumb drive is detected:
1699467052292.png


what should I do ?
 
The USB is formated as NTFS? I do not know if it works on NTFS. I know it works on EXTx.
 
The USB is formated as NTFS? I do not know if it works on NTFS. I know it works on EXTx.
This.
In my case ext4/3 didn't auto mount but ext2 did.

I saw you mentioned it before but I just couldn't find it in my router for some reason :

The thumb drive is detected:

what should I do ?
Maybe your model doesn't support Asus' Optware at all, that would probably make the workaround not work.
See if nvram get rc_support contains "app" or "appnet".
 
In my case ext4/3 didn't auto mount but ext2 did.
I used ext2 as per your guide (had to reformat from NTFS)
Maybe your model doesn't support Asus' Optware at all, that would probably make the workaround not work.
See if nvram get rc_support contains "app" or "appnet".
it contains both "app" and "appnet", I am guessing it means it should support download manager right?
 
I used ext2 as per your guide (had to reformat from NTFS)

it contains both "app" and "appnet", I am guessing it means it should support download manager right?
Perhaps that model doesn't support it internally, I'm not that familiar with the source code to be able to answer that.

Have you tried debugging the workaround?
Simplest would be putting something like this into asusware.arm/etc/init.d/S50usb-mount-script:
Code:
echo "YES" > /tmp/workaround-worked
And after a reboot checking if the file was created.
 
Have you tried debugging the workaround?
Simplest would be putting something like this into asusware.arm/etc/init.d/S50usb-mount-script:
Code:
echo "YES" > /tmp/workaround-worked
And after a reboot checking if the file was created.
It does indeed work, it also looks like the /opt/etc contain the files needed by Entware but when I run "opkg" command it doesn't recognize it
 
It does indeed work, it also looks like the /opt/etc contain the files needed by Entware but when I run "opkg" command it doesn't recognize it
Perhaps PATH variable doesn't contain paths to /opt, can you run opkg through /opt/bin/opkg command instead?
What is the output of "echo $PATH" ?
What is the output of "cat /etc/profile" ?
Does running the following command makes you able to use just opkg command afterwards ?
Code:
export PATH=/opt/bin:/opt/sbin:$PATH
 

Latest 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!

Staff online

Top