7.14. 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,login,pwd,stty} ${CLFS}/bin
ln -sv /tools/bin/file ${CLFS}/usr/bin
ln -sv /tools/lib/libgcc_s.so{,.1} ${CLFS}/usr/lib
ln -sv /tools/lib/libstdc++.so{.6,} ${CLFS}/usr/lib
sed -e 's/tools/usr/' /tools/lib/libstdc++.la > ${CLFS}/usr/lib/libstdc++.la
ln -sv bash ${CLFS}/bin/sh
ln -sv /tools/sbin/init ${CLFS}/sbin
ln -sv /tools/etc/{login.{access,defs},limits} ${CLFS}/etc

The purpose of each link:

/bin/bash

Many bash scripts specify /bin/bash.

/bin/cat

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

/bin/echo

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

/bin/grep

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

/bin/login

The agetty program expects to find login in /bin.

/bin/pwd

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

/bin/stty

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

/usr/bin/file

Binutils' configure scripts specify this command location.

/usr/lib/libgcc_s.so{,.1}

Glibc needs this for the pthreads library to work.

/usr/lib/libstdc++{,.6}

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

/usr/lib/libstdc++.la

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

/bin/sh

Many shell scripts hard-code /bin/sh.

/sbin/init

This is where the kernel expects to find init.

/etc/{login.{access,defs},limits}

These are configuration files used by Shadow and are expected to be found in /etc, for programs such as login and su to work.

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 ${CLFS}/etc/mtab