Skip to content

Instantly share code, notes, and snippets.

@dferg
Last active January 22, 2024 04:40
Show Gist options
  • Star 36 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save dferg/833aade513965d78b43d to your computer and use it in GitHub Desktop.
Save dferg/833aade513965d78b43d to your computer and use it in GitHub Desktop.
HOWTO: Install entware on Shibby TomatoUSB

Introduction

This howto describes installing entware for the Tomato open-source router firmware.

Requirements

  • USB stick - 1G or more in size
  • USB-capable router running TomatoUSB.

This Howto Was Tested With

  • Shibby's fork of TomatoUSB version 1.28 build 121
  • ASUS RT-N66U

Install entware

Pick a USB stick that you can dedicate to your router since it will be completely erased by the following process.

Configure the GUI for entware

In the web GUI, go to the "USB and NAS->USB Support" section and tick the following options:

[x] Core USB Support
[x] USB 2.0 Support
[x] USB Storage Support
[x] Ex2/Ext3 File Systems Support
[x] Automount

Paste this text into the "Run after mounting" box:

#!/bin/sh
/opt/etc/init.d/rc.unslung start

Paste this text into the "Run before unmounting" box:

#!/bin/sh
/opt/etc/init.d/rc.unslung stop
sleep 15
for i in `cat /proc/mounts | awk '/ext3/{print($1)}'` ; do
  mount -o remount,ro $i
done

Click the "Save" button and then check the "USB Status" at the bottom of the screen. If your USB stick is mounted, click "Unmount". In subsequent steps, we are going to format the USB stick, so we don't want it mounted.

Go to the "Administration->Scripts->Init" page. Paste the following into the "Init" script section:

echo "LABEL=ENTWARE /opt ext3 rw,noatime 1 1" >> /etc/fstab

Click the "Save" button.

For reference, most of the above is taking from the entware USB setup instructions.

Prepare the USB stick

Plug the USB stick in and ssh to the router. Remember, the next steps will completely erase the USB stick!

Find the device name for your USB stick

Run "fdisk -l" to display all the block devices and their partitions. Here is an example:

# fdisk -l

Disk /dev/sdb: 16.2 GB, 16231956480 bytes
64 heads, 32 sectors/track, 15480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sdb1               1       15480    15851504  83 Linux

You can see that the disk /dev/sdb is a 16GB block device. Since there are no other 16GB devices on my router, I can be pretty sure that the 16GB stick that I plugged in is mapped to /dev/sdb.

Partition the USB stick

Use fdisk to delete all the partitions on your USB disk. Then create a single partition spanning the entire drive and set its type to 83 (Linux). Write the partition table and exit fdisk.

Format the USB stick

Replace the /dev/sdb1 below with the path to your newly created partition.

mkfs.ext3 -L ENTWARE /dev/sdb1

Perform the entware install

mount /opt
entware-install.sh

Install useful packages (optional)

There are a number of useful, general purpose packages that you might want to install. ssh to the router and run the following (these on the list are just some examples):

opkg install bash
opkg install bind-dig
opkg install binutils
opkg install bzip2
opkg install coreutils-sha1sum
opkg install coreutils-sort
opkg install curl
opkg install diffutils
opkg install file
opkg install gawk
opkg install gdb
opkg install hdparm
opkg install less
opkg install lsof
opkg install objdump
opkg install patch
opkg install perl
opkg install procps
opkg install procps-top
opkg install rsync
opkg install sed
opkg install strace
opkg install tar
opkg install tcpdump
opkg install vim
opkg install vim-runtime
opkg install wget
opkg install unzip

Verify the installation

Reboot the router by clicking the "Reboot..." option in the web GUI. Once it restarts, ssh to the router and run "opkg list". You should get a list of possible packages that you can install. If you don't, something went wrong. Make sure that /opt is mounted (use the df command).

References

@remlei
Copy link

remlei commented Dec 17, 2014

you also need to perform

opkg upgrade
opkg update

to be able to install new packages on newly installed entware environment.

@Echani
Copy link

Echani commented Sep 28, 2015

for some reason I'm getting a 401 on the googlecode.com wget at first, and a 403 on the second one.

Is this not a public repo?

@ryzhovau
Copy link

ryzhovau commented Nov 8, 2015

Great How-To. I borrowed it to use here if you don't mind.

@alexey-krylov
Copy link

Here is entware installation script:
wget -O - http://pkg.entware.net/binaries/armv7/installer/entware_install.sh | sh

@0E800
Copy link

0E800 commented Mar 13, 2019

opkg install bash bind-dig binutils bzip2 coreutils-sha1sum coreutils-sort curl diffutils file gawk gdb hdparm less lsof objdump patch perl rsync sed strace tar tcpdump vim vim-runtime wget unzip

One long sting to copy and paste, save the repetition and mouse clicks.

procps and procps-top not avail.

@kmplsv
Copy link

kmplsv commented May 19, 2020

opkg install bash bind-dig binutils bzip2 coreutils-sha1sum coreutils-sort curl diffutils file gawk gdb hdparm less lsof objdump patch perl rsync sed strace tar tcpdump vim vim-runtime wget unzip

cheers for typing that out for me mate!

@twocoolbeans
Copy link

Has anyone tried/is it possible to install Entware on a partition instead of using an entire USB device?

@TheJeremyP
Copy link

Has anyone tried/is it possible to install Entware on a partition instead of using an entire USB device?

I'm not sure about what exactly you're asking so 2 answers.

Yes, you can install on a partition of a USB drive instead of using the entire drive. My current setup has an Entware partition and a Data partition.

If you're asking whether you can run it without a USB device at all, I've done it with Optware in the past. File on a network share mounted as a loop device. This requires a loop kernel module which doesn't seem to be included with the FreshTomato build I'm using or in the extras.tar.gz.

@dougK44883
Copy link

Why is it necessary to enable [x] Automount ? if you're mounting via fstab? I understand why it's likely a user may want it - but for installing entware following this, what's it's purpose?

I've installed entware on one parition, swap on another and a third for "data/storage" all on the same USB flash drive. Depending upon your installation size and your routers ram/memory size it may be possible to install in /jffs (there are mixed views on this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment