Typo
[linux_from_scratch_hints.git] / OLD / static-pwd.txt
blob3a191c21b5fbb4d28be90b6f29e9391f848dc78c
1 TITLE:          LFS 4.1 using static-pwd hack
2 LFS VERSION:    4.1
3 AUTHOR:         Ronald Hummelink <ronald AT hummelink DOT xs4all DOT nl>
5 SYNOPSIS:
6         How to install Linux From Scratch 4.1 from a pre glibc-2.3.x system
7         using the static password lib hack
9 ACKNOWLEDGEMENS:
10         Grant Leslie for inventing the hack.
12 CHANGELOG:
13         1.2     07-03-2002      Mention the glibc-2.3.1-libnss patch is not needed
14         1.1     05-03-2002      Initial release
16 HINT:
18 Use the hint at your own risk. Neither the author, nor the Linux From Scratch
19 project accepts any reponsibility for anything that happens when using these
20 documents or associated files.
22 You may freely copy this document or create derivate works or distribute the
23 document in any format. At your discretion, you may give credit to the original
24 author:)
26 Comments and improvements are welcome at the email address mentioned above in
27 the author field.
29 When installing Linux From Scratch with glibc 2.3.1 from a system with an
30 older glibc version installed several binaries will crash with a segmentation
31 fault when attempting to access the libnss libraries. This is due to an
32 incompatibility between the static binaries (linked with old glibc) and the
33 new nss libraries.
35 This hint describes how to work around this problem by compiling a small
36 library that will replace the passwd and group resolving functions avoiding
37 the binaries to crash.
40 The work-around only involves a number of changes to chapter 5 of the LFS book.
41 The hint will only list instructions for the packages that have changed
42 instructions.
44 Before building bash you need to compile the static-pwd libary
46 Download the static-pwd package from:
47 http://www.linuxfromscratch.org/~scot/static-pwd.tar.bz2
48 Extract the tarball normally and cd into the created directory
50 Build libpwd.a:
52         make &&
53         export LFS_LIBS=$(pwd)
55 export LFS_LIBS=$(pwd): This command sets an environment variable to aid in
56 linking this library with some of the later installed programs.
59 Bash-2.05a
61 Install Bash by running the following commands:
63         CFLAGS="-I$LFS_LIBS" ./configure --enable-static-link \
64             --prefix=$LFS/static --with-curses &&
65         make LOCAL_LIBS="$LFS_LIBS/libpwd.a" &&
66         make install
68 CFLAGS="-I$LFS_LIBS": This adds the static-pwd directory to the library search
69 path.
70 LOCAL_LIBS="$LFS_LIBS/libpwd.a": This adds the static-pwd stub library to the
71 library list.
74 Fileutils-4.1
76 If you need the fileutils patch, apply it:
78         patch -Np1 -i ../fileutils-4.1.patch
80 Install Fileutils by running the following commands:
82         LDFLAGS=-static CFLAGS="-I$LFS_LIBS" \
83             ./configure --disable-nls --prefix=$LFS/static &&
84         make LIBS="$LFS_LIBS/libpwd.a" &&
85         make install
87 LIBS="$LFS_LIBS/libpwd.a": This adds the static_pwd stub library to the
88 library list.
91 Findutils-4.1
93 Install Findutils by running the following commands:
95         patch -Np1 -i ../findutils-4.1.patch &&
96         CPPFLAGS=-Dre_max_failures=re_max_failures2 \
97             CFLAGS="-I$LFS_LIBS" ./configure --prefix=$LFS/static &&
98         make LDFLAGS=-static LIBS="$LFS_LIBS/libpwd.a" &&
99         make install
102 Make-3.80
104 Install Make by running the following commands:
106         CFLAGS="-I$LFS_LIBS" ./configure \
107             --prefix=$LFS/static --disable-nls &&
108         make LDFLAGS=-static LIBS="$LFS_LIBS/libpwd.a" &&
109         make install
112 Sh-utils-2.0
114 If you need the sh-utils patch, apply it:
116 patch -Np1 -i ../sh-utils-2.0.patch
118 Install Sh-utils by running the following commands:
120         CFLAGS="-I$LFS_LIBS" ./configure --prefix=$LFS/static \
121             --disable-nls &&
122         make LDFLAGS=-static LIBS="$LFS_LIBS/libpwd.a" &&
123         make install
126 Tar-1.13
128 If you want the tar patch, apply it:
130         patch -Np1 -i ../tar-1.13.patch
132 Install Tar by running the following commands:
134         CFLAGS="-I$LFS_LIBS" ./configure \
135              --prefix=$LFS/static --disable-nls &&
136         make LDFLAGS=-static LIBS="$LFS_LIBS/libpwd.a" &&
137         make install
140 All the other packages build in chapter 5 are build with the normal
141 instructions as given in the book.
143 Optionally you can create the passwd and group files before chrooting into the
144 chapter 5 system. This is purely cosmetic however, you won't get the
145 "I have no name" prompt from bash.
147 mkdir $LFS/etc &&
148 echo "root:x:0:0:root:/root:/bin/bash" > $LFS/etc/passwd
150 cat > $LFS/etc/group << "EOF"
151 root:x:0:
152 bin:x:1:
153 sys:x:2:
154 kmem:x:3:
155 tty:x:4:
156 tape:x:5:
157 daemon:x:6:
158 floppy:x:7:
159 disk:x:8:
160 lp:x:9:
161 dialout:x:10:
162 audio:x:11:
165 If you do this you can also change the command to change the ownership from
166 the lfs user to:
168 chown -R root:root /static /etc/passwd /etc/group
170 You should from now on be able to complete chapter 6 without encountering
171 segmentation faults. When installing glibc, the glibc-2.3.1-libnss patch
172 is not needed anymore. It is cleaner to omit the patch but it won't hurt
173 to apply it if you do decide to rebuild glibc at the end of chapter 6.