If the opkg configuration includes a repository with a huge package index, the command 'opkg clean' terminates with a segmentation fault and exit code 139. The command 'opkg clean -V4' prints the following line for each package in the index: pkg_vec_insert_merge: Adding new pkg=<name> <version> <arch> Is this amount of processing really necessary when cleaning the opkg cache directory? Notes: The command 'opkg info <package-name>' also terminates with segmentation fault. The command 'opkg install <package-name>' is not affected from this problem and runs without any errors. My system configuration: Machine model: Raspberry Pi Model B Plus Rev 1.2 Linux version 5.2.11 opkg version 0.4.1 My opkg configuration file: arch all 1 arch armhf 8 option no_install_recommends true option cache_dir /tmp/opkg-cache option lists_dir /tmp/opkg-lists dist stable http://archive.raspbian.org/raspbian main
I just posted a patch [1] to speed up clean. As you mentioned, it doesn't need to load the feeds or the status of the installed packages. Regarding the segfault, sounds to me like you are running your system out of memory. Install operations don't load all the metadata (there is a mask that makes sure only Description and Source are loaded), while info operations load ALL metadata. Could you confirm that you system is running out of memory? There are optimizations that could be made to opkg info, to avoid loading all metadata...but before looking into that I would like to see if this is indeed a low memory condition. [1] https://groups.google.com/forum/#!topic/opkg-devel/gKH7LiQWYSU
I was trying to reproduce the segmentation fault (on the same device and configuration) but now 'opkg clean' and 'opkg info <package-name>' always terminates with exit code 134 and the following error message: realloc(): invalid next size Aborted The amount of free system memory is constantly decreasing while the commands are running (in my case from 200 MB to about 140 MB), so it does not seem to be a low memory condition ...
interesting, the error points to a heap corruption issue. Support for debian style repos is less than ideal, so its likely a problem with that code. I'll try to reproduce with the configuration you provided.
Wasn't able to reproduce on my system. In fact, the update operation should throw you an error since you are configuring an "all" arch, but there is no all repo on the raspbian online feed: [adelcast@delcastillo3 libopkg]$ opkg -o /tmp/opkg update Downloading http://archive.raspbian.org/raspbian/dists/stable/Release. Downloaded release files for dist stable. Downloading http://archive.raspbian.org/raspbian/dists/stable/main/binary-all/Packages. Downloading http://archive.raspbian.org/raspbian/dists/stable/main/binary-armhf/Packages. Downloading http://archive.raspbian.org/raspbian/dists/stable/main/binary-armhf/Packages. Updated source 'stable-main-armhf'. Collected errors: * opkg_validate_cached_file: Failed to download http://archive.raspbian.org/raspbian/dists/stable/main/binary-all/Packages headers: HTTP response code said error. could you try to remove all your opkg temp files? (option c ache_dir /tmp/opkg-cache), as well as all your configured lists? do you still see the error? what if you comment out the "arch all" line? Also, I assume you are using upstream opkg from https://git.yoctoproject.org/cgit/cgit.cgi/opkg/?
I am using opkg from [1]. Although 'opkg update' throws an error for the all-arch, the command completes sucessfully (exit code 0). The 'arch all 1' statement in the configuration file is required to be able to install the architecture-independant packages. Nevertheless I tested it without 'arch all 1' but 'opkg info <package-name>' still fails (this time with the segmentation fault). Further testing: Config: arch armhf 8 dist stable http://archive.raspbian.org/raspbian main corrupted size vs. prev_size Aborted [1] http://downloads.yoctoproject.org/releases/opkg
I don't have a whole lot to go on since I can't reproduce the problem. Any chance you could provide me with a stack trace?
Created attachment 4648 [details] Stack Trace Sorry for my late response. Stack Trace attached. Please let me know if additional debug data is required ...
apologies for taking a while to get back to you. Looking at your callstack it seems like realloc is failing. Realloc is called during package index building, which point towards the index building operation potentially running the system out of memory. Could you run the opkg info operation with -V4 and attach the logs? I am hoping to get more information that way...
Created attachment 4705 [details] Stack Trace 1
Created attachment 4706 [details] Stack Trace 2
Created attachment 4707 [details] Stack Trace 3
Created attachment 4708 [details] Stack Trace 4
Created attachment 4709 [details] Stack Trace 5
Not sure if it helps but I noticed that the kind of failure (segmentation fault vs realloc failure) depends on the arch setting in the opkg configuration. Each of the attached files includes a opkg configuration followed by the stack trace output of the opkg info operation.
I just submitted a patch that address a memory corruption that I observed using the feeds on this ticket. Could you try it out to see if the error you are seeing goes away? https://groups.google.com/forum/#!topic/opkg-devel/sW1lLcjo7Dk
I believe commit fd33426c2805f119201a8851171665c0b32e25df fixed this issue. Please re-open if that was not the case.