/[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.26 - (show annotations) (download) (as text)
Wed May 21 20:26:03 2008 UTC (6 years, 5 months ago) by swift
Branch: MAIN
Changes since 1.25: +30 -28 lines
File MIME type: application/xml
Coding style

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

  ViewVC Help
Powered by ViewVC 1.1.20