Blog is moving

My blog is moving to http://victormendonca.com/blog/. If you are looking for a specific or older post you are in the right place Otherwise check out my new page for more up to date content.

Friday, October 18, 2013

How to install packages on Asus RT-AC66U with DD-WRT (opkg)

If you are having issues installing packages with the built-in ipkg, this post might help you. Please note that the links that I provide are hardware specific, so you need to find what your hardware is and then find the proper download path here - http://downloads.openwrt.org/attitude_adjustment/12.09/.

Before we start, let's make sure your USB is working. Make sure it's formatted with ext3.

=> 1- USB Setup

1a. Login to your router and go to Services => USB:


1b. Make sure that these options are enabled:
- Core USB Support
- USB Storage Support
- Automatic Drive Mount

1c. Connect to your router via ssh and plug in your USB; then run the command "df -h"

# df -h
 Filesystem                Size      Used Available Use% Mounted on
 rootfs                   16.0M     16.0M         0 100% /
 /dev/root                16.0M     16.0M         0 100% /
 none                    512.0K         0    512.0K   0% /dev
 /dev/sda1               464.9M     0    464.9M   0% /tmp/mnt/sda1

My USB drive shows as '/dev/sda1' mounted in '/tmp/mnt/sda1'

1d. Create a /opt and /jffs on your USB drive

# mkdir /tmp/mnt/sda1/opt /tmp/mnt/sda1/jffs

1e. Back to your router admin page, go to Administration => Commands. Add a startup command with the following code:

 ## Sets up USB mount
 CURRENT_MOUNT=$(df -h | grep sda | awk '{print $6}')
 umount $CURRENT_MOUNT
 mount /dev/sda1 /mnt
 mount -o bind /mnt/opt /opt
 mount -o bind /mnt/jffs /jffs

Note: the command above assumes you have only one USB device and it shows as /dev/sda*

1f. Reboot the router

reboot

1g. Logon via ssh again and check the mount points

 # df -h
 Filesystem                Size      Used Available Use% Mounted on
 rootfs                   16.0M     16.0M         0 100% /
 /dev/root                16.0M     16.0M         0 100% /
 none                    512.0K         0    512.0K   0% /dev
 /dev/sda1               464.9M     0    464.9M   0% /tmp/mnt
 /dev/sda1               464.9M     0    464.9M   0% /opt
 /dev/sda1               464.9M     0    464.9M   0% /jffs

=> 2- Install opkg

2a. First let's update the ipkg package list

ipkg update

2b. Now let's install opkg to '/jffs'

ipkg -d /jffs install http://downloads.openwrt.org/attitude_adjustment/12.09/brcm47xx/generic/packages/opkg_618-3_brcm47xx.ipk 

2c. Set 'dest root' in '/jffs/etc/opkg.conf' to use '/jffs'

# cat /jffs/etc/opkg.conf
src/gz attitude_adjustment http://downloads.openwrt.org/attitude_adjustment/12.09/brcm47xx/generic/packages
dest root /jffs
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay 

2d. Update opkg

opkg -f /jffs/etc/opkg.conf update

2e. Install libc (dependency)

opkg -f /jffs/etc/opkg.conf install http://downloads.openwrt.org/attitude_adjustment/12.09/brcm47xx/generic/packages/libc_0.9.33.2-1_brcm47xx.ipk

2f. Now you can install packages with

opkg -f /jffs/etc/opkg.conf install [package]

4 comments:

Anonymous said...

Hey very good Job ! but i have a tp-link WDR3600 V1.5 not Asus router, it's good for mount jffs on usb drive, with your script, but i not have jffs option in administration router for activate jffs and it's not the good link for install optware package on your article for WDR3600 tplink router have you ?

czarsath93 said...

Thank you very much! I got stuck with the DDWRT official Optware tutorial. But yours was very clear and helpful. Keep up the good work.

Anonymous said...

Finally a working tutorial for my router! DD-WRT Wiki it the worst wiki ever - it has too many information and half of that stuff is not working...
Thanks!

Anonymous said...

Finally a working tutorial for my router! DD-WRT Wiki it the worst wiki ever - it has too many information and half of that stuff is not working...
Thanks!