/[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.28 - (hide annotations) (download) (as text)
Mon May 9 20:15:47 2011 UTC (3 years, 2 months ago) by nightmorph
Branch: MAIN
Changes since 1.27: +9 -7 lines
File MIME type: application/xml
add metadata option, patch from swift on bug 359593

1 swift 1.1 <?xml version='1.0' encoding="UTF-8"?>
2     <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 nightmorph 1.28 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml,v 1.27 2011/03/16 07:47:44 nightmorph Exp $ -->
4 swift 1.1
5 nightmorph 1.27 <guide>
6 swift 1.1 <title>Gentoo/x86 Installation Tips &amp; Tricks</title>
7 neysx 1.16
8 swift 1.1 <author title="Author">
9 nightmorph 1.21 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
10 neysx 1.16 </author>
11     <author title="Editor">
12     <mail link="neysx@gentoo.org">Xavier Neys</mail>
13 swift 1.1 </author>
14 nightmorph 1.27 <author title="Editor">
15     <mail link="nightmorph"/>
16     </author>
17 swift 1.1
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 rane 1.15 <!-- The content of this document is licensed under the CC-BY-SA license -->
26     <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
27 swift 1.1 <license/>
28    
29 nightmorph 1.28 <version>3</version>
30     <date>2011-05-09</date>
31 swift 1.1
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 swift 1.2 <p>
51     <b>Advanced Installations</b>
52     </p>
53    
54 swift 1.1 <ul>
55     <li><uri link="#software-raid">Software RAID</uri></li>
56 swift 1.4 <li><uri link="#ata-raid-2.4">ATA RAID using 2.4 kernels</uri></li>
57 rane 1.15 <li><uri link="#livecd-kernel">Using the Installation CD kernel</uri></li>
58 swift 1.1 </ul>
59    
60 swift 1.3 <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 swift 1.5 <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 swift 1.6 <li>
75     <uri link="#recover">Recovering from a malfunctioning installation</uri>
76     </li>
77 swift 1.5 </ul>
78    
79 swift 1.1 </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 neysx 1.12 If you are not familiar with software raid, please read the <uri
90 swift 1.1 link="http://tldp.org/HOWTO/Software-RAID-HOWTO.html">Software-RAID-HOWTO</uri>.
91     </note>
92    
93 neysx 1.19 <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 swift 1.1 <p>
100 neysx 1.19 Once you are booted from the Installation CD, load the appropriate RAID
101     modules. For instance, if you plan on using RAID-1:
102 swift 1.1 </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 swift 1.11 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 neysx 1.17 # <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 swift 1.11 </pre>
124    
125     <p>
126 swift 1.26 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 swift 1.7 you can use:
132 swift 1.1 </p>
133    
134 neysx 1.17 <pre caption="Creating raid devices with the mdadm command">
135 nightmorph 1.28 # <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 swift 1.1 </pre>
139    
140 neysx 1.16 <impo>
141 nightmorph 1.18 You should not use any form of striping such as RAID-0 or RAID-5 on the
142 nightmorph 1.28 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 neysx 1.16 </impo>
146    
147 swift 1.1 <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 neysx 1.17 <pre caption="Saving information about the created devices">
154     # <i>mdadm --detail --scan > /etc/mdadm.conf</i>
155     </pre>
156    
157 swift 1.1 <p>
158 neysx 1.16 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 swift 1.1 root partition.
161     </p>
162    
163     <p>
164 neysx 1.16 Right before chrooting, don't forget to copy over <path>/etc/mdadm.conf</path>
165     to <path>/mnt/gentoo/etc</path>.
166 swift 1.1 </p>
167    
168     <p>
169     When you're configuring your kernel, make sure you have the appropriate RAID
170 swift 1.26 support <e>in</e> your kernel and not as module.
171 swift 1.1 </p>
172    
173     <p>
174 neysx 1.16 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 swift 1.1 </p>
178    
179     <p>
180     When configuring your bootloader, make sure it gets installed in the MBR of
181 swift 1.26 <e>both</e> disks if you use mirroring.
182 swift 1.1 </p>
183    
184     </body>
185     </section>
186 swift 1.4 <section id="ata-raid-2.4">
187     <title>ATA RAID using 2.4 kernels</title>
188     <body>
189    
190     <p>
191 swift 1.26 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 swift 1.4 <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/hda</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 nightmorph 1.27 # <i>mount --rbind /dev /mnt/gentoo/dev</i>
211 swift 1.4 </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 swift 1.26 to the ATA RAID device.
237 swift 1.4 </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 swift 1.10 <section id="livecd-kernel">
262 rane 1.15 <title>Using the Installation CD kernel</title>
263 swift 1.10 <body>
264    
265     <p>
266     If you don't want to compile a kernel yourself you can use the kernel from the
267 swift 1.26 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 swift 1.10 </p>
272    
273     <p>
274     Copy over the kernel and modules to your Gentoo system:
275     </p>
276    
277 rane 1.15 <pre caption="Copying over the Installation CD kernel">
278 swift 1.10 <comment>(${KN} is the kernel name, usually something like 'gentoo' or 'smp')</comment>
279 nightmorph 1.22 cdimage ~# <i>cp /mnt/cdrom/isolinux/${KN} /mnt/cdrom/isolinux/${KN}.igz /mnt/gentoo/boot</i>
280 swift 1.10 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 nightmorph 1.23 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 swift 1.10 </p>
289    
290     <pre caption="Adding all running modules to the modules.conf file">
291     # <i>cat /proc/modules | cut -d ' ' -f 1 &gt;&gt; \</i>
292     <i>/etc/modules.autoload.d/kernel-`uname -r | cut -d . -f -2`</i>
293 nightmorph 1.24 # <i>update-modules</i>
294 swift 1.10 </pre>
295    
296     </body>
297     </section>
298 swift 1.1 </chapter>
299 swift 1.3
300     <chapter>
301     <title>Simplifying the Installation</title>
302     <section id="leave_terminal">
303     <title>Leaving your Terminal</title>
304     <body>
305    
306     <p>
307     Many people want to leave their system when it's compiling. In certain cases
308     this is rather difficult as the installation is done in a public environment
309     where you cannot trust everyone. If this is the case, you want to be able to
310     perform the compilation in the background and log out from all terminals.
311     </p>
312    
313     <p>
314     There are several possible solutions for this. The first one is to use
315 swift 1.26 <c>screen</c>. After booting the Installation CD, set your root password and
316     start a screen session:
317 swift 1.3 </p>
318    
319     <note>
320 swift 1.26 Not all Installation CDs provide screen. If this is the case, you will have to
321     use one of the other methods described in this section.
322 swift 1.3 </note>
323    
324     <pre caption="Starting a screen session">
325     # <i>screen -S gentoo</i>
326     </pre>
327    
328     <p>
329     Once inside the screen session you can perform the entire installation. When you
330     want to leave your terminal, press <c>Ctrl-a, d</c> (that is, control and a at
331     the same time, then followed by a d) to <e>detach</e> your screen session. You
332     can now safely log out of your system.
333     </p>
334    
335     <p>
336 swift 1.26 To regain access to your terminal, log in as root again and <e>attach</e> to
337 swift 1.3 the running screen session:
338     </p>
339    
340     <pre caption="Attaching to a screen session">
341     # <i>screen -x gentoo</i>
342     </pre>
343    
344     <p>
345     If you can't use screen, there is still a way to leave your terminal. Follow the
346     installation instructions, but when you come to the point where a long-term
347     compilation would be started (for instance the <c>./scripts/bootstrap.sh</c>
348     step), use <c>nohup</c> which allows for a process to continue even when you log
349     out. Don't forget the trailing "&amp;", otherwise the process won't be placed in
350     the background! Remember where you are (the <c>pwd</c> command will show you
351     that) as you will need to know this later on.
352     </p>
353    
354     <pre caption="Using nohup">
355     # <i>pwd</i>
356     /usr/portage
357     # <i>nohup ./scripts/bootstrap.sh &amp;</i>
358     </pre>
359    
360     <p>
361 swift 1.26 Now exit the chrooted environment (<c>exit</c>) and the Installation CD session.
362     Your compilation will continue in the background.
363 swift 1.3 </p>
364    
365     <p>
366 swift 1.26 When you want to check the compilation, log in as root (on the Installation CD)
367     and chroot back into your environment and go to the directory where you left
368     off:
369 swift 1.3 </p>
370    
371     <pre caption="Chrooting back">
372     # <i>chroot /mnt/gentoo /bin/bash</i>
373     # <i>env-update &amp;&amp; source /etc/profile</i>
374     # <i>cd /usr/portage</i>
375     </pre>
376    
377     <p>
378     Now use the <c>less</c> command on the <path>nohup.out</path> file that is
379     situated inside that directory. The compilation will append its output to that
380     file, so if you want to follow the compilation progress, run <c>less
381     nohup.out</c> and press <c>F</c> to follow the changes. When the compilation is
382     finished, you can continue with the next step of the installation instructions.
383     </p>
384    
385     <p>
386     If you ever get tired of following the changes, press <c>Ctrl-C</c> followed by
387     a <c>q</c>. This won't stop the compilation process, only the <c>less</c>
388     process.
389     </p>
390    
391     </body>
392     </section>
393     </chapter>
394    
395 swift 1.5 <chapter>
396     <title>Fixing Errors/Issues</title>
397     <section id="checking-disks">
398     <title>Extensive Testing of your Disks</title>
399     <body>
400    
401     <p>
402     If you think your disk needs to be thoroughly checked for consistency (bad
403     sectors and such), you can use the <c>-c</c> option while placing the ext2 or
404 neysx 1.25 ext3 filesystem on it (using <c>mke2fs</c>). This will format, perform a
405     read-test and mark all bad blocks as such. If you are really paranoid, use
406     <c>-c -c</c> to format your disk and perform an extensive read/write test.
407 swift 1.5 </p>
408    
409     <pre caption="Checking for disk consistency">
410     # <i>mke2fs -j -c /dev/hda3</i>
411     </pre>
412    
413     </body>
414     </section>
415 swift 1.6 <section id="recover">
416     <title>Recovering from a malfunctioning installation</title>
417     <body>
418    
419     <p>
420     If for some reason your Gentoo installation fails, you don't have to redo the
421     installation all over again. Instead, you can safely "go" to the point where you
422     think you made a mistake (or where you think the instructions are flawed) and
423     try a different approach.
424     </p>
425    
426     <p>
427     First of all you need to chroot back into your Gentoo Linux environment. Follow
428     the instructions again, but ignore the partitioning steps as your partitions are
429     already created and even populated. You can therefore immediately mount those
430     partitions at <path>/mnt/gentoo</path>. You should also ignore the steps about
431 swift 1.26 stage extraction and modifying <path>make.conf</path> - you don't want to
432 swift 1.6 overwrite your files do you?
433     </p>
434    
435     <p>
436     Once chrooted inside your Gentoo Linux environment, immediately go to the step
437     where you think you should try a different approach. Don't redo all the steps
438     like bootstrapping and such unless that is the place where you think things
439     went wrong.
440     </p>
441    
442     <p>
443     For instance, if you believe that you have a wrongly configured
444     <path>grub.conf</path>, you can immediately fire up your editor to update
445     <path>/boot/grub/grub.conf</path>.
446     </p>
447    
448     <p>
449     Once you have tried a different approach for your situation, you should consider
450     how much of the subsequent steps you need to perform again. If the subsequent
451 swift 1.26 steps are depending on your change, you will need to redo those.
452 swift 1.6 </p>
453    
454     <p>
455     For instance,
456     </p>
457    
458     <ul>
459     <li>
460 swift 1.26 if you have changed a variable inside <path>make.conf</path> you will need
461 swift 1.6 to do all subsequent compiling since those depend on the settings inside
462     <path>make.conf</path>
463     </li>
464     <li>
465     if you have altered <path>/boot/grub/grub.conf</path> you can immediately
466     exit the chrooted environment and reboot as no subsequent steps are
467     depending on <path>grub.conf</path>
468     </li>
469     <li>
470     if you have recompiled your kernel you only need to make sure that your
471     bootloader configuration points to the correct kernel image (double-check
472     that you mounted your <path>/boot</path>!), then you can exit the chrooted
473     environment and reboot
474     </li>
475     <li>
476     if you have altered <path>/etc/fstab</path> you can exit the chrooted
477     environment and reboot
478     </li>
479     </ul>
480    
481     <p>
482     As you can see, for most recovery operations you can immediately reboot. Only in
483     certain cases will you need to redo the subsequent installation steps.
484     </p>
485    
486     </body>
487     </section>
488 swift 1.5 </chapter>
489 swift 1.1 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20