DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-09-23 04:53:21

puterboy
Member
Registered: 2008-09-18
Posts: 306

"funpkg -r" NOT removing package files

I tried typing (as root): funpkg -r <package name>.

The only thing that seemed to get removed was the package file list in /ffp/var/packages.
I tested this on both 'bash' and 'cleanboot'

I would have thought that 'funpkg -r' would remove the actual files themselves too.

Am I doing something wrong or misunderstanding package removal?


Also, is there any way to get funpkg to run scripts or does it only essentially tar/untar archives?

I am using the latest version of funpkg in a clean install.

Offline

 

#2 2008-09-23 10:11:47

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

puterboy wrote:

The only thing that seemed to get removed was the package file list in /ffp/var/packages.

Code:

root@bob:~# ls /ffp/bin/bash
/ffp/bin/bash
root@bob:~# funpkg -r bash
Removing package bash-3.2-3 ...
Removing file /mnt/HD_a2/ffp/share/man/man1/bashbug.1
Removing file /mnt/HD_a2/ffp/share/man/man1/bash.1
Removing file /mnt/HD_a2/ffp/share/info/bash.info
Removing file /mnt/HD_a2/ffp/bin/bashbug
Removing file /mnt/HD_a2/ffp/bin/bash
root@bob:~# ls /ffp/bin/bash
ls: /ffp/bin/bash: No such file or directory
root@bob:~#

Works fine here.

Offline

 

#3 2008-09-24 09:42:44

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

Interesting because this is what I get:

root@raider:/# find /ffp/ -name "*bash*"
/ffp/var/packages/bash-3.2-3
/ffp/share/man/man1/bash.1
/ffp/share/man/man1/bashbug.1
/ffp/share/info/bash.info
/ffp/bin/bash
/ffp/bin/bashbug

root@raider:/# cat /ffp/var/packages/bash-3.2-3
./ffp/share
./ffp/share/man
./ffp/share/man/man1
./ffp/share/man/man1/bash.1
./ffp/share/man/man1/bashbug.1
./ffp/share/info
./ffp/share/info/bash.info
./ffp/share/info/dir
./ffp/bin
./ffp/bin/bash
./ffp/bin/bashbug

root@raider:/# funpkg -r bash
Removing package bash-3.2-3 ...

find /ffp/ -name "*bash*"
/ffp/share/man/man1/bash.1
/ffp/share/man/man1/bashbug.1
/ffp/share/info/bash.info
/ffp/bin/bash
/ffp/bin/bashbug

root@raider:/# cat /ffp/var/packages/bash-3.2-3
cat: can't open '/ffp/var/packages/bash-3.2-3': No such file or directory

So as you can see it is NOT working fine for me.
Not clear why though... I'm stumped...

Offline

 

#4 2008-09-24 09:50:20

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

OK. I have narrowed down the issue to a problem with the shell function 'uniq'.
It seems that the '/' is messing it up.

For example:
root@raider:/# find /ffp/ | uniq
/ffp/

root@raider:/# echo -e "hello\nworld" | uniq
hello
world

echo -e "/hello\n/world" | uniq
/hello


Also:
root@raider:/# which uniq
/ffp/bin/uniq


So why is uniq (seemingly) broken for me...

Offline

 

#5 2008-09-24 10:04:33

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

Actually, problem is more general - uniq seems to only be looking at the first letter in the line...
For example:
root@raider:/# echo -e "ab\nac" | uniq
ab

It is as if the default is uniq -w 1

In fact substituting "uniq -w 100" in funpkg fixes the problem.

So my issue is definitely with uniq....

Offline

 

#6 2008-09-24 10:11:51

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

puterboy wrote:

So why is uniq (seemingly) broken for me...

Hmm. Another busybox bug, it seems. I have coreutils installed which has the GNU version of uniq.

Offline

 

#7 2008-09-24 16:53:59

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

I'm surprised that such a basic Unix function would be broken. Can you verify that I am not doing something stupid?

Also, is there a more recent version of busybox available?

If not you may want to adjust the script (and any others in funplug) to use 'uniq -w <big number>' since the 'funpkg' is about as fundamental as you can get and not everybody has coreutils installed.
uniq is also used in several other shell scripts.

Alternatively, let me know what you suggest...

Offline

 

#8 2008-09-24 17:06:17

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

So far, I have tested several versions of busybox that I have installed on old Linux 386 boxes and they all work fine:
busybox-1.2.0
busybox-1.6.1

Offline

 

#9 2008-09-24 17:09:05

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

I don't think it's a busybox bug, but a problem with uclibc.

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv)
{
        printf("%d\n", strncmp("aa", "ab", -1));
        exit(0);
}

behaves differently on my glibc/i386 and uclibc/arm systems.

Offline

 

#10 2008-09-24 17:20:50

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

puterboy wrote:

I'm surprised that such a basic Unix function would be broken.

For now, I suggest to install coreutils until the problem is sorted out. Of course, uniq should work properly.

Offline

 

#11 2008-09-26 12:16:37

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

puterboy wrote:

Can you verify that I am not doing something stupid?

A new uclibc package is coming soon ( http://www.uclibc.org/lists/uclibc/2008 … 20134.html ).

Offline

 

#12 2008-10-01 18:02:39

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

I've uploaded a new uclibc package, and rebuilt fun_plug.tgz. The problem is hopefully fixed now.

Offline

 

#13 2008-10-02 05:50:47

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

This may be a dumb/obvious question but what is the best way to update an existing fun_plug installation.
Can I just type: funpkg -u fun_plug.tgz or do I need to start from scratch by placing fun_plug.tgz in /mnt/HD_a2, reboot and let the system reinstall the entire /ffp heirarchy?

Offline

 

#14 2008-10-02 09:50:12

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

puterboy wrote:

This may be a dumb/obvious question but what is the best way to update an existing fun_plug installation.
Can I just type: funpkg -u fun_plug.tgz or do I need to start from scratch by placing fun_plug.tgz in /mnt/HD_a2, reboot and let the system reinstall the entire /ffp heirarchy?

ffp is a collection of packages. You can install, upgrade and remove packages with funpkg. fun_plug.tgz is nothing more than files from a selected set of packages, so if you upgrade the packages, there's no need to get a new fun_plug.tgz (you cannot do funpkg -u fun_plug.tgz - it's not a funpkg archive).
Of course, you can also just drop a new fun_plug.tgz to Volume_1 and reboot. The fun_plug script will unpack the archive as usual and install new files.

Offline

 

#15 2008-10-02 12:21:16

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

fonz wrote:

puterboy wrote:

This may be a dumb/obvious question but what is the best way to update an existing fun_plug installation.
Can I just type: funpkg -u fun_plug.tgz or do I need to start from scratch by placing fun_plug.tgz in /mnt/HD_a2, reboot and let the system reinstall the entire /ffp heirarchy?

ffp is a collection of packages. You can install, upgrade and remove packages with funpkg. fun_plug.tgz is nothing more than files from a selected set of packages, so if you upgrade the packages, there's no need to get a new fun_plug.tgz (you cannot do funpkg -u fun_plug.tgz - it's not a funpkg archive).
Of course, you can also just drop a new fun_plug.tgz to Volume_1 and reboot. The fun_plug script will unpack the archive as usual and install new files.

I'm still a bit confused then...
In my /ffp/var/packages folder, I seem to have a package named fun_plug-0.5-08_08_31 (along with some other packages that were automagically installed and a couple that I installed myself). Also, fun_plug seems to be the package that contains the ulibc library since it is the only package that returned results when I grepped "grep -i uclibc.

So, I'm still left with the question of how do I upgrade uclibc (or more generally any of the files contained in /ffp/var/packages/fun_plug-0.5-08_08_31 other than having to "drop a new fun_plug.tgz to Volume_1 and reboot". I guess I'm confused about why fun_plug appears in /ffp/var/packages if it is not a funpkg archive as the other members of the directory seem to be.

Offline

 

#16 2008-10-02 12:32:13

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

puterboy wrote:

I'm still a bit confused then...
In my /ffp/var/packages folder, I seem to have a package named fun_plug-0.5-08_08_31 (along with some other packages that were automagically installed and a couple that I installed myself). Also, fun_plug seems to be the package that contains the ulibc library since it is the only package that returned results when I grepped "grep -i uclibc.

So, I'm still left with the question of how do I upgrade uclibc (or more generally any of the files contained in /ffp/var/packages/fun_plug-0.5-08_08_31 other than having to "drop a new fun_plug.tgz to Volume_1 and reboot". I guess I'm confused about why fun_plug appears in /ffp/var/packages if it is not a funpkg archive as the other members of the directory seem to be.

fun_plug-0.5-08_08_31 records the files included in fun_plug.tgz. It's there to a) record the version you've installed, and b) prevent essential files from being removed.

Imagine you want to compile a package. You most likely need system header files and therefore install the full uclibc package. After compilation you might want to cleanup and remove the uclibc package. If the essential libraries in the uclibc weren't also listed in the fun_plug-0.5-xxx package, they would now be removed, leaving your ffp unusable. That's why the fun_plug package 'keeps a reference' on these essential files. Still, the fun_plug entry doesn't represent a real package that you can download, install or upgrade.

fun_plug.tgz doesn't contain the whole uclibc package, which is why it's listed as fun_plug and not uclibc.

The way to upgrade uclibc is to install the uclibc package.

Offline

 

#17 2008-10-02 17:57:06

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

That makes sense...
But as a purist and a minimalist, how does one upgrade a reduced installation consisting of maybe just fun_plug and a few other choice packages?

I know how to upgrade the other packages that I have explicitly installed (or that were dragged in along with fun_plug) but it seems like you are saying that there is no simple, clean way of upgrading just fun_plug itself.

I know I must be sounding stupid here but am I missing something?

I am resisting reinstalling fun_plug.tgz at /mnt/HD_a2 because that would presumably overwrite any changes to my current installation and may even require reinstallation of the other packages I have installed along with redoing any config changes I have made since presumably fun_plug.tgz would overwrite subsequent changes.


Would a better/cleaner alternative for me be to write a script that does something like the following:
1. 'tar xvzf fun_plug.tgx var/packages'  in temp directory <newpackages>
2. Examine the contents of <temp>/var/packages
       A. For all PKG in <newpackages> != funpkg-<new version>
           If version number of PKG has changed and it is greater than the version in /ffp/var/packages, run subroutine analogous to upgradepkg()
           to effectively upgrade the package
                  i.e.  funpkg - r <PKG>
                        tar xvzf funpkg-<new version> --files-from <newpackages>/PKG
                        cp <newpackages>/PKG /ffp/var/packages
       B. For all FILE in <temp>/var/packages/funpkg-<new version>
              If FILE is referenced in another package in /ffp/var/packages, do nothing (since it will be updated with that package)
              Othewise, untar the file from <temp> to /ffp
      C. For all FILE in /var/packages/funpkg-<old version>
             If FILE is not listed in any of the packages in <temp>/var/packages or in any of the non fun-pkg packages in /ffp/var/packages,
                  then erase FILE from /ffp since it is no longer needed
      D. Update the entry in /var/run/packages to funpkg-<new version>
              i.e.    rm /ffp/var/packages/funpkg-<old version>
                       cp  <newpackages>/funpkg-<new version> /ffp/var/packages

In a sense, the above algorithm (if correct) would allow funpkg to be treated as an upgradeable archive.

Maybe I'm being a bit obsessive-compulsive here, but I like to keep my setups very clean and updateable smile

Offline

 

#18 2008-10-02 21:57:59

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

puterboy wrote:

Maybe I'm being a bit obsessive-compulsive here, but I like to keep my setups very clean and updateable smile

I don't split packages into shared libs, programs, static libs, header files, docs, etc. There's (usually) one funpkg per upstream package. While some will like this and feel at home, others might find this a little alien or even unacceptable.

I understand that you'd like an installation completely made up of packages that you can install, upgrade and remove. That's fine and actually simple to achieve. Install:

    uclibc
    e2fsprogs
    file
    libiconv
    ncurses
    sqlite

    expat
    gcc
    libusb
    libxml2
    openssl
    pcre
    readline
    tcp_wrappers
    zlib

Then, remove the /ffp/var/packages/fun_plug-0.5-zzz file. Remember that there are now several packages that you must not remove. gcc is one of them.

Offline

 

#19 2008-10-07 01:36:52

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

Thanks Fonz. I think that looks like a good path to follow (for me).
However, I still seem to be missing something.
None of the packages that you mention above are listed in /var/packages (presumably because they are part of fun_plug-0.5) but conversely the following packages were automagically installed when I installed fun_plug-0.5-zzzz:
           
less-418-3
rcorder-cvs-4
busybox-1.11.2-1
lighttpd-1.4.19-4
rsync-3.0.3-1
lsof-4.80-1
shadow-4.1.2.1-1
dialog-1.1-3
man-1.6e-3
strace-4.5.16-3
dns323-utils-0.7.176-2
mediatomb-0.11.0-5
ffp-scripts-0.5-17
nfs-utils-1.1.0-4
unfs3-0.9.20-4   
ntp-4.2.4p4-4           
usbutils-0.73-1
funpkg-0.5-1
openssh-5.1p1-1
groff-1.19.2-3
portmap-6.0-4

So,
1. Is it correct to say that fun_plug-0.5-zzz consists entirely of the union of the packages that you list in your posting and the packages that are explicitly added to /ffp/var/packages and listed above?
2. If so, what is the logic for explicitly listing some of the packages but not others?
   i.e. what is the difference between the packages that you list (and whose files appear in fun_plug-0.5-zzz vs. the packages that are explicitly listed in /ffp/var/packages?

Offline

 

#20 2008-10-07 10:42:36

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

puterboy wrote:

1. Is it correct to say that fun_plug-0.5-zzz consists entirely of the union of the packages that you list in your posting and the packages that are explicitly added to /ffp/var/packages and listed above?
2. If so, what is the logic for explicitly listing some of the packages but not others?
   i.e. what is the difference between the packages that you list (and whose files appear in fun_plug-0.5-zzz vs. the packages that are explicitly listed in /ffp/var/packages?

1. yes
2. all files from the packages listed in /ffp/var/packages are installed. programs and libraries are installed from the first block of packages above, only libraries from the second block. because they are not installed completely, they are not listed in /ffp/var/packages but make up the special fun_plug-0.5 package.

Offline

 

#21 2008-10-07 18:12:56

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

Interesting....
First, I apologize if I am annoying you, but I really am trying to understand the fun_plug system as best as possible.

I was just doing my own 'diffing' and it seems that there are libraries in the first block that are not included in fun_plug either. So while I'm sure using the individual packages you mention will work, it does not seem to give me an equivalent minimalist build that fun_plug does.

This leads me to the following suggestion:

Is there any reason not to also build a stripped down version of fun_plug-0.5 (say called something like fun_plug_base) that is in true package format and has ALL the files that belong to just the partial packages that are included in the fun_plug but not in the full packages that are included in fun_plug (Plus perhaps a single file manifest that lists all the full packages that are included in the normal fun_plug but excluded from this stripped down version)

Then it seems that one could always upgrade (or even install) by doing the following:
- Upgrading fun_plug_base
- Upgrading the individual full packages listed in the fun_plug_base manifest

Conversely the full fun_plug would then literally just be a single tar file that simply combines the contents of fun_plug_base and the individual packages listed in the the manifest.

To my engineering mind, this seems like a very simple, clean and understandable solution but maybe I am missing something....

Offline

 

#22 2008-10-07 22:02:15

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: "funpkg -r" NOT removing package files

puterboy wrote:

First, I apologize if I am annoying you, but I really am trying to understand the fun_plug system as best as possible.

Not at all. I appreciate your feedback. Few have looked that closely, yet.

puterboy wrote:

I was just doing my own 'diffing' and it seems that there are libraries in the first block that are not included in fun_plug either. So while I'm sure using the individual packages you mention will work, it does not seem to give me an equivalent minimalist build that fun_plug does.

Can you be more specific? What exactly have you found missing?

puterboy wrote:

that is in true package format

Yes. I've been thinking about this myself. Not sure what exactly held me back. These packages will still be special in that they duplicate content (and need to be refreshed whenever one of the 'parent' packages changes).

Offline

 

#23 2008-10-08 00:11:51

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

fonz wrote:

puterboy wrote:

2. If so, what is the logic for explicitly listing some of the packages but not others?
   i.e. what is the difference between the packages that you list (and whose files appear in fun_plug-0.5-zzz vs. the packages that are explicitly listed in /ffp/var/packages?

2. all files from the packages listed in /ffp/var/packages are installed. programs and libraries are installed from the first block of packages above, only libraries from the second block. because they are not installed completely, they are not listed in /ffp/var/packages but make up the special fun_plug-0.5 package.

I think maybe I misunderstood your use of "libraries" because when I do a diff of the files in your first block against fun_plug.tgz I get a whole slew of /ffp/lib files but I assume maybe that those are compile-time libraries while you were talking about run-time libraries.

Similarly, the second block has a whole slew off /ffp/lib and /ffp/libexec files.

If that is the basis of my misunderstanding then all is good.

Offline

 

#24 2008-10-08 00:23:08

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

puterboy wrote:

that is in true package format

fonz wrote:

Yes. I've been thinking about this myself. Not sure what exactly held me back. These packages will still be special in that they duplicate content (and need to be refreshed whenever one of the 'parent' packages changes).

Awesome. Sounds like a good idea and hopefully something very easy to accomplish with minimal work big_smile

In a future release, one could take this idea a step further by converting fun_plug.tgz into a "super" tar file consisting of the following
   fun_plug-base.tgz (consisting of all the partial package files)
   less-418-3.tgz
   rcorder-cvs-4.tgz
   ... and all the other complete packages that are included in the current fun_plug.tgz

Then the fun_plug script would just need a slight modification to do the extra untarring.

Alternatively, another approach would be to separate some of the packages into two parts -- one part consisting of run-time libraries and user executables and the other consisting of header files, compile-time libraries and executables only relevant to compilation (this is similar to what Fedora does where it often has a runtime package and a companion -lib package).
Then fun_plug.tgz would be a combination of the run-time packages and the other full packages. And users could install the compile time headers and libraries if they needed to compile their own stuff.

This standard approach would then more generally apply to all packages, not just the limited ones referenced in fun_plug and users would know that they only needed the run-time part if they wanted to just use the application but that they would need to also install the header file/lib part if they wanted to do their own compiling.

Does this make sense?

Offline

 

#25 2008-10-08 00:27:13

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: "funpkg -r" NOT removing package files

puterboy wrote:

In a future release, one could take this idea a step further by converting fun_plug.tgz into a "super" tar file consisting of the following
   fun_plug-base.tgz (consisting of all the partial package files)
   less-418-3.tgz
   rcorder-cvs-4.tgz
   ... and all the other complete packages that are included in the current fun_plug.tgz

Just to clarify, the logic of this approach is that fun_plug.tgz would then be a tar file consisting solely of true packages. The first step would then be to untar the wrapper and then install the individual packages (by untarring them).


puterboy wrote:

(this is similar to what Fedora does where it often has a runtime package and a companion -lib package).

Actually, I think Fedora labels them with a -devel suffix (not -lib). Sorry

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB