source: chapter06/createfiles.xml@ ffce215

multilib-10.1 multilib-before-cross
Last change on this file since ffce215 was ffce215, checked in by Thomas Trepl <thomas@…>, 3 years ago

Cleaner separation of multilib instructions

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11576 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 13.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-system-createfiles">
9 <?dbhtml filename="createfiles.html"?>
10
11 <title>Creating Essential Files and Symlinks</title>
12
13 <indexterm zone="ch-system-createfiles">
14 <primary sortas="e-/etc/passwd">/etc/passwd</primary>
15 </indexterm>
16
17 <indexterm zone="ch-system-createfiles">
18 <primary sortas="e-/etc/group">/etc/group</primary>
19 </indexterm>
20
21 <indexterm zone="ch-system-createfiles">
22 <primary sortas="e-/var/run/utmp">/var/run/utmp</primary>
23 </indexterm>
24
25 <indexterm zone="ch-system-createfiles">
26 <primary sortas="e-/var/log/btmp">/var/log/btmp</primary>
27 </indexterm>
28
29 <indexterm zone="ch-system-createfiles">
30 <primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary>
31 </indexterm>
32
33 <indexterm zone="ch-system-createfiles">
34 <primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
35 </indexterm>
36
37 <para>Some programs use hard-wired paths to programs which do not exist yet.
38 In order to satisfy these programs, create a number of symbolic links which
39 will be replaced by real files throughout the course of this chapter after the
40 software has been installed:</para>
41
42<screen><userinput>ln -sv /tools/bin/{bash,cat,chmod,dd,echo,ln,mkdir,pwd,rm,stty,touch} /bin
43ln -sv /tools/bin/{env,install,perl,printf} /usr/bin
44ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
45ln -sv /tools/lib/libstdc++.{a,so{,.6}} /usr/lib
46
47install -vdm755 /usr/lib/pkgconfig
48
49ln -sv bash /bin/sh</userinput></screen>
50
51<screen arch="ml_32,ml_x32,ml_all"><userinput arch="ml_32,ml_all">
52ln -sv /tools/lib32/libgcc_s.so{,.1} /usr/lib32
53ln -sv /tools/lib32/libstdc++.{a,so{,.6}} /usr/lib32
54install -vdm755 /usr/lib32/pkgconfig
55</userinput>
56<userinput arch="ml_x32,ml_all">
57ln -sv /tools/libx32/libgcc_s.so{,.1} /usr/libx32
58ln -sv /tools/libx32/libstdc++.{a,so{,.6}} /usr/libx32
59ln -sv /usr/libx32 /
60install -vdm755 /usr/libx32/pkgconfig
61</userinput></screen>
62
63<!--for lib in blkid lzma mount uuid
64do
65 ln -sv /tools/lib/lib$lib.so* /usr/lib
66done-->
67<!--ln -svf /tools/include/blkid /usr/include
68ln -svf /tools/include/libmount /usr/include
69ln -svf /tools/include/uuid /usr/include-->
70<!--for pc in blkid mount uuid
71do
72 sed 's@tools@usr@g' /tools/lib/pkgconfig/${pc}.pc \
73 > /usr/lib/pkgconfig/${pc}.pc
74done-->
75 <variablelist>
76 <title>The purpose of each link:</title>
77
78 <varlistentry>
79 <term><parameter><filename>/bin/bash</filename></parameter></term>
80 <listitem>
81 <para>Many <command>bash</command> scripts specify
82 <filename>/bin/bash</filename>.</para>
83 </listitem>
84 </varlistentry>
85
86 <varlistentry>
87 <term><parameter><filename>/bin/cat</filename></parameter></term>
88 <listitem>
89 <para>This pathname is hard-coded into Glibc's configure script.</para>
90 </listitem>
91 </varlistentry>
92
93 <varlistentry>
94 <term><parameter><filename>/bin/dd</filename></parameter></term>
95 <listitem>
96 <para>The path to <filename>dd</filename> will be hard-coded into the
97 <filename>/usr/bin/libtool</filename> utility.</para>
98 </listitem>
99 </varlistentry>
100
101 <varlistentry>
102 <term><parameter><filename>/bin/echo</filename></parameter></term>
103 <listitem>
104 <para>This is to satisfy one of the tests in Glibc's test suite, which
105 expects <filename>/bin/echo</filename>.</para>
106 </listitem>
107 </varlistentry>
108
109 <varlistentry>
110 <term><parameter><filename>/usr/bin/env</filename></parameter></term>
111 <listitem>
112 <para>This pathname is hard-coded into some packages build procedures.
113 <!-- systemd This may not be needed if we move sysd to the end--></para>
114 </listitem>
115 </varlistentry>
116
117 <varlistentry>
118 <term><parameter><filename>/usr/bin/install</filename></parameter></term>
119 <listitem>
120 <para>The path to <filename>install</filename> will be hard-coded into
121 the <filename>/usr/lib/bash/Makefile.inc</filename> file.</para>
122 </listitem>
123 </varlistentry>
124
125 <varlistentry>
126 <term><parameter><filename>/bin/ln</filename></parameter></term>
127 <listitem>
128 <para>The path to <filename>ln</filename> will be hard-coded into the
129 <filename>/usr/lib/perl5/&perl-version;/&lt;target-triplet&gt;/Config_heavy.pl</filename>
130 file.</para>
131 </listitem>
132 </varlistentry>
133
134 <varlistentry>
135 <term><parameter><filename>/bin/pwd</filename></parameter></term>
136 <listitem>
137 <para>Some <command>configure</command> scripts, particularly Glibc's,
138 have this pathname hard-coded.</para>
139 </listitem>
140 </varlistentry>
141
142 <varlistentry>
143 <term><parameter><filename>/bin/rm</filename></parameter></term>
144 <listitem>
145 <para>The path to <filename>rm</filename> will be hard-coded into the
146 <filename>/usr/lib/perl5/&perl-version;/&lt;target-triplet&gt;/Config_heavy.pl</filename>
147 file.</para>
148 </listitem>
149 </varlistentry>
150
151 <varlistentry>
152 <term><parameter><filename>/bin/stty</filename></parameter></term>
153 <listitem>
154 <para>This pathname is hard-coded into Expect, therefore it is needed
155 for Binutils and GCC test suites to pass.</para>
156 </listitem>
157 </varlistentry>
158
159 <varlistentry>
160 <term><parameter><filename>/usr/bin/perl</filename></parameter></term>
161 <listitem>
162 <para>Many Perl scripts hard-code this path to the
163 <command>perl</command> program.</para>
164 </listitem>
165 </varlistentry>
166
167 <varlistentry>
168 <term><parameter><filename>/usr/lib/libgcc_s.so{,.1}</filename></parameter></term>
169 <listitem>
170 <para>Glibc needs this for the pthreads library to work.</para>
171 </listitem>
172 </varlistentry>
173
174 <varlistentry>
175 <term><parameter><filename>/usr/lib/libstdc++{,.6}</filename></parameter></term>
176 <listitem>
177 <para>This is needed by several tests in Glibc's test suite, as well as
178 for C++ support in GMP.</para>
179 </listitem>
180 </varlistentry>
181<!--
182 <varlistentry>
183 <term><parameter><filename>/usr/lib/libstdc++.la</filename></parameter></term>
184 <listitem>
185 <para>This prevents a <filename class="directory">/tools</filename>
186 reference that would otherwise be in
187 <filename>/usr/lib/libstdc++.la</filename> after GCC is installed.</para>
188 </listitem>
189 </varlistentry>
190-->
191 <!--<varlistentry revision="systemd">-->
192<!-- <varlistentry>
193 <term><parameter><filename>/usr/lib/lib{blkid,lzma,mount,uuid}.{a,la,so*}</filename></parameter></term>
194 <listitem>
195 <para>These links prevent utilities from acquiring an
196 unnecessary reference to the
197 <filename class="directory">/tools</filename> directory.</para>
198 </listitem>
199 </varlistentry>-->
200
201 <varlistentry>
202 <term><parameter><filename>/bin/sh</filename></parameter></term>
203 <listitem>
204 <para>Many shell scripts hard-code <filename>/bin/sh</filename>.</para>
205 </listitem>
206 </varlistentry>
207
208 </variablelist>
209
210 <para>Historically, Linux maintains a list of the mounted file systems in the
211 file <filename>/etc/mtab</filename>. Modern kernels maintain this list
212 internally and exposes it to the user via the <filename
213 class="directory">/proc</filename> filesystem. To satisfy utilities that
214 expect the presence of <filename>/etc/mtab</filename>, create the following
215 symbolic link:</para>
216
217<screen><userinput>ln -sv /proc/self/mounts /etc/mtab</userinput></screen>
218
219 <para>In order for user <systemitem class="username">root</systemitem> to be
220 able to login and for the name <quote>root</quote> to be recognized, there
221 must be relevant entries in the <filename>/etc/passwd</filename> and
222 <filename>/etc/group</filename> files.</para>
223
224 <para>Create the <filename>/etc/passwd</filename> file by running the following
225 command:</para>
226
227<screen revision="sysv"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
228<literal>root:x:0:0:root:/root:/bin/bash
229bin:x:1:1:bin:/dev/null:/bin/false
230daemon:x:6:6:Daemon User:/dev/null:/bin/false
231messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
232nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
233EOF</userinput></screen>
234
235<screen revision="systemd"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
236<literal>root:x:0:0:root:/root:/bin/bash
237bin:x:1:1:bin:/dev/null:/bin/false
238daemon:x:6:6:Daemon User:/dev/null:/bin/false
239messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
240systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false
241systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false
242systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false
243systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false
244systemd-network:x:76:76:systemd Network Management:/:/bin/false
245systemd-resolve:x:77:77:systemd Resolver:/:/bin/false
246systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false
247systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false
248nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
249EOF</userinput></screen>
250
251 <para>The actual password for <systemitem class="username">root</systemitem>
252 (the <quote>x</quote> used here is just a placeholder) will be set later.</para>
253
254 <para>Create the <filename>/etc/group</filename> file by running the following
255 command:</para>
256
257<screen revision="sysv"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
258<literal>root:x:0:
259bin:x:1:daemon
260sys:x:2:
261kmem:x:3:
262tape:x:4:
263tty:x:5:
264daemon:x:6:
265floppy:x:7:
266disk:x:8:
267lp:x:9:
268dialout:x:10:
269audio:x:11:
270video:x:12:
271utmp:x:13:
272usb:x:14:
273cdrom:x:15:
274adm:x:16:
275messagebus:x:18:
276input:x:24:
277mail:x:34:
278kvm:x:61:
279wheel:x:97:
280nogroup:x:99:
281users:x:999:</literal>
282EOF</userinput></screen>
283
284<screen revision="systemd"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
285<literal>root:x:0:
286bin:x:1:daemon
287sys:x:2:
288kmem:x:3:
289tape:x:4:
290tty:x:5:
291daemon:x:6:
292floppy:x:7:
293disk:x:8:
294lp:x:9:
295dialout:x:10:
296audio:x:11:
297video:x:12:
298utmp:x:13:
299usb:x:14:
300cdrom:x:15:
301adm:x:16:
302messagebus:x:18:
303systemd-journal:x:23:
304input:x:24:
305mail:x:34:
306kvm:x:61:
307systemd-bus-proxy:x:72:
308systemd-journal-gateway:x:73:
309systemd-journal-remote:x:74:
310systemd-journal-upload:x:75:
311systemd-network:x:76:
312systemd-resolve:x:77:
313systemd-timesync:x:78:
314systemd-coredump:x:79:
315wheel:x:97:
316nogroup:x:99:
317users:x:999:</literal>
318EOF</userinput></screen>
319
320 <para>The created groups are not part of any standard&mdash;they are groups
321 decided on in part by the requirements of the Udev configuration in this
322 chapter, and in part by common convention employed by a number of existing
323 Linux distributions. In addition, some test suites rely on specific users
324 or groups. The Linux Standard Base (LSB, available at <ulink
325 url="http://www.linuxbase.org"/>) recommends only that, besides the group
326 <systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
327 a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
328 present. All other group names and GIDs can be chosen freely by the system
329 administrator since well-written programs do not depend on GID numbers, but
330 rather use the group's name.</para>
331
332 <para>To remove the <quote>I have no name!</quote> prompt, start a new
333 shell. Since a full Glibc was installed in <xref
334 linkend="chapter-temporary-tools"/> and the
335 <filename>/etc/passwd</filename> and <filename>/etc/group</filename>
336 files have been created, user name and group name resolution will now
337 work:</para>
338
339<screen role="nodump"><userinput>exec /tools/bin/bash --login +h</userinput></screen>
340
341 <para>Note the use of the <parameter>+h</parameter> directive. This tells
342 <command>bash</command> not to use its internal path hashing. Without this
343 directive, <command>bash</command> would remember the paths to binaries it has
344 executed. To ensure the use of the newly compiled binaries as soon as they are
345 installed, the <parameter>+h</parameter> directive will be used for the duration
346 of this chapter.</para>
347
348 <para>The <command>login</command>, <command>agetty</command>, and
349 <command>init</command> programs (and others) use a number of log
350 files to record information such as who was logged into the system and
351 when. However, these programs will not write to the log files if they
352 do not already exist. Initialize the log files and give them
353 proper permissions:</para>
354
355<screen><userinput>touch /var/log/{btmp,lastlog,faillog,wtmp}
356chgrp -v utmp /var/log/lastlog
357chmod -v 664 /var/log/lastlog
358chmod -v 600 /var/log/btmp</userinput></screen>
359
360 <para>The <filename>/var/log/wtmp</filename> file records all logins and
361 logouts. The <filename>/var/log/lastlog</filename> file records when each
362 user last logged in. The <filename>/var/log/faillog</filename> file records
363 failed login attempts. The <filename>/var/log/btmp</filename> file records
364 the bad login attempts.</para>
365
366 <note><para>The <filename>/run/utmp</filename> file records the users that
367 are currently logged in. This file is created dynamically in the boot
368 scripts.</para></note>
369
370</sect1>
Note: See TracBrowser for help on using the repository browser.