/[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.30 - (show annotations) (download) (as text)
Mon Dec 26 15:22:40 2011 UTC (2 years, 11 months ago) by swift
Branch: MAIN
Changes since 1.29: +5 -5 lines
File MIME type: application/xml
Fix bug #384117 - Refer to the more recent SATA device scheme instead of older IDE

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

  ViewVC Help
Powered by ViewVC 1.1.20