DD-WRT Step 7 – Install Entware on the ext2/exFAT formatted flash drive you setup in Step 6 – Format USB Flash Drive with ext2. Setup automated reinstall at reboot and automated updater cron jobs.
Which router does this post cover?
This post will cover exclusively the one I have, but same principles apply for any other: Netgear® AC1900 – Nighthawk® Smart WiFi Router aka R7000:
AC1900 Features:
- AC1900 WiFi—600+1300 Mbps speeds
- 1GHz Dual Core Processor
- Dynamic QoS prioritizes network traffic for uninterrupted video streaming for applications like YouTube®, Netflix® & others
- ReadyCLOUD® USB Access allows you to enjoy personal and secure cloud access to USB storage anytime, anywhere
Pre-requisites
Step 1 – Basic Configuration
Step 2 – Wireless Configuration
Step 3 – Upgrade Firmware
Step 4 – Miscellaneous Settings
Step 5 – SSH Access DDwrt
Step 6 – Format USB Flash Drive with ext2/exFAT
Why Do You Need A Linux Format Flash Drive?
You need it to install Entware. Entware is a software repository for embedded devices like routers or network attached storages (NAS). 2000+ packages are available at moment of writing this article.
This repository will be used to install third party tools on your router via a packager called opkg. To do so, you are advised not to use the router’s internal flash drive but instead, use an external flash drive.
You don’t have to choose ext2 at all costs. Any Filesystem handled by DD-wrt will do, including NTFS! However if you want to keep your flash drive running for more than a year, you are advised to use ext2. exFAT is not a good alternative since it does not support symlinks or permissions.
Step 1. Make Sure /opt is Mounted
Follow Step 6 if needed. Log in to the router’s GUI, go to the USB page (Services > USB), make sure Core USB Support, USB Storage and Automatic Drive Mount are all enabled.
Flash drive requirements:
- 1 GB minimum
- UUID enabled (good quality flash drive)
- expendable: it will eventually die once you reach its maximum write cycle lifespan
- Volume label should be Optware so it auto-mounts
/opt
without specifying the UUID
Then, make sure there is a partition mounted as /opt
:
Step 2. Choose The Right Installer
In case of a doubt, choose the standard installer. The list of Entware-compatible Linux kernels is available here:
Architecture | Setup script | Setup script |
---|---|---|
aarch64 (kernel >= 3.10) | standard | alternative |
armv5 (kernel >= 3.2) | standard | alternative |
armv7 (kernel >= 3.2) | standard | alternative |
armv7 (kernel >= 2.6.36) | standard | alternative |
mips (kernel >= 3.4) | standard | alternative |
mipsel (kernel >= 3.4) | standard | alternative |
x64 (kernel >= 3.2) | standard | alternative |
Connect via SSH to your router or execute uname -a
from DDwrt UI in the Administration > Commands section:
The compatible installer for Netgear AC1900 R7000 is armv7 (kernel >=3.2):
/opt/etc/passwd
is a symlink to /etc/passwd
file. In alternative case it is a separate file that belongs to Entware. This rule also applies to group, shadow and some other files.Step 3. Install Entware
Make sure your rebooted your router after Step 6.
[ebstoggles class=”yourcustomclass”][ebstoggle title=”Option 1 – From SSH” class=”in”]Connect to your router via SSH with Putty or whatever terminal you like. Then execute these commands:cd /opt
wget http://bin.entware.net/armv7sf-k3.2/installer/generic.sh
chmod +x ./generic.sh
sh ./generic.sh
root@ddwrt:/opt# wget http://bin.entware.net/armv7sf-k3.2/installer/generic.sh[/ebstoggle][ebstoggle title=”Option 2 – From the web UI”] [/ebstoggle][/ebstoggles]
Connecting to bin.entware.net (104.27.176.50:80)
saving to 'generic.sh'
generic.sh 100% |***********************************************************************| 2205 0:00:00 ETA
'generic.sh' saved
root@ddwrt:/opt# chmod +x ./generic.sh
root@ddwrt:/opt# sh ./generic.sh
Info: Checking for prerequisites and creating folders...
Warning: Folder /opt exists!
Info: Opkg package manager deployment...
Connecting to bin.entware.net (104.27.177.50:80)
saving to '/opt/bin/opkg'
opkg 100% |***********************************************************************| 135k 0:00:00 ETA
'/opt/bin/opkg' saved
Connecting to bin.entware.net (104.27.176.50:80)
saving to '/opt/etc/opkg.conf'
opkg.conf 100% |***********************************************************************| 190 0:00:00 ETA
'/opt/etc/opkg.conf' saved
Connecting to bin.entware.net (104.27.177.50:80)
saving to '/opt/lib/ld-2.27.so'
ld-2.27.so 100% |***********************************************************************| 135k 0:00:00 ETA
'/opt/lib/ld-2.27.so' saved
Connecting to bin.entware.net (104.27.176.50:80)
saving to '/opt/lib/libc-2.27.so'
libc-2.27.so 100% |***********************************************************************| 1218k 0:00:00 ETA
'/opt/lib/libc-2.27.so' saved
Connecting to bin.entware.net (104.27.177.50:80)
saving to '/opt/lib/libgcc_s.so.1'
libgcc_s.so.1 100% |***********************************************************************| 50840 0:00:00 ETA
'/opt/lib/libgcc_s.so.1' saved
Connecting to bin.entware.net (104.27.176.50:80)
saving to '/opt/lib/libpthread-2.27.so'
libpthread-2.27.so 100% |***********************************************************************| 92648 0:00:00 ETA
'/opt/lib/libpthread-2.27.so' saved
Info: Basic packages installation...
Downloading http://bin.entware.net/armv7sf-k3.2/Packages.gz
Updated list of available packages in /opt/var/opkg-lists/entware
Installing entware-opt (227000-3) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/entware-opt_227000-3_all.ipk
Installing libgcc (8.3.0-9) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/libgcc_8.3.0-9_armv7-3.2.ipk
Installing libc (2.27-9) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/libc_2.27-9_armv7-3.2.ipk
Installing libssp (8.3.0-9) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/libssp_8.3.0-9_armv7-3.2.ipk
Installing libpthread (2.27-9) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/libpthread_2.27-9_armv7-3.2.ipk
Installing librt (2.27-9) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/librt_2.27-9_armv7-3.2.ipk
Installing libstdcpp (8.3.0-9) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/libstdcpp_8.3.0-9_armv7-3.2.ipk
Installing entware-release (1.0-2) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/entware-release_1.0-2_all.ipk
Installing zoneinfo-asia (2019c-1) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/zoneinfo-asia_2019c-1_armv7-3.2.ipk
Installing zoneinfo-europe (2019c-1) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/zoneinfo-europe_2019c-1_armv7-3.2.ipk
Installing findutils (4.7.0-1) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/findutils_4.7.0-1_armv7-3.2.ipk
Installing terminfo (6.2-1) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/terminfo_6.2-1_armv7-3.2.ipk
Installing libpcre (8.43-2) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/libpcre_8.43-2_armv7-3.2.ipk
Installing grep (3.4-1) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/grep_3.4-1_armv7-3.2.ipk
Installing locales (2.27-9) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/locales_2.27-9_armv7-3.2.ipk
Installing opkg (2019-06-14-dcbc142e-2) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/opkg_2019-06-14-dcbc142e-2_armv7-3.2.ipk
Installing entware-upgrade (1.0-1) to root...
Downloading http://bin.entware.net/armv7sf-k3.2/entware-upgrade_1.0-1_all.ipk
Configuring libgcc.
Configuring libc.
Configuring libssp.
Configuring libpthread.
Configuring librt.
Configuring terminfo.
Configuring libpcre.
Configuring grep.
Configuring locales.
Entware uses separate locale-archive file independent from main system
Creating locale archive /opt/usr/lib/locale/locale-archive
Adding en_EN.UTF-8
Adding ru_RU.UTF-8
You can download locale sources from http://bin.entware.net/other/i18n_glib227.tar.gz
You can add new locales to Entware using /opt/bin/localedef.new
Configuring entware-upgrade.
Upgrade operations are not required
Configuring opkg.
Configuring zoneinfo-europe.
Configuring zoneinfo-asia.
Configuring libstdcpp.
Configuring entware-release.
Configuring findutils.
Configuring entware-opt.
Info: Congratulations!
Info: If there are no errors above then Entware was successfully initialized.
Info: Add /opt/bin & /opt/sbin to your PATH variable
Info: Add '/opt/etc/init.d/rc.unslung start' to startup script for Entware services to start
Info: Found a Bug? Please report at https://github.com/Entware/Entware/issues
Step 4. Update System
Let’s update the repository and download updates to validate Entware is installed correctly!
opkg update opkg upgrade
Step 5. Setup Startup Scripts
We will now setup init.d by adding a call to an rc.unslung script at reboot. Under Administration > Commands insert this code and hit Save Startup:
sleep 10 /opt/etc/init.d/rc.unslung start
This script will scan the /opt/etc/init.d/ folder for anything.sh
which name starts with capital S*
This is where you want to place your startup scripts after you create your custom applications. Scripts sould be named S00-name.sh
with 00
being adjusted to prioritize order of each script.
In the future, if you crash your router at reboot or it becomes unresponsive because of some untested scripts you added in this folder, don’t panic! Unplug the USB flash drive and reboot. Then plug it back in and edit the faulty script! As simple as that!!
Wrapping up
You can now install any of the 2600+ packages available for Entware. To list packages available:
opkg list [name]
As of April 17th, 2020 there are 2619 packages available:
Default shell is sh
from busybox. Let’s try install bash!
opkg list bash opkg install bash
You router is now a complete Linux system, with package manager, repositories, and a recent kernel. You can do whatever you want with it!
Keep in mind that routers have limited RAM and some have a weak CPU, do not expect a $10 or $20 device to be able to handle torrenting (Transmission) for example.