OpenWrt Forum Archive

Topic: ipkg: write error: No space left on device,/tmp full

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

KAMIKAZE (7.09) openwrt-brcm-2.4-squashfs.trx
http://wiki.openwrt.org/UsbStorageHowto

root@OpenWrt:~# ipkg install kmod-usb2 kmod-usb-uhci kmod-usb-storage kmod-fs-ext2

root@OpenWrt:/# mount /dev/discs/disc0/part1 /mnt
root@OpenWrt:/# mkdir /tmp/root
root@OpenWrt:/# mount -o bind /rom /tmp/root
root@OpenWrt:/# cp /tmp/root/* /mnt -a
root@OpenWrt:/# umount /tmp/root
root@OpenWrt:/# umount /mnt

root@OpenWrt:/# cat > /etc/init.d/pivotroot
#!/bin/sh

boot_dev="/dev/discs/disc0/part1"

for module in usbcore uhci scsi_mod sd_mod usb-storage ext2 ; do {
        insmod $module
}; done

sleep 4s

mount "$boot_dev" /mnt

[ -x /mnt/sbin/init ] && {
        mount -o move /proc /mnt/proc && pivot_root /mnt /mnt/mnt && {
                mount -o move /mnt/dev /dev
                mount -o move /mnt/tmp /tmp
                mount -o move /mnt/jffs /jffs 2>&-
                mount -o move /mnt/sys /sys 2>&-
        }
}
Ctrl+D

root@OpenWrt:/# chmod a+x /etc/init.d/pivotroot

root@OpenWrt:/# vi /etc/init.d/rcS
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
if test $2 == "boot" ; then
/etc/init.d/pivotroot
fi

{
        for i in /etc/rc.d/$1*; do
                $i $2 2>&1
        done
} | logger -s -p 6 -t '' &

root@OpenWrt:/# reboot

boot from the USB device Success



root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
none                     14.9M     32.0k     14.9M   0% /tmp
/dev/mtdblock/4           6.0M    756.0k      5.3M  12% /jffs
mini_fo:/jffs             1.2M      1.2M         0 100% /mnt
/dev/discs/disc0/part1     73.3G     35.7M     69.5G   0% /

root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /mnt/rom type squashfs (ro)
none on /dev type devfs (rw)
none on /proc type proc (rw)
none on /tmp type tmpfs (rw,nosuid,nodev)
none on /dev/pts type devpts (rw)
/dev/mtdblock/4 on /jffs type jffs2 (rw)
mini_fo:/jffs on /mnt type mini_fo (rw)
/dev/discs/disc0/part1 on / type ext2 (rw)
none on /proc/bus/usb type usbfs (rw)
root@OpenWrt:~# uname -a
Linux OpenWrt 2.4.34 #3 Sun Sep 30 20:33:21 CEST 2007 mips unknown

root@OpenWrt:~# cat /etc/ipkg.conf
src release http://downloads.openwrt.org/kamikaze/7.09/brcm-2.4/packages
src packages http://downloads.openwrt.org/kamikaze/packages/mipsel
dest root /
dest ram /tmp
src X-wrt http://downloads.x-wrt.org/xwrt/kamikaze/7.09/brcm-2.4/packages
src Optware http://ipkg.nslu2-linux.org/feeds/optware/openwrt-brcm24/cross/unstable
root@OpenWrt:~# dmesg
CPU revision is: 00029006
Primary instruction cache 16kB, physically tagged, 2-way, linesize 16 bytes.
Primary data cache 16kB, 2-way, linesize 16 bytes.
Linux version 2.4.34 (nbd@ds10) (gcc version 3.4.6 (OpenWrt-2.0)) #3 Sun Sep 30 20:33:21 CEST 2007
Setting the PFC to its default value
Determined physical RAM map:
 memory: 02000000 @ 00000000 (usable)
On node 0 totalpages: 8192
zone(0): 8192 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs,jffs2 init=/etc/preinit noinitrd console=ttyS0,115200
CPU: BCM4704 rev 9 at 264 MHz
Using 132.000 MHz high precision timer.
Calibrating delay loop... 262.96 BogoMIPS
Memory: 30432k/32768k available (1462k kernel code, 2336k reserved, 100k data, 80k init, 0k highmem)
Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
Checking for 'wait' instruction...  unavailable.
POSIX conformance testing by UNIFIX
PCI: Initializing host
PCI: Fixing up bus 0
PCI: Fixing up bridge
PCI: Setting latency timer of device 01:00.0 to 64
PCI: Fixing up bus 1
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
Registering mini_fo version $Id$
devfs: v1.12c (20020818) Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
squashfs: version 3.0 (2006/03/15) Phillip Lougher
pty: 256 Unix98 ptys configured
Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled
ttyS00 at 0xb8000300 (irq = 3) is a 16550A
ttyS01 at 0xb8000400 (irq = 3) is a 16550A
b44.c:v0.93 (Mar, 2004)
PCI: Setting latency timer of device 00:01.0 to 64
eth0: Broadcom 47xx 10/100BaseT Ethernet 00:1b:fc:81:70:04
PCI: Setting latency timer of device 00:02.0 to 64
eth1: Broadcom 47xx 10/100BaseT Ethernet 40:10:18:00:00:2d
Physically mapped flash: Found an alias at 0x800000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1000000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1800000 for the chip at 0x0
 Amd/Fujitsu Extended Query Table v1.3 at 0x0040
number of CFI chips: 1
cfi_cmdset_0002: Disabling fast programming due to code brokenness.
Flash device: 0x800000 at 0x1c000000
bootloader size: 262144
Physically mapped flash: Filesystem type: squashfs, size=0x121cc8
Creating 5 MTD partitions on "Physically mapped flash":
0x00000000-0x00040000 : "cfe"
0x00040000-0x007f0000 : "linux"
0x000be400-0x001f0000 : "rootfs"
mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only
0x007f0000-0x00800000 : "nvram"
0x001f0000-0x007f0000 : "rootfs_data"
sflash: found no supported devices
Initializing Cryptographic API
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP, IGMP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 2048 bind 4096)
ip_conntrack version 2.1 (5953 buckets, 5953 max) - 360 bytes per conntrack
ip_tables: (C) 2000-2002 Netfilter core team
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
NET4: Ethernet Bridge 008 for NET4.0
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFS: Mounted root (squashfs filesystem) readonly.
Mounted devfs on /dev
Freeing unused kernel memory: 80k freed
Algorithmics/MIPS FPU Emulator v1.5
diag: Detected 'ASUS WL-500g Premium'
b44: eth0: Link is up at 100 Mbps, full duplex.
b44: eth0: Flow control is off for TX and off for RX.
Probing device eth0: found!
mini_fo: using base directory: /
mini_fo: using storage directory: /jffs
usb.c: registered new driver usbdevfs
usb.c: registered new driver hub
uhci.c: USB Universal Host Controller Interface driver v1.1
PCI: Enabling device 01:03.0 (0000 -> 0001)
uhci.c: USB UHCI at I/O 0x100, IRQ 2
usb.c: new USB bus registered, assigned bus number 1
hub.c: USB hub found
hub.c: 2 ports detected
PCI: Enabling device 01:03.1 (0000 -> 0001)
uhci.c: USB UHCI at I/O 0x120, IRQ 2
usb.c: new USB bus registered, assigned bus number 2
hub.c: USB hub found
hub.c: 2 ports detected
SCSI subsystem driver Revision: 1.00
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
USB Mass Storage support registered.
hub.c: new USB device 01:03.0-1, assigned address 2
scsi0 : SCSI emulation for USB Mass Storage devices
  Vendor: ST380011  Model: A                 Rev:
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
Partition check:
 /dev/scsi/host0/bus0/target0/lun0: p1 p2
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 2
EXT2-fs warning (device sd(8,1)): ext2_read_super: mounting ext3 filesystem as ext2

EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
jffs2.bbc: SIZE compression mode activated.
b44: eth0: Link is up at 100 Mbps, full duplex.
b44: eth0: Flow control is off for TX and off for RX.
BFL_ENETADM not set in boardflags. Use force=1 to ignore.
device eth0.0 entered promiscuous mode
eth0.0: dev_set_promiscuity(master, 1)
device eth0 entered promiscuous mode
br-lan: port 1(eth0.0) entering learning state
br-lan: port 1(eth0.0) entering forwarding state
br-lan: topology change detected, propagating
CSLIP: code copyright 1989 Regents of the University of California
PPP generic driver version 2.4.2
PCI: Setting latency timer of device 01:02.0 to 64
PCI: Enabling device 01:02.0 (0004 -> 0006)
wl0: Broadcom BCM4318 802.11 Wireless Controller 4.80.53.0
__alloc_pages: 0-order allocation failed (gfp=0x1d2/0)
__alloc_pages: 0-order allocation failed (gfp=0x1d2/0)
__alloc_pages: 0-order allocation failed (gfp=0x1d2/0)
VM: killing process dropbear
root@OpenWrt:~#
root@OpenWrt:~# ipkg install svn
Installing svn (1.4.6-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/openwrt-brcm24/cross/unstable/svn_1.4.6-1_mipsel.ipk
Installing gettext (0.14.5-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/openwrt-brcm24/cross/unstable/gettext_0.14.5-2_mipsel.ipk

......
ipkg: write error: No space left on device

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
none                     14.9M     13.3M      1.6M  89% /tmp
/dev/mtdblock/4           6.0M    756.0k      5.3M  12% /jffs
mini_fo:/jffs             1.2M      1.2M         0 100% /mnt
/dev/discs/disc0/part1     73.3G     47.0M     69.5G   0% /

How mount /tmp to USB disk?
modify /etc/preinit ?
How solves?
My English is not good,please help me! SOS!

(Last edited by showboy on 4 Apr 2008, 06:42)

hmm... mount -o move /tmp /mnt/tmp ?

Davidkra wrote:

hmm... mount -o move /tmp /mnt/tmp ?

useless

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
none                     14.9M     36.0k     14.9M   0% /tmp
/dev/mtdblock/4           6.0M    756.0k      5.3M  12% /jffs
mini_fo:/jffs             1.2M      1.2M         0 100% /mnt
/dev/discs/disc0/part1     73.3G     47.0M     69.5G   0% /
root@OpenWrt:~# mount -o move  /tmp /mnt/tmp
root@OpenWrt:/mnt/tmp# pwd
/tmp
root@OpenWrt:~# cd /
root@OpenWrt:/# pwd
/
root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
none                     14.9M     36.0k     14.9M   0% /mnt/tmp
/dev/mtdblock/4           6.0M    756.0k      5.3M  12% /jffs
mini_fo:/jffs             1.2M      1.2M         0 100% /mnt
/dev/discs/disc0/part1     73.3G     47.0M     69.5G   0% /

(Last edited by showboy on 4 Apr 2008, 11:44)

A wild guess :

cp -r /tmp /tmp2
umount /tmp
cp -r /tmp2 /tmp
rm -rf  /tmp2
mkdir -p /mnt/usb
mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt/usb
mkdir /mnt/usb/tmp
echo dest usb /mnt/usb >> /etc/ipkg.conf
echo export TMPDIR=/mnt/usb/tmp >> /etc/profile
ipkg -d usb install svn
....

enjoy!!:lol:

(Last edited by talent881 on 3 May 2008, 04:03)

When you have root filesystem on usb you can do:

mkdir /tmphdd
chmod 1777 /tmphdd
cp -R /tmp/* /tmphdd
mount --bind /tmphdd /tmp

it works for me :-)

root@R-Net:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/scsi/host0/bus0/target0/lun0/part1
                          1.1M      1.1M         0 100% /mnt/rom
none                    239.2M     42.0M    185.1M  18% /tmp
/dev/mtdblock/4           6.1M      3.8M      2.3M  62% /jffs
mini_fo:/jffs             1.1M      1.1M         0 100% /mnt
/dev/discs/disc0/part1
                        239.2M     42.0M    185.1M  18% /
/dev/discs/disc0/part1
                        239.2M     42.0M    185.1M  18% /tmp
/dev/discs/disc0/part3
                        458.0G     93.0G    341.7G  21% /dysk

I haven't used "mount --bind" but I'm still worried about this approach. In the default configuration, /var is a symlink to /tmp, so there are several files there almost as soon as the system starts. You can copy them, but if any are open (in use by a running program), the program will write to the *old* file, not the new one.

On my system, that's dnsmasq ( /tmp/dhcp.leases ) and syslogd ( /tmp/log/messages because my /etc/init.d/boot runs "syslogd -m 720").  Be *very* careful about moving entire directories after the system is up and running!

my system writes to the new /tmp/dhcp.leases. I have uptime 2 days 54 min after I did that mount --bind and no problems. Maybe some will appear with time.

And even if the system will write to the old file (which still exists in ram), so what?

The discussion might have continued from here.