8.7. Creating Essential Symlinks

Some programs use hard-wired paths to files which do not exist yet. In order to satisfy these programs, create a number of symbolic links which will be replaced by real files throughout the course of the next chapter after the software has been installed.

ln -sv /tools/bin/{bash,cat,echo,grep,pwd,stty} /bin
ln -sv /tools/bin/file /usr/bin
ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
ln -sv /tools/lib/libstdc++.so{.6,} /usr/lib
sed -e 's/tools/usr/' /tools/lib/libstdc++.la > /usr/lib/libstdc++.la
ln -sv bash /bin/sh

The purpose of each link:


Many bash scripts specify /bin/bash.


This pathname is hard-coded into Glibc's configure script.


This is to satisfy one of the tests in Glibc's test suite, which expects /bin/echo.


This to avoid a hard-coded /tools reference in Libtool.


Some configure scripts, particularly Glibc's, have this pathname hard-coded.


This pathname is hard-coded into Expect, therefore it is needed for Binutils and GCC test suites to pass.


Binutils' configure scripts specify this command location.


Glibc needs this for the pthreads library to work.


This is needed by several tests in Glibc's test suite, as well as for C++ support in GMP.


This prevents a /tools reference that would otherwise be in /usr/lib/libstdc++.la after GCC is installed.


Many shell scripts hard-code /bin/sh.


This is where the kernel expects to find init.

Historically, Linux maintains a list of the mounted file systems in the file /etc/mtab. Modern kernels maintain this list internally and expose it to the user via the /proc filesystem. To satisfy utilities that expect the presence of /etc/mtab, create the following symbolic link:

ln -sv /proc/self/mounts /etc/mtab