Modify

Opened 10 years ago

Closed 9 years ago

#2702 closed defect (fixed)

r9548: ipkg fails with "ERROR: fork failed before execution: " or "fork failed: Cannot allocate memory"

Reported by: Tom Owned by: agb
Priority: high Milestone:
Component: packages Version:
Keywords: Cc:

Description

In current SVN on brcm47xx-2.6 I'm not able to install anything with ipkg.

[code]root@OpenWrt:~# ipkg install kmod-fs-nfs -V3
pkg_info_preinstall_check: updating arch priority for each package
pkg_info_preinstall_check: update file owner list
best installation candidate for kmod-fs-nfs

adding kmod-fs-nfs to providers

kmod-fs-nfs arch=mipsel arch_priority=10 version=2.6.23.1-brcm47xx-1

Found a valid candidate for the install: kmod-fs-nfs 2.6.23.1-brcm47xx-1

arch mipsel (priority 10) supported for pkg kmod-fs-nfs
Installing kmod-fs-nfs (2.6.23.1-brcm47xx-1) to root...
Downloading http://192.168.1.2/~tom/openwrt/./kmod-fs-nfs_2.6.23.1-brcm47xx-1_mipsel.ipk
xsystem: ERROR: fork failed before execution: `wget --passive-ftp -q -P /tmp/ipkg-Iz3rhb http://192.168.1.2/~tom/openwrt/./kmod-fs-nfs_2.6.23.1-brcm47xx-1_mipsel.ipk'
Configuring unpacked packages
Nothing to be done
An error ocurred, return value: 22.
Collected errors:
Failed to download kmod-fs-nfs. Perhaps you need to run 'ipkg update'?
hash_table[pkg-hash] n_buckets=0 n_elements=113 max_conflicts=0 n_conflicts=0
hash_table[file-hash] n_buckets=0 n_elements=437 max_conflicts=0 n_conflicts=0
hash_table[obs-file-hash] n_buckets=0 n_elements=0 max_conflicts=0 n_conflicts=0[/code]

Also manual download fails.
[code]root@OpenWrt:~# cd /tmp && wget http://192.168.1.2/~tom/openwrt/./kmod-fs-nfs_2.6.23.1-brcm47xx-1_mipsel.ipkConnecting to 192.168.1.2 (192.168.1.2:80)
kmod-fs-nfs_2.6.23.1 100% |*| 263k --:--:-- ETA
root@OpenWrt:/tmp# ipkg install kmod-fs-nfs_2.6.23.1-brcm47xx-1_mipsel.ipk -V3
pkg_info_preinstall_check: updating arch priority for each package
pkg_info_preinstall_check: update file owner list
best installation candidate for kmod-fs-nfs

adding kmod-fs-nfs to providers

kmod-fs-nfs arch=mipsel arch_priority=10 version=2.6.23.1-brcm47xx-1

Found a valid candidate for the install: kmod-fs-nfs 2.6.23.1-brcm47xx-1

arch mipsel (priority 10) supported for pkg kmod-fs-nfs
Installing kmod-fs-nfs (2.6.23.1-brcm47xx-1) to root...
ipkg: fork failed: Cannot allocate memory[/code]

Attachments (0)

Change History (20)

comment:1 Changed 10 years ago by Tom

Sorry for scrambled format before

Additionally, the output of free

root@OpenWrt:/tmp# free
              total         used         free       shared      buffers
  Mem:        13800         9788         4012            0          140
 Swap:            0            0            0
Total:        13800         9788         4012

comment:2 follow-up: Changed 10 years ago by JT

I had the same problem, fixed it by setting up a swap partition on a usb-stick.

comment:3 in reply to: ↑ 2 Changed 10 years ago by anonymous

Replying to JT:

I had the same problem, fixed it by setting up a swap partition on a usb-stick.

Check /ticket/2035.html -> still troubles when using swap!

comment:4 follow-up: Changed 10 years ago by florian

  • Resolution set to fixed
  • Status changed from new to closed

Fixed with [10036]

comment:5 in reply to: ↑ 4 Changed 10 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to florian:

Fixed with [10036]

Mmmh, I just saw this with, lets check,
"Updated to revision 10180"
compiled yesterday

root@OpenWrt:~# ipkg install parprouted
Installing parprouted (0.64-1) to root...
Downloading http://downloads.openwrt.org/kamikaze/packages/mipsel/./parprouted_0.64-1_mipsel.ipk
ipkg: fork failed: Cannot allocate memory

comment:6 Changed 10 years ago by Tom

o.O

$ svn info|grep Revision
Revision: 10203
root@OpenWrt:~# ipkg install hostapd-mini
Installing hostapd-mini (20071107_03ec0ec5cdb974d51a4a2a566bea4c4568138576-1) to root...
Downloading http://192.168.1.2/~tom/openwrt/./hostapd-mini_20071107_03ec0ec5cdb974d51a4a2a566bea4c4568138576-1_mipsel.ipk
xsystem: ERROR: fork failed before execution: `wget --passive-ftp      -q -P /tmp/ipkg-nqBgvR http://192.168.1.2/~tom/openwrt/./hostapd-mini_20071107_03ec0ec5cdb974d51a4a2a566bea4c4568138576-1_mipsel.ipk'
Nothing to be done
An error ocurred, return value: 22.
Collected errors:
Failed to download hostapd-mini. Perhaps you need to run 'ipkg update'?
root@OpenWrt:/tmp# ipkg install hostapd-mini_20071107_03ec0ec5cdb974d51a4a2a566bea4c4568138576-1_mipsel.ipk 
Installing hostapd-mini (20071107_03ec0ec5cdb974d51a4a2a566bea4c4568138576-1) to root...
ipkg: fork failed: Cannot allocate memory

Still unfixed, or b0rked again?

comment:7 follow-up: Changed 10 years ago by stephane

you need more ram
delete /tmp unnecessary files (ramdisk)
rmmod all unnecessary modules

then you can install your stuff for sure.

comment:8 Changed 10 years ago by bifferos

Freeing up space in /tmp is not always the answer to this problem.
The fork() failure does mean you ran out of memory, but I've just reproduced
this and I had 6 MB available, and /tmp on a USB stick.

I believe this happens when ipkg gets it's status files in a twist (which
doesn't seem too hard to do). I added my own repository to ipkg.conf, hosted
on /www/packages, and started getting this. Deleting a bunch of files
from /usr/lib/ipkg (can't remember which ones) and running 'ipkg update'
seemed to fix the problem.

I'm testing against r10464, incidentally.

comment:9 Changed 10 years ago by bmilde@…

Same problem here on 2.6 atheros. Revision is 10544 and I added also my own repository. fork() fails in ipgk no matter how much RAM I free (deleting files in tmp or shutting down services etc.)

After deleting /usr/lib/ipkg/status everything works. Only drawback is that the System then doesn't know which packages had been installed.

comment:10 in reply to: ↑ 7 Changed 10 years ago by Tom

Replying to stephane:

you need more ram
delete /tmp unnecessary files (ramdisk)
rmmod all unnecessary modules

then you can install your stuff for sure.

Not really.

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
none                      6.7M     40.0k      6.7M   1% /tmp
tmpfs                   512.0k         0    512.0k   0% /dev
/dev/mtdblock3          960.0k    244.0k    716.0k  25% /jffs
mini_fo:/jffs             2.0M      2.0M         0 100% /
192.168.1.2:/daten/upload/.openwrt
                        514.0G    444.8G     69.2G  87% /mnt

And still:

root@OpenWrt:~# ipkg install tinyproxy --test
Installing tinyproxy (1.6.3-1) to root...
Downloading http://192.168.1.2/~tom/openwrt/./tinyproxy_1.6.3-1_mipsel.ipk
xsystem: ERROR: fork failed before execution: `wget --passive-ftp      -q -P /tmp/ipkg-6qx5Cb http://192.168.1.2/~tom/openwrt/./tinyproxy_1.6.3-1_mipsel.ipk'
Nothing to be done
An error ocurred, return value: 22.
Collected errors:
Failed to download tinyproxy. Perhaps you need to run 'ipkg update'?

I also tried with -t /mnt/tmp - so the issue is not missing RAM or space.

bifferos, here it also affects my own repository on the apache in the local network.
So I tried as bmilde did:

root@OpenWrt:~# mv /usr/lib/ipkg/status /mnt/
root@OpenWrt:~# ipkg install tinyproxy            
Installing tinyproxy (1.6.3-1) to root...
Downloading http://192.168.1.2/~tom/openwrt/./tinyproxy_1.6.3-1_mipsel.ipk
Configuring tinyproxy
Done.

Very interesting.
What's the issue?

comment:11 Changed 10 years ago by claudio

Hi all,
I have similar experience with Kamikaze 7.09 on Atheros(fonera), same problem, very strange solution!

root@OpenWrt:~# ipkg install ntpclient
Installing ntpclient (2003_194-4) to root...
Downloading http://downloads.openwrt.org/kamikaze/packages/mips/./ntpclient_2003_194-4_mips.ipk
xsystem: ERROR: fork failed before execution: `wget --passive-ftp    -q -P /tmp/ipkg-JNvh3a http://downloads.openwrt.org/kamikaze/packages/mips/./ntpclient_2003_194-4_mips.ipk'
Nothing to be done
An error ocurred, return value: 22.
Collected errors:
Failed to download ntpclient. Perhaps you need to run 'ipkg update'?
root@OpenWrt:~# mv /usr/lib/ipkg/status /mnt/
root@OpenWrt:~# ipkg install ntpclient
Installing ntpclient (2003_194-4) to root...
Downloading http://downloads.openwrt.org/kamikaze/packages/mips/./ntpclient_2003_194-4_mips.ipk
Configuring ntpclient
Done.

comment:12 follow-up: Changed 10 years ago by bmilde

But this solution is not a real one - it's a very dirty fix. It would be cool to fix this. It's 100% reproduceable, I tested with another fonera. A firmware compiled a half year ago or so hadn't this issue.

comment:13 in reply to: ↑ 12 Changed 10 years ago by claudio <claudyus84 gmail com >

Replying to bmilde:

But this solution is not a real one - it's a very dirty fix. It would be cool to fix this. It's 100% reproduceable, I tested with another fonera. A firmware compiled a half year ago or so hadn't this issue.

Yes it's true, this is a bad workaround so today I investigate the problem a bit, my fonera is very heavily loaded

root@OpenWrt:~# free
              total         used         free       shared      buffers
  Mem:        13620        12868          752            0            0
 Swap:            0            0            0
Total:        13620        12868          752

and original ipkg status file is big!!

-rw-r--r--    1 root     root         4297 Mar 14 11:36 status

so the problem is clear... There no more space to load ipkg internal structure from ipkg status file and this bring ipkg to fail before dowloading package:

xsystem: ERROR: fork failed before execution ....

I think that only "clean" solution is to remove uneedded package (this reduce ipkg status dimension file), unload unneeded modules, stopping unneeded service, clear tmp, setting up swap etc etc...
I made a mistake?

comment:14 Changed 10 years ago by Tom

I wonder why this error does not occur on a 2.4 kernel. In current kamikaze release with kernel 2.4 it works fine. And it used to work on whiterussian too.
So the issue is not the need for more RAM. The file has 3.9K here, 4824K free mem. I mean...

comment:15 Changed 10 years ago by Tom

Some interesting approach:
let ipkg write to a tmp file instead of a pipe, and use vfork() instead of fork()
Seems that makes it depend on libpthread though.

Original site is offline, so here goes the google cache:
http://tinyurl.com/627b42

comment:16 Changed 10 years ago by anonymous

I've had success with NOT caring about the dependencies....

ipkg install -nodeps libpcap
ipkg install -nodeps tcpdump

(for example).

Of course you have to know the dependencies, but hey... at least it seems to work better.

comment:17 Changed 10 years ago by anonymous

I can confirm this, my status file is 5759 and free reports 4000, so I get this error.

comment:18 Changed 10 years ago by anonymous

Same problem here on a Fonera with Kamikaze r11305:

root@ap200:/tmp# ipkg install -nodeps -V99 screen_4.0.3-1_mips.ipk 
Debug install_cmd: screen_4.0.3-1_mips.ipk  
Package screen provided by hand (screen_4.0.3-1_mips.ipk).
Function: pkg_vec_insert_merge. Adding new pkg=screen version=4.0.3-1 arch=mips
pkg_info_preinstall_check: updating arch priority for each package
pkg_info_preinstall_check: update file owner list
 Getting old  from pkg_hash_fetch 
 Getting new  from pkg_hash_fetch 
best installation candidate for screen
 adding screen to providers
  screen arch=mips arch_priority=10 version=4.0.3-1  
 Found a valid candidate for the install: screen 4.0.3-1  
 New versions from pkg_hash_fetch 4.0.3-1 
 Versions from pkg_hash_fetch in ipkg_install_by_name  new 4.0.3-1  
Function: ipkg_install_by_name calling ipkg_install_pkg 
Function: ipkg_install_pkg calling pkg_arch_supported ipkg_install_pkg 
arch mips (priority 10) supported for pkg screen
Installing screen (4.0.3-1) to root...
ipkg: fork failed: Cannot allocate memory

I don't think that the error is caused by the file size of /usr/lib/ipkg/status. Remember that 'free' gives you kilo bytes whereas 'ls -l' rebots bytes.

root@ap200:/tmp# free
              total         used         free       shared      buffers
  Mem:        13700        10892         2808            0           56
 Swap:            0            0            0
Total:        13700        10892         2808

root@ap200:/tmp# df -h
Filesystem                Size      Used Available Use% Mounted on
tmpfs                     6.7M    192.0k      6.5M   3% /tmp
tmpfs                   512.0k         0    512.0k   0% /dev
/dev/mtdblock3            5.9M      1.1M      4.8M  18% /jffs
mini_fo:/jffs             1.0M      1.0M         0 100% /

root@ap200:/tmp# ls -lhR /usr/lib/ipkg/
/usr/lib/ipkg/:
drwxr-xr-x    2 root     root            0 Jan 11 02:27 info
drwxr-xr-x    2 root     root            0 Jan  1 00:09 lists
-rw-r--r--    1 root     root         3.6k Jan 11 02:27 status

/usr/lib/ipkg/info:
-rw-r--r--    1 root     root         1.4k May 31  2008 base-files-atheros.list
-rw-r--r--    1 root     root           35 May 31  2008 bridge.list
-rw-r--r--    1 root     root         1.7k May 31  2008 busybox.list
-rw-r--r--    1 root     root          106 May 31  2008 dnsmasq.list
-rw-r--r--    1 root     root          270 May 31  2008 dropbear.list
-rw-r--r--    1 root     root          353 Sep 30  2007 ethtool.control
-rw-r--r--    1 root     root           18 Jan  5 01:36 ethtool.list
-rw-r--r--    1 root     root           50 May 31  2008 hotplug2.list
-rw-r--r--    1 root     root          590 May 31  2008 iptables.list
-rw-r--r--    1 root     root            2 May 31  2008 kernel.list
-rw-r--r--    1 root     root          342 May 31  2008 kmod-ipt-nathelper.list
-rw-r--r--    1 root     root          683 May 31  2008 kmod-madwifi.list
-rw-r--r--    1 root     root          231 May 31  2008 kmod-ppp.list
-rw-r--r--    1 root     root          110 May 31  2008 kmod-pppoe.list
-rw-r--r--    1 root     root           27 May 31  2008 libgcc.list
-rw-r--r--    1 root     root          335 Sep 29  2007 libpcap.control
-rw-r--r--    1 root     root           50 Jan  3 02:52 libpcap.list
-rw-r--r--    1 root     root           42 May 31  2008 libuci.list
-rw-r--r--    1 root     root           19 May 31  2008 mtd.list
-rw-r--r--    1 root     root          332 Sep 30  2007 ntpclient.control
-rw-r--r--    1 root     root          162 Jan  1 00:20 ntpclient.list
-rw-r--r--    1 1000     1000           22 Jun 13  2008 olqm-client.conffiles
-rw-r--r--    1 1000     1000          227 Jun 13  2008 olqm-client.control
-rw-r--r--    1 root     root           98 Jan 11 02:27 olqm-client.list
-rw-r--r--    1 root     root          288 Sep 30  2007 olsrd-mod-httpinfo.control
-rw-r--r--    1 root     root           40 Jan  1 00:16 olsrd-mod-httpinfo.list
-rw-r--r--    1 root     root           16 Sep 30  2007 olsrd.conffiles
-rw-r--r--    1 root     root          277 Sep 30  2007 olsrd.control
-rw-r--r--    1 root     root           82 Jan  1 00:15 olsrd.list
-rw-r--r--    1 root     root          128 May 31  2008 ppp-mod-pppoe.list
-rw-r--r--    1 root     root          318 May 31  2008 ppp.list
-rw-r--r--    1 root     root          290 Sep 30  2007 tcpdump.control
-rw-r--r--    1 root     root           18 Jan  3 02:53 tcpdump.list
-rw-r--r--    1 root     root           57 May 31  2008 uci.list
-rw-r--r--    1 root     root          370 May 31  2008 uclibc.list
-rw-r--r--    1 root     root           27 May 31  2008 udevtrigger.list
-rw-r--r--    1 root     root          106 May 31  2008 wireless-tools.list

/usr/lib/ipkg/lists:

Very frustrating...

comment:19 Changed 10 years ago by agb

  • Owner changed from developers to agb
  • Status changed from reopened to new

The full ipkg and opkg have been committed to trunk. I can confirm that the full ipkg package resolves the problem and several people have been using the full ipkg for about two months now without issue. If you want something that "just works" use it..

If you feel adventurous try opkg, it is a fork of ipkg created by the OpenMoko project that provides multiple improvements, bug fixes, and is actively maintained. The more people we have testing it the better.

I will close this ticket once we make one of the two replacements the default package manager.

comment:20 Changed 9 years ago by agb

  • Resolution set to fixed
  • Status changed from new to closed

opkg made the default package manager with [12319], closing.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.