OpenWrt Forum Archive

Topic: How to make use of /tmp space for packages?

The content of this topic has been archived on 15 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hey folks,

Been using OpenWRT successfully for about a year now and love it. Recently I've wanted to be able to use typical Linux apps like dig, host, etc from the router itself like any other Linux terminal. However whenever I try to install the respective utility, in this case bind-dig, it fails due to lack of space for related dependencies.

My question really is - how do I make use of what seems to be almost 7Mb of unused space in /tmp for installing packages? I did try adding the following to opkg.conf:

dest test /tmp/pkgs

in order to try to force the package install to /tmp but still the same error:

root@OpenWrt:~# cat /etc/opkg.conf
src/gz snapshots http://downloads.openwrt.org/kamikaze/8 … 4/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /jffs
src X-Wrt http://downloads.x-wrt.org/xwrt/kamikaz … 4/packages
root@OpenWrt:~# echo dest test /tmp/pkgs/ >> /etc/opkg.conf
root@OpenWrt:~#
root@OpenWrt:~# cat /etc/opkg.conf
src/gz snapshots http://downloads.openwrt.org/kamikaze/8 … 4/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /jffs
src X-Wrt http://downloads.x-wrt.org/xwrt/kamikaz … 4/packages
dest test /tmp/pkgs/
root@OpenWrt:~#
root@OpenWrt:~# opkg update
Downloading http://downloads.openwrt.org/kamikaze/8 … ackages.gz
Connecting to downloads.openwrt.org (78.24.191.177:80)
Packages.gz          100% |*******************************|   130k 00:00:00 ETA
Inflating http://downloads.openwrt.org/kamikaze/8 … ackages.gz
Updated list of available packages in /var/opkg-lists/snapshots
Downloading http://downloads.x-wrt.org/xwrt/kamikaz … s/Packages
Connecting to downloads.x-wrt.org (88.198.39.176:80)
Packages             100% |*******************************| 64346  --:--:-- ETA
Updated list of available packages in /var/opkg-lists/X-Wrt
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~# opkg -dest test install bind-dig
Installing bind-dig (9.5.0-P1-1.1) to test...
Downloading http://downloads.openwrt.org/kamikaze/8 … mipsel.ipk
Connecting to downloads.openwrt.org (78.24.191.177:80)
bind-dig_9.5.0-P1-1. 100% |*******************************| 32240  --:--:-- ETA
Installing bind-libs (9.5.0-P1-1.1) to test...
Collected errors:
* Only have 1100 available blocks on filesystem /tmp/pkgs/, pkg bind-libs needs 1883
root@OpenWrt:~#


I have some Linux experience but am well aware that this could come back to my lack of understanding of mount points, filesystems, etc sad

Any help would be really appreciated cause it's doing my head in wink

Some background:

root@OpenWrt:~# uname -a
Linux OpenWrt 2.4.35.4 #12 Mon Jun 1 21:52:49 UTC 2009 mips unknown

on WRT54GL v1.1

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    1.6M      1.6M         0 100% /
/dev/root                 1.6M      1.6M         0 100% /rom
tmpfs                     7.0M    788.0k      6.2M  11% /tmp
/dev/mtdblock/4           1.7M    628.0k      1.1M  36% /jffs
mini_fo:/jffs             1.6M      1.6M         0 100% /

(Last edited by dosser on 11 Nov 2009, 13:59)

dosser wrote:

My question really is - how do I make use of what seems to be almost 7Mb of unused space in /tmp for installing packages?

AFAIK, /tmp is volatile RAM space. In other words, everything stored on /tmp directory will vanish when the device is power cycle. So, it makes no sense trying to install a package on /tmp

I looks like the /jffs partition on your device only has about 1.1M space left that can be used to hold writable files + additional packages.

many thanks for the pointer, and yes - I agree re the /tmp being a ramdisk as I found this pointed out somewhere too.

I tried using /jffs but same issue sad

root@OpenWrt:/jffs# cat /etc/opkg.conf
src/gz snapshots http://downloads.openwrt.org/kamikaze/8 … 4/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /jffs
src X-Wrt http://downloads.x-wrt.org/xwrt/kamikaz … 4/packages
dest test /tmp/pkgs/
dest pkgs /jffs/pkgs/
root@OpenWrt:/jffs#
root@OpenWrt:/jffs# opkg -dest pkgs install bind-dig
Installing bind-dig (9.5.0-P1-1.1) to pkgs...
Downloading http://downloads.openwrt.org/kamikaze/8 … mipsel.ipk
Connecting to downloads.openwrt.org (78.24.191.177:80)
bind-dig_9.5.0-P1-1. 100% |******************************************************************| 32240  --:--:-- ETA
Installing bind-libs (9.5.0-P1-1.1) to pkgs...
Collected errors:
* Only have 1100 available blocks on filesystem /jffs/pkgs/, pkg bind-libs needs 1883
root@OpenWrt:/jffs#

so it seems that I'm stuck with what I've got as determined by available flash space on the 54GL...

Remember, your /jffs partition only had 1.1MB space left. If you tried to install a package of size near to 1MB in size, chances are it won't get installed unless the *.ipkg in not in compressed mode.

Off topic. Your router seemed to have very small amount of Flash space. Why hack it to add an SD card. I have my Netgear WGT634U boots off of an external USB memory stick with a 25MB swapped space (see below).

BusyBox v1.14.4 (2009-11-08 15:30:32 EST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (bleeding edge, r18352) ------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@WGT634U:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1920      1920         0 100% /usb/sda1/rom
tmpfs                    14536        72     14464   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/mtdblock3            4480       396      4084   9% /jffs
mini_fo:/jffs             1920      1920         0 100% /usb/sda1
/dev/sda1               463444     19334    420182   4% /

thanks for your reply, yeah - adding the SD card was something I was looking at, however for the functionality I require it may not justify the effort required.

Essentially I wanted to make sure that there wasn't something / some trick that I was missing to allow me to add more packages to the router to make it more usable for what I want.

Seems like there's no secret wink

Cheers for the dig out, I'll have a think about the SD stuff, think I've seen some guides elsewhere on the wiki on how to do that procedure...

It is a fairly easy process to add an SD card, and its quite rewarding smile

BusyBox v1.11.2 (2009-09-06 23:21:43 UTC) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (8.09.2-RC2, r17574) -------------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                  725.6M     30.9M    657.8M   4% /
/dev/root                 1.6M      1.6M         0 100% /rom
tmpfs                     7.0M     52.0k      7.0M   1% /tmp
/dev/mtdblock/4           1.7M      1.3M    412.0k  76% /jffs
mini_fo:/jffs             1.6M      1.6M         0 100% /mnt
/dev/mmc/disc0/part1    725.6M     30.9M    657.8M   4% /
mini_fo:/jffs             1.6M      1.6M         0 100% /etc
root@OpenWrt:~# free
              total         used         free       shared      buffers
  Mem:        14344        14012          332            0         1480
 Swap:       251188            0       251188
Total:       265532        14012       251520

For the records - if you know you have enough space:
you have to change the line
option overlay_root /jffs
to
option overlay_root /

as opkg has a bug to check the free space independent of the destination

or you can specify the opkg parameter to
--force-space           Disable free space checks

(Last edited by xnagyg on 18 Sep 2014, 14:46)

In all seriousness, how can we have opkg install to /tmp. lets say i wanted to install nano or iftop temporarily.

Why not trying to set the overlay to the ram disk?

I downloaded nano, and unpacked it:

root@OpenWrt:/tmp# opkg update
Downloading http://downloads.openwrt.org/barrier_breaker/14.07-rc2/brcm47xx/legacy/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker.
root@OpenWrt:/tmp# opkg download nano
Downloading http://downloads.openwrt.org/barrier_breaker/14.07-rc2/brcm47xx/legacy/packages/nano_2.3.6-1_brcm47xx.ipk.
Downloaded nano as ./nano_2.3.6-1_brcm47xx.ipk.
root@OpenWrt:/tmp# mkdir nanotmp
root@OpenWrt:/tmp# cd nanotmp/
root@OpenWrt:/tmp/nanotmp# tar -xzf ../nano_2.3.6-1_brcm47xx.ipk 
root@OpenWrt:/tmp/nanotmp# ls -l
-rw-r--r--    1 1000     1000           373 Jul 27 13:34 control.tar.gz
-rw-r--r--    1 1000     1000         28157 Jul 27 13:34 data.tar.gz
-rw-r--r--    1 1000     1000             4 Jul 27 13:34 debian-binary
root@OpenWrt:/tmp/nanotmp# tar -xzf data.tar.gz 
root@OpenWrt:/tmp/nanotmp# ls
control.tar.gz  data.tar.gz     debian-binary   usr
root@OpenWrt:/tmp/nanotmp# cd usr/
root@OpenWrt:/tmp/nanotmp/usr# ls
bin
root@OpenWrt:/tmp/nanotmp/usr# cd bin/
root@OpenWrt:/tmp/nanotmp/usr/bin# ls
nano
root@OpenWrt:/tmp/nanotmp/usr/bin# ./nano 
./nano: can't load library 'libncurses.so.5'

So that works... but I also need to install libncurses (which I dont want to). But if I did the same with libncurses I would probably just need to symlink the so-file somewhere in tmp to /usr/lib.

The discussion might have continued from here.