source: chapter06/createfiles.xml@ cbd8bf0f

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since cbd8bf0f was cbd8bf0f, checked in by Bruce Dubbs <bdubbs@…>, 8 years ago

Updates after a successful jhalfs build

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

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