I'm trying to decrease a Linux image running SuSE, and thought about running
strip on all of the system's executables. Even though I may not re-gain much disk space this way, would there be any harm in doing so?
It's not the case for Linux (just checked...), but on other systems (such as BSDs, e.g., OSX) doing this will remove any setuid/setgid permissions as a side-effect. Also (still looking at OSX), the ownership of the file may change (to the user doing the writing).
For Linux, I recall that early on, stripping a shared library would prevent linking to it. That is not a problem now, though as the Program Library HOWTO notes, it will make debuggers not useful. It prevents linking to static libraries.
Most distributions, including OpenSUSE, strip executables as part of their build scripts. You don't need to strip on the system's executables because it's already been done.
There are binaries that must not be stripped. Package maintainers take care to use correct build options to avoid stripping them. This includes binaries that load libraries dynamically in unusual ways, doing some self-introspection rather than normal startup-time loading or a plain
dlopen. This also includes many executables that consist of bytecode plus a bytecode interpreter for which
strip mistakes the bytecode for debugging data.
A side note: if you want to save space, OpenSUSE is not the right distribution for you. OpenSUSE has very coarse package granularity. For a smaller system, use a distribution with finer package granularity so that you can install only the parts you need. In the desktop/server range, Debian and Arch are good choices. You may also consider distributions that target embedded systems such as WRT.
If you're running a distribution that installs binary packages from repositories (most distributions, including SUSE, do this), then any changes you make to executables will be overwritten the next time you update (or reinstall) the package that contains them.
Additionally, they'll be reported as having the wrong checksum and size (and date, if you didn't run
strip with the
--preserve-dates option) whenever you verify installed packages. You could make the
rpm match up with your changes by rebuilding the package from the installed files.
If you want to
strip binaries for installation, you may be better off building those packages from source and adjusting the compiler/linker flags. The package should be built using the distribution's own tools for that task (such as rpmbuild, dpkg-buildpackage, or makepkg). For people who need to do this kind of customization extensively, there are source-based distributions and even Linux From Scratch. However, building from source takes much longer, as well as using more disk space than you eventually save with the smaller binaries.