Entware is a modern alternative to Optware.
For those unfamiliar with Optware: it's a software repository that offers various software programs that can be installed on your router. They allow you to add new functionality to your router (provided you have the know-how to properly configure them).
Entware system library is specially modified (patched) so that standard linux files that are normally located in /etc
directory are now located in /opt/etc/
directory. To simplify things let's consider /etc/passwd
file. On Asuswrt-merlin it normally looks something like:
admin:x:0:0:admin:/root:/bin/sh
nas:x:100:100:nas:/dev/null:/dev/null
nobody:x:65534:65534:nobody:/dev/null:/dev/null
tor:x:65533:65533:tor:/dev/null:/dev/null
We call standard installation Entware the case, when /opt/etc/passwd
(shadow, group, gshadow, shells) files are symbolic links to the equivalent files in /etc
directory. When Entware binaries need to access /opt/etc/passwd
file they access /etc/passwd
file.
We call alternative installation Entware the case when /opt/etc/passwd
and /opt/etc/group
are real files (not symlinks). Entware binaries will use user names, group names, passwords from these files. They can be different from Asuswrt-merlin firmware. The original Asuswrt-merlin firmware has admin as a superuser, alternative installation Entware always has root as a superuser.
Important: Please remove Optware, Entware, Entware.arm if it is currently installed.
You cannot use both Optware and Entware at the same time. Entware cannot be used simultaneously with Optware.
Important: Asus's Download Master
is based on Optware, and therefore is NOT compatible with Entware. You will have to uninstall Download Master.
After uninstalling, you should make sure asusware.arm
or asusware.
directory on mounted disk partition is deleted. Otherwise, Entware won't work properly.
SSH to your router, change 192.168.1.1
with the IP address of your router
$ ssh [email protected]
Delete /tmp/opt
symlink
$ rm /tmp/opt
Delete start scripts
$ rm /jffs/scripts/services-start
$ rm /jffs/scripts/services-stop
$ rm /jffs/scripts/post-mount
Disable custom scripts and configs from /jffs
$ nvram set jffs2_scripts=0
$ nvram commit
Reboot router
$ reboot
Unmount and format the USB drive
$ df -h
$ umount -l /dev/sda1
$ mkfs.ext2 /dev/sda1
Reboot router
$ reboot
Important: Please check Linux kernel version of your router using uname -a
command. Linux kernel version should not be less than 3.2!
$ uname -a
Linux RT-AC86U-E5F0 4.1.27 #2 SMP PREEMPT Sun Jun 28 16:02:00 EDT 2020 aarch64 ASUSWRT-Merlin
The goal is to mount /opt
folder to some ext2|ext3|ext4 partition on a USB drive, which will be automatically mounted on every boot, so make sure to plug in a USB drive before installation.
In this example the target is a Asus RT-AC86U. The RT-AC86U contains a Broadcom BCM4906
SoC. It integrates two Cortex-A53
ARMv8-A cores that Broadcom has customized. Armv8-A has two execution states AArch32
and AArch64
. AArch32
provides backwards compatibility with ARMv7
.
This all means you can use ready made installation scripts for ARMv7
.
SSH to your router, change 192.168.1.1
with the IP address of your router
$ ssh [email protected]
Change directory to /tmp/share
$ cd /tmp/share
Download entware-setup.sh from the Asuswrt-merlin NG (New Generation) code branch
$ wget https://raw.githubusercontent.com/RMerl/asuswrt-merlin.ng/a46283c8cbf2cdd62d8bda231c7a79f5a2d3b889/release/src/router/others/entware-setup.sh
For standard installation (armv7,k3.2,std)
$ sed -i 's~https://bin.entware.net/armv7sf-k2.6/installer/generic.sh~https://bin.entware.net/armv7sf-k3.2/installer/generic.sh~g' /tmp/share/entware-setup.sh
For alternative installation (armv7,k3.2,alt)
$ sed -i 's~https://bin.entware.net/armv7sf-k2.6/installer/generic.sh~https://bin.entware.net/armv7sf-k3.2/installer/alternative.sh~g' /tmp/share/entware-setup.sh
Correct permissions for /tmp/share/entware-setup.sh
$ chmod +x /tmp/share/entware-setup.sh
Unmount and format the USB drive and afterward physically reconnect the USB drive
$ df -h
$ umount -l /dev/sda1
$ mkfs.ext2 /dev/sda1
Install Entware
$ /tmp/share/entware-setup.sh
admin@RT-AC86U-E5F0:/tmp/share# /tmp/share/entware-setup.sh
Info: This script will guide you through the Entware installation.
Info: Script modifies "entware" folder only on the chosen drive,
Info: no other data will be changed. Existing installation will be
Info: replaced with this one. Also some start scripts will be installed,
Info: the old ones will be saved on Entware partition with name
Info: like /tmp/mnt/sda1/jffs_scripts_backup.tgz
Info: This platform supports both 64bit and 32bit Entware installations.
Info: 64bit support is recommended, but 32bit support may be required
Info: if you are using other 32bit applications.
Info: The 64bit installation is also better optimized for newer kernels.
=> Do you wish to install the 64bit version? (y/n)
Choose 32bit version, in this case n
Info: Looking for available partitions...
[1] --> /tmp/mnt/sda1
=> Please enter partition number or 0 to exit
Choose a partition where Entware should be installed, in this case 1
[0-1]: 1
Info: /tmp/mnt/sda1 selected.
Output on a clean install should look like this
Info: Creating /tmp/mnt/sda1/entware folder...
Info: Creating /tmp/opt symlink...
Info: Creating /jffs scripts backup...
Info: Modifying start scripts...
Output on a successful install should look like this
Info: Congratulations!
Info: If there are no errors above then Entware was successfully initialized.
Info: Add /opt/bin & /opt/sbin to $PATH variable
Info: Add "/opt/etc/init.d/rc.unslung start" to startup script for Entware services to start
Info: Use ssh server from Entware for better compatibility.
Info: Found a Bug? Please report at https://github.com/Entware/Entware/issues
The script has created a new directory named entware
admin@RT-AC86U-E5F0:/tmp/share# cd /opt
admin@RT-AC86U-E5F0:/tmp/mnt/sda1/entware#
If this is an alternative installation Entware, it is recommended to install and setup SSH server from Entware and use it instead of the firmware supplied one. There are two SSH servers in Entware - Dropbear and OpenSSH. You can install either Dropbear or OpenSSH.
Important: The superuser root has password 12345
that can be changed after the first login and is independent from Asuswrt-merlin firmware.
Install Dropbear
$ opkg update
$ opkg install dropbear
You need to edit /opt/etc/config/dropbear.conf
configuration file and change the line PORT=22
to PORT=2222
to make Dropbear SSH port different from the system's one.
$ sed -i 's~PORT=22~PORT=2222~g' /opt/etc/config/dropbear.conf
Run Dropbear
$ /opt/etc/init.d/S51dropbear start
Check if Dropbear is currently running
$ /opt/etc/init.d/S51dropbear status
dropbear already running
SSH to your router, change 192.168.1.1
with the IP address of your router
$ ssh [email protected] -p 2222
If Dropbear disconnects immediately after successful auth, change root's shell and try again
Connection to 192.168.1.1 closed.
$ /opt/bin/sh
Segmentation fault
$ /bin/sh
$ sed -i 's~/opt/bin/sh~/bin/sh~g' /opt/etc/passwd
Notice that the PATH
variable now has /opt/bin
before /bin
$ echo $PATH
Entware (alternative installation) installs its own busybox copy
$ which busybox
/opt/bin/busybox
My USB needed to be formatted prior to install on PC as exFAT.
FAT gave the issue:
/dev/sda is apparently in use by the system; will not make a filesystem here!