Professional Web Applications Themes

Save stripping of a running system? - Linux Setup, Configuration & Administration

Is there a save way of stripping binaries (with --strip-unneeded) and libraries (with --strip-debug) while the system is running? As I install programs by compiling them by myself and most of them contain debugging information, I'd like to strip them without booting a second system. Ingo...

  1. #1

    Default Save stripping of a running system?

    Is there a save way of stripping binaries (with --strip-unneeded) and
    libraries (with --strip-debug) while the system is running? As I install
    programs by compiling them by myself and most of them contain debugging
    information, I'd like to strip them without booting a second system.

    Ingo
    Ingo Guest

  2. #2

    Default Re: Save stripping of a running system?

    de (Ingo Brueckl) writes:
     

    There should be no problems. Just run "strip" on whatever files you
    want stripped.

    --
    Måns Rullgård
    sf.net
    Måns Guest

  3. #3

    Default Re: Save stripping of a running system?

    Ingo Brueckl wrote:
     

    .... have you tried against a test set? (IOW, just try it)
    ..
    --
    /// Michael J. Tobler: motorcyclist, surfer, skydiver, \\\
    \\\ and author: "Inside Linux", "C++ HowTo", "C++ Unleashed" ///
    \\\ http://pages.sbcglobal.net/mtobler/mjt_linux_page.html ///
    Statisticians probably do it.

    mjt Guest

  4. #4

    Default Re: Save stripping of a running system?

    Måns Rullgård wrote:
     
    >
    >
    > There should be no problems. Just run "strip" on whatever files you
    > want stripped.[/ref]

    Except the kernel! Don't strip that!

    Nico Guest

  5. #5

    Default Re: Save stripping of a running system?

    Nico Kadel-Garcia <net> writes:
     
    >> There should be no problems. Just run "strip" on whatever files you
    >> want stripped.[/ref]
    >
    > Except the kernel! Don't strip that![/ref]

    The kernel is already stripped.

    --
    Måns Rullgård
    sf.net
    Måns Guest

  6. #6

    Default Save stripping of a running system?

    sourceforge.net (Mans Rullgard) writes:
     

    I certainly will destroy my system when stripping binaries and libraries
    currently in use!

    Ingo
    Ingo Guest

  7. #7

    Default Re: Save stripping of a running system?

    de (Ingo Brueckl) writes:
     
    >
    > I certainly will destroy my system when stripping binaries and libraries
    > currently in use![/ref]

    It shouldn't. strip will first write a new file, then rename() the
    file to replace to old one. If some process has the old file open, it
    will continue to access it. When no more processes have the file
    open, it will be deleted.

    --
    Måns Rullgård
    sf.net
    Måns Guest

  8. #8

    Default Re: Save stripping of a running system?

    In comp.os.linux.misc Ingo Brueckl <de> wrote: 
     [/ref]
     

    Eh? No you won't. Why do you think so? The symbol tables stripped by
    "strip" are not required except for debugging.

    Peter
    Peter Guest

  9. #9

    Default Save stripping of a running system?

    sourceforge.net (Mans Rullgard) writes:
     [/ref]
     

    If I strip my running system, I get an error message at shutdown time saying
    that umount / isn't possible because it's busy. At next boot, filesystem
    check finds lots of errors, complains that it found a serious error, kicking
    my system into single user administration mode.

    What I did in /bin, /usr/bin, /sbin, /usr/sbin, /usr/X11R6/bin is:

    find /bin -type f -exec strip --strip-unneeded -p '{}' ';' 2>&1 |
    grep -v "File format not recognized"

    and

    find /lib -type f -exec strip --strip-debug -p '{}' ';' 2>&1 |
    grep -v "File format not recognized"

    in /lib, /usr/lib and /usr/X11R6/lib by a bash script.

    Ingo
    Ingo Guest

  10. #10

    Default Re: Save stripping of a running system?

    de (Ingo Brueckl) writes:
     [/ref]

    >
    > If I strip my running system, I get an error message at shutdown time saying
    > that umount / isn't possible because it's busy. At next boot, filesystem[/ref]

    In that case your shutdown script is broken. By the time it reaches
    the umount, there should be no processes left that could be using the
    old files. init is statically linked, and any process started after
    the stripping (such as the shutdown script) will be using the stripped
    files.
     

    That's odd. All you should have is a few orphaned inodes. Taking
    care of those is straight-forward for fsck.

    --
    Måns Rullgård
    sf.net
    Måns Guest

  11. #11

    Default Re: Save stripping of a running system?

    In comp.os.linux.misc Ingo Brueckl <de> wrote: 

    sync your system first, next time. There is nothing mysterious.
    What you do on disk hits disk, and the o/s be damned. It's the kernels
    business to send your changes to disk!
     
     

    Well, I'd just use "strip", but that's fine.
     

    Whatever either of these commands do, your FS coherency will be
    unaffected by it. Even if something went wrong, you would get a
    partial file write, not an incoherent file system!
     

    Fine. What FS is it? (I'd be using a statically linked bash and strip
    to do this, by the way!).

    Peter
    Peter Guest

  12. #12

    Default Save stripping of a running system?

    Thanks for your help, I figured out what the problem was.

    sourceforge.net (Mans Rullgard) writes:
     

    But it is: /sbin/init, because 'strip' always creates a new copy whether
    there is something to strip or not. So I'll get a "zero dtime" error at next
    boot time for the old copy of /sbin/init which could not be released, because
    at release time the filesystem is already unmounted. (And this is the "can't
    umount /: device busy" error I see while shutdown is performed.)
     

    Mine (sysvinit-2.85) isn't. Don't know why, but the -static flag has gone
    from the Makefile. So I got more "zero dtime" errors, because some libraries
    were in use, too. (I'll recompile it statically.)
     

    And this was what I saw at boot time. Unfortunately, the actual version of
    fsck (e2fsprogs-1.34) returns an error code > 1 after finding "zero dtime".
    Thus, the system goes into single user administration mode which was totally
    new for me, because previous versions of fsck did show errors like these, but
    obviously returned an error code <= 1. In case of "zero dtime" the system
    used to boot normally. I though that the error from fsck together with the
    single user administration mode meant that the filesystem was seriously
    damaged, but probably it wasn't.

    I've written a script now, which checks with 'file' first whether there is
    something to strip, leaves /sbin/init untouched and (as "Peter T. Breuer"
    <it.uc3m.es> suggested) syncs after I'm done.

    Ingo
    Ingo Guest

Similar Threads

  1. What is running on this system?
    By beef in forum Ubuntu
    Replies: 2
    Last Post: June 4th, 10:17 PM
  2. Replies: 5
    Last Post: September 16th, 07:33 PM
  3. Running system commands
    By Nitin in forum PHP Development
    Replies: 3
    Last Post: September 24th, 11:56 AM
  4. Crystal reports not running on system with .net framework
    By SivaKumar in forum ASP.NET General
    Replies: 2
    Last Post: August 18th, 05:03 AM
  5. How to: Network XP system to system running 2000?
    By Trish in forum Windows Networking
    Replies: 0
    Last Post: July 2nd, 01:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139