source: chapter06/createfiles.xml@ ee1a413

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

Change profiling attribute to enable selection of m32 and/or mx32. Fixes #4452.

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

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