/[gentoo]/xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml
Gentoo

Contents of /xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download) (as text)
Wed Sep 22 21:57:14 2004 UTC (10 years, 1 month ago) by neysx
Branch: MAIN
Changes since 1.8: +1 -0 lines
File MIME type: application/xml
Added $Header$ CVS Keyword -- No Content Change --

1 <?xml version='1.0' encoding="UTF-8"?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 <!-- $Header$ -->
4
5 <guide link="/doc/en/gentoo-x86-tipsntricks.xml">
6 <title>Gentoo/x86 Installation Tips &amp; Tricks</title>
7 <author title="Author">
8 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
9 </author>
10
11 <abstract>
12 The Gentoo installation allows for very flexible approaches to the various
13 installation methods. As it is almost impossible to insert every single tip or
14 trick in the installation instructions this document tries to deal with all
15 submitted tips and tricks for reference purposes.
16 </abstract>
17
18 <license/>
19
20 <version>1.5</version>
21 <date>September 22, 2004</date>
22
23 <chapter>
24 <title>Introduction</title>
25 <section>
26 <title>Preliminary</title>
27 <body>
28
29 <p>
30 This document contains various tips and tricks for the Gentoo/x86 installation.
31 Most of them are discussed in a dense way - they are meant as an addendum to the
32 installation instructions and not as a replacement.
33 </p>
34
35 </body>
36 </section>
37 <section>
38 <title>Contents</title>
39 <body>
40
41 <p>
42 <b>Advanced Installations</b>
43 </p>
44
45 <ul>
46 <li><uri link="#software-raid">Software RAID</uri></li>
47 <li><uri link="#ata-raid-2.4">ATA RAID using 2.4 kernels</uri></li>
48 </ul>
49
50 <p>
51 <b>Simplifying the Installation</b>
52 </p>
53
54 <ul>
55 <li><uri link="#leave_terminal">Leaving the Terminal</uri></li>
56 </ul>
57
58 <p>
59 <b>Fixing Errors/Issues</b>
60 </p>
61
62 <ul>
63 <li><uri link="#checking-disks">Extensive Testing of your Disks</uri></li>
64 <li>
65 <uri link="#recover">Recovering from a malfunctioning installation</uri>
66 </li>
67 </ul>
68
69 </body>
70 </section>
71 </chapter>
72 <chapter>
73 <title>Advanced Installations</title>
74 <section id="software-raid">
75 <title>Software RAID</title>
76 <body>
77
78 <note>
79 If you are not known to software raid, please read the <uri
80 link="http://tldp.org/HOWTO/Software-RAID-HOWTO.html">Software-RAID-HOWTO</uri>.
81 </note>
82
83 <p>
84 Once you are booted from the LiveCD, load the appropriate RAID modules. For
85 instance, if you plan on using RAID-1:
86 </p>
87
88 <pre caption="Loading the RAID-1 module">
89 # <i>modprobe raid1</i>
90 </pre>
91
92 <p>
93 When you partition your disks, make sure that your partitions use <c>fd</c>
94 (Linux raid autodetect) as Partition Type instead of <c>83</c> (Linux native).
95 You can alter the partition type using the <c>t</c> command in <c>fdisk</c>.
96 </p>
97
98 <p>
99 After partitioning, create the <path>/etc/mdadm.conf</path> file (yes, indeed,
100 on the LiveCD environment) using <c>mdadm</c>, an advanced tool for <uri
101 link="http://www.linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html">RAID
102 management</uri>. For instance, to have your boot, swap and root partition
103 mirrored (RAID-1) covering <path>/dev/sda</path> and <path>/dev/sdb</path>,
104 you can use:
105 </p>
106
107 <pre caption="mdadm command example">
108 # <i>mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1</i>
109 # <i>mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2</i>
110 # <i>mdadm --create --verbose /dev/md2 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3</i>
111 </pre>
112
113 <p>
114 The Linux Software RAID driver will start creating the metadevices. You can see
115 its progress in <path>/proc/mdstat</path>. Wait until the metadevices are
116 completely finished before proceeding.
117 </p>
118
119 <p>
120 From now onwards, use <path>/dev/md0</path> for the boot partition,
121 <path>/dev/md1</path> for the swap partition and <path>/dev/md2</path> for the
122 root partition.
123 </p>
124
125 <p>
126 After mounting <path>/dev/md2</path> on <path>/mnt/gentoo</path>, don't forget
127 to copy over <path>/etc/mdadm.conf</path> to <path>/mnt/gentoo/etc</path>.
128 </p>
129
130 <p>
131 When you're configuring your kernel, make sure you have the appropriate RAID
132 support <e>in</e> your kernel and not as module.
133 </p>
134
135 <p>
136 When installing extra tools, emerge <c>mdadm</c> as well. Note that this
137 isn't available on all LiveCDs so you might not be able to install Gentoo on a
138 Software RAID when using a networkless installation!
139 </p>
140
141 <p>
142 When configuring your bootloader, make sure it gets installed in the MBR of
143 <e>both</e> disks if you use mirroring.
144 </p>
145
146 </body>
147 </section>
148 <section id="ata-raid-2.4">
149 <title>ATA RAID using 2.4 kernels</title>
150 <body>
151
152 <p>
153 Make sure you boot your LiveCD using the <c>doataraid</c> option. Once booted,
154 check the contents of <path>/dev/ataraid</path>. It should contain various
155 <path>disc*</path> directories for each harddisk available in the ATA RAID. An
156 entire disk is displayed as <path>disc</path> while partitions are
157 <path>part*</path>.
158 </p>
159
160 <p>
161 Write down the various <path>/dev/ataraid/disc*/*</path> device files that you
162 use to install Gentoo on. You will need to substitute the <path>/dev/hda</path>
163 examples in the installation with this path.
164 </p>
165
166 <p>
167 Before chrooting, bind-mount the <path>/dev</path> structure in the new
168 environment:
169 </p>
170
171 <pre caption="Bind-mounting /dev">
172 # <i>mount -o bind /dev /mnt/gentoo/dev</i>
173 </pre>
174
175 <p>
176 When configuring your kernel, make sure you enable support for your ATA RAID
177 chipset and options. For instance, a popular ATA RAID system is a <e>Promise
178 FastTrack built-in RAID</e> in which case you definitely need <c>Promise
179 FastTrack Options</c> built in into your kernel.
180 </p>
181
182 <p>
183 When configuring GRUB, you first have to create a GRUB bootdisk. This is not as
184 hard as you think. First install GRUB as you would, but when you come to the
185 part where GRUB is getting installed in the MBR, follow the following
186 instructions:
187 </p>
188
189 <pre caption="Creating a GRUB bootdisk">
190 # <i>cd /boot/grub</i>
191 # <i>dd if=stage1 of=/dev/fd0 bs=512 count=1</i>
192 # <i>dd if=stage2 of=/dev/fd0 bs=512 seek=1</i>
193 </pre>
194
195 <p>
196 You still need to write your <path>grub.conf</path> file. This is no different
197 from the installation instructions, just make sure that your <c>root=</c> points
198 to the ATA RAID device.
199 </p>
200
201 <p>
202 After finishing the installation, boot with your GRUB bootdisk. You will be
203 greeted by a GRUB prompt. Now configure GRUB to boot from the ATA RAID device:
204 </p>
205
206 <pre caption="Installing GRUB on the ATA RAID">
207 grub&gt; root (hd0,x)
208 grub&gt; setup (hd0)
209 grub&gt; quit
210 </pre>
211
212 <p>
213 Now reboot (with the GRUB bootfloppy removed).
214 </p>
215
216 <p>
217 LILO users can safely use the instructions mentioned in the installation
218 instructions.
219 </p>
220
221 </body>
222 </section>
223 </chapter>
224
225 <chapter>
226 <title>Simplifying the Installation</title>
227 <section id="leave_terminal">
228 <title>Leaving your Terminal</title>
229 <body>
230
231 <p>
232 Many people want to leave their system when it's compiling. In certain cases
233 this is rather difficult as the installation is done in a public environment
234 where you cannot trust everyone. If this is the case, you want to be able to
235 perform the compilation in the background and log out from all terminals.
236 </p>
237
238 <p>
239 There are several possible solutions for this. The first one is to use
240 <c>screen</c>. After booting the LiveCD, set your root password and start a
241 screen session:
242 </p>
243
244 <note>
245 Not all LiveCDs provide screen. If this is the case, you will have to use one of
246 the other methods described in this section.
247 </note>
248
249 <pre caption="Starting a screen session">
250 # <i>screen -S gentoo</i>
251 </pre>
252
253 <p>
254 Once inside the screen session you can perform the entire installation. When you
255 want to leave your terminal, press <c>Ctrl-a, d</c> (that is, control and a at
256 the same time, then followed by a d) to <e>detach</e> your screen session. You
257 can now safely log out of your system.
258 </p>
259
260 <p>
261 To regain access to your terminal, log in as root again and <e>attach</e> to
262 the running screen session:
263 </p>
264
265 <pre caption="Attaching to a screen session">
266 # <i>screen -x gentoo</i>
267 </pre>
268
269 <p>
270 If you can't use screen, there is still a way to leave your terminal. Follow the
271 installation instructions, but when you come to the point where a long-term
272 compilation would be started (for instance the <c>./scripts/bootstrap.sh</c>
273 step), use <c>nohup</c> which allows for a process to continue even when you log
274 out. Don't forget the trailing "&amp;", otherwise the process won't be placed in
275 the background! Remember where you are (the <c>pwd</c> command will show you
276 that) as you will need to know this later on.
277 </p>
278
279 <pre caption="Using nohup">
280 # <i>pwd</i>
281 /usr/portage
282 # <i>nohup ./scripts/bootstrap.sh &amp;</i>
283 </pre>
284
285 <p>
286 Now exit the chrooted environment (<c>exit</c>) and the LiveCD session. Your
287 compilation will continue in the background.
288 </p>
289
290 <p>
291 When you want to check the compilation, log in as root (on the LiveCD) and
292 chroot back into your environment and go to the directory where you left off:
293 </p>
294
295 <pre caption="Chrooting back">
296 # <i>chroot /mnt/gentoo /bin/bash</i>
297 # <i>env-update &amp;&amp; source /etc/profile</i>
298 # <i>cd /usr/portage</i>
299 </pre>
300
301 <p>
302 Now use the <c>less</c> command on the <path>nohup.out</path> file that is
303 situated inside that directory. The compilation will append its output to that
304 file, so if you want to follow the compilation progress, run <c>less
305 nohup.out</c> and press <c>F</c> to follow the changes. When the compilation is
306 finished, you can continue with the next step of the installation instructions.
307 </p>
308
309 <p>
310 If you ever get tired of following the changes, press <c>Ctrl-C</c> followed by
311 a <c>q</c>. This won't stop the compilation process, only the <c>less</c>
312 process.
313 </p>
314
315 </body>
316 </section>
317 </chapter>
318
319 <chapter>
320 <title>Fixing Errors/Issues</title>
321 <section id="checking-disks">
322 <title>Extensive Testing of your Disks</title>
323 <body>
324
325 <p>
326 If you think your disk needs to be thoroughly checked for consistency (bad
327 sectors and such), you can use the <c>-c</c> option while placing the ext2 or
328 ext3 filesystem on it (using <c>mke2fs</c>). This will perform a read-test and
329 will mark all bad blocks as such. If you are really paranoid, use <c>-c -c</c>
330 to perform an extensive read/write test.
331 </p>
332
333 <pre caption="Checking for disk consistency">
334 # <i>mke2fs -j -c /dev/hda3</i>
335 </pre>
336
337 </body>
338 </section>
339 <section id="recover">
340 <title>Recovering from a malfunctioning installation</title>
341 <body>
342
343 <p>
344 If for some reason your Gentoo installation fails, you don't have to redo the
345 installation all over again. Instead, you can safely "go" to the point where you
346 think you made a mistake (or where you think the instructions are flawed) and
347 try a different approach.
348 </p>
349
350 <p>
351 First of all you need to chroot back into your Gentoo Linux environment. Follow
352 the instructions again, but ignore the partitioning steps as your partitions are
353 already created and even populated. You can therefore immediately mount those
354 partitions at <path>/mnt/gentoo</path>. You should also ignore the steps about
355 stage extraction and modifying <path>make.conf</path> - you don't want to
356 overwrite your files do you?
357 </p>
358
359 <p>
360 Once chrooted inside your Gentoo Linux environment, immediately go to the step
361 where you think you should try a different approach. Don't redo all the steps
362 like bootstrapping and such unless that is the place where you think things
363 went wrong.
364 </p>
365
366 <p>
367 For instance, if you believe that you have a wrongly configured
368 <path>grub.conf</path>, you can immediately fire up your editor to update
369 <path>/boot/grub/grub.conf</path>.
370 </p>
371
372 <p>
373 Once you have tried a different approach for your situation, you should consider
374 how much of the subsequent steps you need to perform again. If the subsequent
375 steps are depending on your change, you will need to redo those.
376 </p>
377
378 <p>
379 For instance,
380 </p>
381
382 <ul>
383 <li>
384 if you have changed a variable inside <path>make.conf</path> you will need
385 to do all subsequent compiling since those depend on the settings inside
386 <path>make.conf</path>
387 </li>
388 <li>
389 if you have altered <path>/boot/grub/grub.conf</path> you can immediately
390 exit the chrooted environment and reboot as no subsequent steps are
391 depending on <path>grub.conf</path>
392 </li>
393 <li>
394 if you have recompiled your kernel you only need to make sure that your
395 bootloader configuration points to the correct kernel image (double-check
396 that you mounted your <path>/boot</path>!), then you can exit the chrooted
397 environment and reboot
398 </li>
399 <li>
400 if you have altered <path>/etc/fstab</path> you can exit the chrooted
401 environment and reboot
402 </li>
403 </ul>
404
405 <p>
406 As you can see, for most recovery operations you can immediately reboot. Only in
407 certain cases will you need to redo the subsequent installation steps.
408 </p>
409
410 </body>
411 </section>
412
413 </chapter>
414
415 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20