/[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.16 - (hide annotations) (download) (as text)
Tue Mar 14 14:59:22 2006 UTC (8 years, 3 months ago) by neysx
Branch: MAIN
Changes since 1.15: +26 -23 lines
File MIME type: application/xml
#115151 clear up when mdadm.conf should be copied and extra improvements

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

  ViewVC Help
Powered by ViewVC 1.1.20