/[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.15 - (show annotations) (download) (as text)
Mon Oct 3 20:53:53 2005 UTC (9 years, 1 month ago) by rane
Branch: MAIN
Changes since 1.14: +17 -15 lines
File MIME type: application/xml
LiveCD -> Installation CD, no other content change

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

  ViewVC Help
Powered by ViewVC 1.1.20